Lots of small fixes/improvements

This commit is contained in:
BotoX 2017-05-20 05:08:31 +02:00
parent 3912295377
commit 371d1ce242
10 changed files with 40 additions and 76 deletions

View File

@ -309,7 +309,7 @@ public Action Timer_CheckPlayer(Handle Timer, any Data)
for(client = 1; client <= MaxClients; client++) for(client = 1; client <= MaxClients; client++)
{ {
if(!g_Players_bEnabled[client]) if(!g_Players_bEnabled[client] || !IsClientInGame(client))
continue; continue;
int iTeamNum = GetClientTeam(client); int iTeamNum = GetClientTeam(client);

View File

@ -44,7 +44,7 @@ public void OnPluginStart()
RegAdminCmd("sm_strip", Command_Strip, ADMFLAG_GENERIC, "sm_strip <#userid|name>"); RegAdminCmd("sm_strip", Command_Strip, ADMFLAG_GENERIC, "sm_strip <#userid|name>");
RegAdminCmd("sm_buyzone", Command_BuyZone, ADMFLAG_GENERIC, "sm_buyzone <#userid|name> <0|1>"); RegAdminCmd("sm_buyzone", Command_BuyZone, ADMFLAG_GENERIC, "sm_buyzone <#userid|name> <0|1>");
RegAdminCmd("sm_iammo", Command_InfAmmo, ADMFLAG_GENERIC, "sm_iammo <#userid|name> <0|1>"); RegAdminCmd("sm_iammo", Command_InfAmmo, ADMFLAG_GENERIC, "sm_iammo <#userid|name> <0|1>");
RegAdminCmd("sm_speed", Command_Speed, ADMFLAG_GENERIC, "sm_speed <#userid|name> <0|1>"); RegAdminCmd("sm_speed", Command_Speed, ADMFLAG_GENERIC, "sm_speed <#userid|name> <value>");
RegAdminCmd("sm_respawn", Command_Respawn, ADMFLAG_GENERIC, "sm_respawn <#userid|name>"); RegAdminCmd("sm_respawn", Command_Respawn, ADMFLAG_GENERIC, "sm_respawn <#userid|name>");
RegAdminCmd("sm_team", Command_Team, ADMFLAG_GENERIC, "sm_team <#userid|name> <team> [alive]"); RegAdminCmd("sm_team", Command_Team, ADMFLAG_GENERIC, "sm_team <#userid|name> <team> [alive]");
RegAdminCmd("sm_cash", Command_Cash, ADMFLAG_GENERIC, "sm_cash <#userid|name> <value>"); RegAdminCmd("sm_cash", Command_Cash, ADMFLAG_GENERIC, "sm_cash <#userid|name> <value>");
@ -761,7 +761,7 @@ public Action Command_Team(int client, int argc)
int iTargetCount; int iTargetCount;
bool bIsML; bool bIsML;
if((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, COMMAND_FILTER_ALIVE, sTargetName, sizeof(sTargetName), bIsML)) <= 0) if((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, 0, sTargetName, sizeof(sTargetName), bIsML)) <= 0)
{ {
ReplyToTargetError(client, iTargetCount); ReplyToTargetError(client, iTargetCount);
return Plugin_Handled; return Plugin_Handled;

View File

@ -1,50 +0,0 @@
"Games"
{
"#default"
{
"#supported"
{
"game" "cstrike"
"game" "tf"
"game" "dod"
"game" "hl2mp"
"engine" "sdk2013"
}
"Offsets"
{
"AcceptInput"
{
"windows" "36"
"linux" "37"
"mac" "37"
}
}
}
"csgo"
{
"Offsets"
{
"AcceptInput"
{
"windows" "40"
"linux" "41"
"mac" "41"
}
}
}
"left4dead2"
{
"Offsets"
{
"AcceptInput"
{
"windows" "43"
"linux" "44"
"mac" "44"
}
}
}
}

View File

@ -27,10 +27,11 @@ public OnPluginStart()
HookEntityOutput("game_ui", "PlayerOff", GameUI_PlayerOff); HookEntityOutput("game_ui", "PlayerOff", GameUI_PlayerOff);
// Gamedata. // Gamedata.
new Handle:hConfig = LoadGameConfigFile("FixGameUI.games"); Handle hConfig = LoadGameConfigFile("sdktools.games");
if (hConfig == INVALID_HANDLE) if (hConfig == INVALID_HANDLE)
{ {
SetFailState("Could not find gamedata file: FixGameUI.games.txt"); SetFailState("Couldn't load sdktools game config!");
return;
} }
new offset = GameConfGetOffset(hConfig, "AcceptInput"); new offset = GameConfGetOffset(hConfig, "AcceptInput");

View File

@ -233,10 +233,8 @@ public MRESReturn AcceptInput(int pThis, Handle hReturn, Handle hParams)
{ {
// Should not happen? // Should not happen?
if(DHookIsNullParam(hParams, 2)) if(DHookIsNullParam(hParams, 2))
{
LogError("AcceptInput pActivator = NULL");
return MRES_Ignored; return MRES_Ignored;
}
int client = DHookGetParam(hParams, 2); int client = DHookGetParam(hParams, 2);
char szInputName[32]; char szInputName[32];

View File

@ -1,14 +0,0 @@
"Games"
{
"cstrike"
{
"Offsets"
{
"AcceptInput"
{
"windows" "36"
"linux" "37"
}
}
}
}

View File

@ -50,10 +50,10 @@ public Plugin myinfo =
public void OnPluginStart() public void OnPluginStart()
{ {
Handle hGameConf = LoadGameConfigFile("PointServerCommandFilter.games"); Handle hGameConf = LoadGameConfigFile("sdktools.games");
if(hGameConf == INVALID_HANDLE) if(hGameConf == INVALID_HANDLE)
{ {
SetFailState("Couldn't load PointServerCommandFilter.games game config!"); SetFailState("Couldn't load sdktools game config!");
return; return;
} }

View File

@ -4,6 +4,7 @@
#include <sourcemod> #include <sourcemod>
#include <sdktools> #include <sdktools>
#include <cstrike> #include <cstrike>
#include <zombiereloaded>
public Plugin myinfo = public Plugin myinfo =
{ {
@ -63,6 +64,25 @@ public Action Command_Spectate(int client, int argc)
return Plugin_Handled; return Plugin_Handled;
} }
if (IsPlayerAlive(client) && ZR_IsClientZombie(client))
{
bool bOnlyZombie = true;
for (int i = 1; i <= MaxClients; i++)
{
if (i != client && IsClientInGame(i) && IsPlayerAlive(i) && ZR_IsClientZombie(i))
{
bOnlyZombie = false;
break;
}
}
if (bOnlyZombie)
{
PrintToChat(client, "[SM] Can not switch to spectate as the last zombie!");
return Plugin_Handled;
}
}
if (!argc) if (!argc)
{ {
if (GetClientTeam(client) != CS_TEAM_SPECTATOR) if (GetClientTeam(client) != CS_TEAM_SPECTATOR)

View File

@ -3,6 +3,11 @@ import os
import sys import sys
import subprocess import subprocess
c_null = "\x1b[00;00m"
c_red = "\x1b[31;01m"
c_blue = "\x1b[34;01m"
c_green = "\x1b[32;01m"
SM_INCLUDES = "includes" SM_INCLUDES = "includes"
SPCOMP = "./spcomp" SPCOMP = "./spcomp"
@ -13,11 +18,10 @@ if __name__ == "__main__":
Plugins.append(Directory) Plugins.append(Directory)
for Plugin in Plugins: for Plugin in Plugins:
print("Compiling {0}".format(Plugin))
SourcePath = os.path.join(Plugin, "scripting") SourcePath = os.path.join(Plugin, "scripting")
Path, Directories, Files = next(os.walk(SourcePath)) Path, Directories, Files = next(os.walk(SourcePath))
for File in Files: for File in Files:
print('\n' + c_green + "# Compiling {0} ({1})".format(os.path.basename(File), Plugin) + c_null)
if File.endswith(".sp"): if File.endswith(".sp"):
SourcePath = os.path.join(Path, File) SourcePath = os.path.join(Path, File)
IncludePath = os.path.join(Path, "include") IncludePath = os.path.join(Path, "include")

View File

@ -38,6 +38,11 @@ methodmap Basic < StringMap
return view_as<Basic>(new StringMap()); return view_as<Basic>(new StringMap());
} }
public void Dispose(bool disposemembers=true)
{
delete this;
}
public int GetInt(const char[] membername, int defaultvalue=-1) public int GetInt(const char[] membername, int defaultvalue=-1)
{ {
int value; int value;