ItemSpawn: untested fix for the Kill messages

This commit is contained in:
neon 2018-08-28 15:07:58 +02:00
parent a9704e1bfb
commit 9d1c5539e7
3 changed files with 32 additions and 10 deletions

View File

@ -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:
//----------------------------------------------------------------------------------------------------

View File

@ -335,7 +335,7 @@ public void SpawnBalrog(float fOrigin[3])
SetEntityBBox(iHealth, view_as<float>({-124.0, -120.0, -188.2}), view_as<float>({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);
}

View File

@ -545,7 +545,7 @@ public void SpawnWhiteKnight(float fOrigin[3])
SetEntityBBox(iHealth, view_as<float>({-36.0, -52.0, 48.0}), view_as<float>({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);
}