PlaytimeReward: Hopefully make the reset work this time?
This commit is contained in:
parent
ec9d51c908
commit
21ad061055
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#pragma newdecls required
|
#pragma newdecls required
|
||||||
|
|
||||||
|
int g_iClientSteamAccountID[MAXPLAYERS + 1];
|
||||||
int g_iClientConnectionTime[MAXPLAYERS + 1];
|
int g_iClientConnectionTime[MAXPLAYERS + 1];
|
||||||
|
|
||||||
public Plugin myinfo =
|
public Plugin myinfo =
|
||||||
@ -18,38 +19,6 @@ public Plugin myinfo =
|
|||||||
public void OnPluginStart()
|
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_connect", EventHook_PlayerConnect, EventHookMode_Post);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnPluginEnd()
|
|
||||||
{
|
|
||||||
UnhookEvent("player_disconnect", EventHook_PlayerDisconnect, EventHookMode_Post);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EventHook_PlayerDisconnect(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 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)
|
||||||
@ -59,6 +28,14 @@ public Action Timer_CheckConnectionTime(Handle hThis)
|
|||||||
if (!IsValidClient(i))
|
if (!IsValidClient(i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
int iSteamAccountID = GetSteamAccountID(i);
|
||||||
|
|
||||||
|
if (g_iClientSteamAccountID[i] != iSteamAccountID)
|
||||||
|
{
|
||||||
|
g_iClientSteamAccountID[i] = iSteamAccountID;
|
||||||
|
g_iClientConnectionTime[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
g_iClientConnectionTime[i] += 30;
|
g_iClientConnectionTime[i] += 30;
|
||||||
|
|
||||||
for (int iTime = 1800; iTime <= 36000; iTime += 1800)
|
for (int iTime = 1800; iTime <= 36000; iTime += 1800)
|
||||||
|
Loading…
Reference in New Issue
Block a user