entWatch4: Move flWait code slightly, so it happens when usable.

This commit is contained in:
zaCade 2019-04-10 14:15:08 +02:00
parent a93390f72b
commit d09cd894dd

View File

@ -494,15 +494,6 @@ public Action OnButtonPress(int button, int client)
if ((item.bButton && item.iButton == button) && if ((item.bButton && item.iButton == button) &&
(item.bClient && item.iClient == client)) (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; Action aResult;
Call_StartForward(g_hFwd_OnClientItemCanActivate); Call_StartForward(g_hFwd_OnClientItemCanActivate);
Call_PushCell(client); Call_PushCell(client);
@ -513,6 +504,15 @@ public Action OnButtonPress(int button, int client)
{ {
case Plugin_Continue, Plugin_Changed: case Plugin_Continue, Plugin_Changed:
{ {
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;
}
switch(item.dConfig.iMode) switch(item.dConfig.iMode)
{ {
case MODE_COOLDOWN: case MODE_COOLDOWN: