PlaytimeReward: Add reset for connection as well
This commit is contained in:
parent
4bf8eba860
commit
4c0b0f2ee0
@ -21,11 +21,13 @@ public void OnPluginStart()
|
|||||||
CreateTimer(30.0, Timer_CheckConnectionTime, _, TIMER_REPEAT);
|
CreateTimer(30.0, Timer_CheckConnectionTime, _, TIMER_REPEAT);
|
||||||
|
|
||||||
HookEvent("player_disconnect", EventHook_PlayerDisconnect, EventHookMode_Post);
|
HookEvent("player_disconnect", EventHook_PlayerDisconnect, EventHookMode_Post);
|
||||||
|
HookEvent("player_connect", EventHook_PlayerConnect, EventHookMode_Post);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPluginEnd()
|
public void OnPluginEnd()
|
||||||
{
|
{
|
||||||
UnhookEvent("player_disconnect", EventHook_PlayerDisconnect, EventHookMode_Post);
|
UnhookEvent("player_disconnect", EventHook_PlayerDisconnect, EventHookMode_Post);
|
||||||
|
UnhookEvent("player_connect", EventHook_PlayerConnect, EventHookMode_Post);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnMapStart()
|
public void OnMapStart()
|
||||||
@ -45,6 +47,18 @@ public void EventHook_PlayerDisconnect(Event hEvent, const char[] sName, bool bD
|
|||||||
g_iClientConnectionTime[client] = 0;
|
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)
|
public Action Timer_CheckConnectionTime(Handle hThis)
|
||||||
{
|
{
|
||||||
for (int i = 1; i <= MaxClients; i++)
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user