PlaytimeReward: Fix attempt
just hook player_connect as well to reset the time
This commit is contained in:
parent
94bd0035f2
commit
0245b29cbc
@ -20,6 +20,7 @@ public void OnPluginStart()
|
||||
CreateTimer(30.0, Timer_CheckConnectionTime, _, TIMER_REPEAT);
|
||||
|
||||
HookEvent("player_disconnect", EventHook_PlayerDisconnect, EventHookMode_Post);
|
||||
HookEvent("player_connect", EventHook_PlayerConnect, EventHookMode_Post);
|
||||
}
|
||||
|
||||
public void OnPluginEnd()
|
||||
@ -39,6 +40,18 @@ public void EventHook_PlayerDisconnect(Event hEvent, const char[] sName, bool bD
|
||||
g_iClientConnectionTime[client] = 0;
|
||||
}
|
||||
|
||||
public void EventHook_PlayerConnect(Event hEvent, const char[] sName, bool bDontBroadcast)
|
||||
{
|
||||
bool bIsBot = view_as<bool>(hEvent.GetInt("bot"));
|
||||
|
||||
if (bIsBot)
|
||||
return;
|
||||
|
||||
int client = GetClientOfUserId(hEvent.GetInt("userid"));
|
||||
|
||||
g_iClientConnectionTime[client] = 0;
|
||||
}
|
||||
|
||||
public Action Timer_CheckConnectionTime(Handle hThis)
|
||||
{
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user