diff --git a/ItemSpawn/scripting/ItemSpawn.sp b/ItemSpawn/scripting/ItemSpawn.sp index 238ea456..d621bdcf 100644 --- a/ItemSpawn/scripting/ItemSpawn.sp +++ b/ItemSpawn/scripting/ItemSpawn.sp @@ -39,7 +39,7 @@ public Plugin myinfo = public void OnPluginStart() { HookEvent("round_start", OnRoundStart, EventHookMode_Post); - + RegAdminCmd("sm_balrog", Command_Balrog, ADMFLAG_KICK); RegAdminCmd("sm_humandog", Command_HumanDog, ADMFLAG_KICK); RegAdminCmd("sm_earth", Command_Earth, ADMFLAG_KICK); @@ -49,7 +49,7 @@ public void OnPluginStart() RegAdminCmd("sm_whiteknight", Command_WhiteKnight, ADMFLAG_KICK); LoadTranslations("common.phrases"); - + Handle hGameConf = LoadGameConfigFile("plugin.entWatch"); if(hGameConf == INVALID_HANDLE) { @@ -172,8 +172,8 @@ public void OnMapStart() AddFileToDownloadsTable("models/poo/curlygpoo.sw.vtx"); AddFileToDownloadsTable("models/poo/curlygpoo.vvd"); AddFileToDownloadsTable("materials/models/poo/curlypoo.vmt"); - AddFileToDownloadsTable("materials/models/poo/curlypoo.vtf"); - + AddFileToDownloadsTable("materials/models/poo/curlypoo.vtf"); + // Earth Staff PrecacheModel("models/staff/staff.mdl"); AddFileToDownloadsTable("models/staff/staff.dx80.vtx"); @@ -184,7 +184,7 @@ public void OnMapStart() AddFileToDownloadsTable("models/staff/staff.vvd"); AddFileToDownloadsTable("materials/models/Staff/staffofmagnus.vmt"); AddFileToDownloadsTable("materials/models/Staff/staffofmagnus.vtf"); - + // Earth Prop PrecacheModel("models/ffxii/earthmodel1.mdl"); AddFileToDownloadsTable("models/ffxii/earthmodel1.dx80.vtx"); @@ -194,7 +194,7 @@ public void OnMapStart() AddFileToDownloadsTable("models/ffxii/earthmodel1.sw.vtx"); AddFileToDownloadsTable("models/ffxii/earthmodel1.vvd"); AddFileToDownloadsTable("materials/models/ffxii/earthmodel1/rockwall01.vmt"); - + // TNT PrecacheModel("models/props/furnitures/humans/barrel01b.mdl"); AddFileToDownloadsTable("models/props/furnitures/humans/barrel01b.dx80.vtx"); @@ -303,6 +303,26 @@ public Action EquipWeapons(Handle timer, any userid) } } +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public bool IsValidClient(int client) +{ + if (client <= 0) + return false; + + if (client > GetMaxClients()) + return false; + + if (!IsClientInGame(client)) + return false; + + if (!IsClientAuthorized(client)) + return false; + + return true; +} + //---------------------------------------------------------------------------------------------------- // Purpose: //---------------------------------------------------------------------------------------------------- diff --git a/ItemSpawn/scripting/items/balrog.inc b/ItemSpawn/scripting/items/balrog.inc index a026be70..9856beda 100644 --- a/ItemSpawn/scripting/items/balrog.inc +++ b/ItemSpawn/scripting/items/balrog.inc @@ -335,7 +335,7 @@ public void SpawnBalrog(float fOrigin[3]) SetEntityBBox(iHealth, view_as({-124.0, -120.0, -188.2}), view_as({124.0, 120.0, 188.2})); SetEntityProps(iHealth); -// HookSingleEntityOutput(iHealth, "OnBreak", BalrogKill, true); + HookSingleEntityOutput(iHealth, "OnBreak", BalrogKill, true); // game_ui. int iControls = CreateEntityAtOrigin("game_ui", fOrigin); @@ -366,5 +366,6 @@ public void BalrogPickup(const char[] output, int caller, int activator, float d //---------------------------------------------------------------------------------------------------- public void BalrogKill(const char[] output, int caller, int activator, float delay) { - ServerCommand("say ** %N has killed the Balrog **", activator); + if (IsValidClient(activator)) + ServerCommand("say ** %N has killed the Balrog **", activator); } \ No newline at end of file diff --git a/ItemSpawn/scripting/items/whiteknight.inc b/ItemSpawn/scripting/items/whiteknight.inc index 2d4a5b2b..79037645 100644 --- a/ItemSpawn/scripting/items/whiteknight.inc +++ b/ItemSpawn/scripting/items/whiteknight.inc @@ -545,7 +545,7 @@ public void SpawnWhiteKnight(float fOrigin[3]) SetEntityBBox(iHealth, view_as({-36.0, -52.0, 48.0}), view_as({36.0, 52.0, 160.0})); SetEntityProps(iHealth); -// HookSingleEntityOutput(iHealth, "OnBreak", WhiteKnightKill, true); + HookSingleEntityOutput(iHealth, "OnBreak", WhiteKnightKill, true); // game_ui. int iControls = CreateEntityAtOrigin("game_ui", fOrigin); @@ -584,5 +584,6 @@ public void WhiteKnightPickup(const char[] output, int caller, int activator, fl //---------------------------------------------------------------------------------------------------- public void WhiteKnightKill(const char[] output, int caller, int activator, float delay) { - ServerCommand("say ** %N has killed the White Knight **", activator); + if (IsValidClient(activator)) + ServerCommand("say ** %N has killed the White Knight **", activator); } \ No newline at end of file