entWatch4: Add internal button cooldown.

Using button while 'waiting' would otherwise cause the item to go on cooldown in entWatch, while not actually being successfully used in the map.
This commit is contained in:
zaCade
2019-04-09 14:15:34 +02:00
parent eb7022a6ae
commit 99399febad
2 changed files with 22 additions and 0 deletions
+9
View File
@@ -494,6 +494,15 @@ public Action OnButtonPress(int button, int client)
if ((item.bButton && item.iButton == button) &&
(item.bClient && item.iClient == client))
{
if (HasEntProp(button, Prop_Data, "m_flWait"))
{
if (item.iWaitTill < RoundToCeil(GetEngineTime()))
{
item.iWaitTill = RoundToCeil(GetEngineTime() + GetEntPropFloat(button, Prop_Data, "m_flWait"));
}
else return Plugin_Handled;
}
Action aResult;
Call_StartForward(g_hFwd_OnClientItemCanActivate);
Call_PushCell(client);