diff --git a/PlaytimeReward/scripting/PlaytimeReward.sp b/PlaytimeReward/scripting/PlaytimeReward.sp index 3537ce18..9251ef7d 100644 --- a/PlaytimeReward/scripting/PlaytimeReward.sp +++ b/PlaytimeReward/scripting/PlaytimeReward.sp @@ -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(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++)