forward Game(playerid);// at the top
new gamet[MAX_PLAYERS];// at the top
new playing[MAX_PLAYERS];// at the top
new minute[MAX_PLAYERS];// at the top
public OnPlayerConnect(playerid)
{
new HH, MM, SS;
gettime(HH, MM, SS);
minute[playerid]= MM;
LoadPlayerData(playerid); // This sets playing[playerid] = 1;
gamet[playerid]=SetTimerEx("Game",60*1000,true,"i",playerid);
return 1;
}
public OnPlayerDisconnect(playerid,reason)
{
playing[playerid] = 0;
KillTimer(gamet[playerid]);
KillTimer(gamet[playerid]);
KillTimer(gamet[playerid]);
return 1;
}
public Game(playerid)
{
new HR,MNT,SC;
gettime(HR,MNT,SC);
if(MNT==minute[playerid]){return 1;}
playerid[minute]=MNT;
if(!IsPlayerConnected(playerid)){KillTimer(gamet[playerid]); printf("[ID %i] Game Offline [1]",playerid);
return 1;}
if(playing[playerid] != 1){KillTimer(gamet[playerid]); printf("[ID %i] Game Offline [2]",playerid); return 1;}
print("Game");
// Stuff happens here if online
return 1;
}
[01:22:57] [ID 101] Game Offline [1] [01:22:58] Game [01:22:59] [kill] Marius_Leonavicius killed Paulius_Typeris M4 [01:22:59] Game [01:23:00] [ID 61] Game Offline [1] [01:23:00] [COMM] Simis_Ofenas: /zvejoti [01:23:01] OnPlayerEnterCheckpoint [01:23:01] [ID 75] Game Offline [1] [01:23:01] Game [01:23:01] [chat] [Paulius_Ratkevicius]: kviesk [01:23:02] [chat] [Dziugas_Dogital]: dw pakviecam ? [01:23:02] [ID 53] Game Offline [1] [01:23:03] [ID 85] Game Offline [1] [01:23:03] OnPlayerSpawn [01:23:03] [ID 113] Game Offline [1] [01:23:04] Game [01:23:04] Game [01:23:04] [ID 94] Game Offline [1] [01:23:04] Game [01:23:05] [ID 97] Game Offline [1] [01:23:05] [ID 67] Game Offline [1] [01:23:05] [ID 45] Game Offline [1] [01:23:06] OnPlayerEnterCheckpoint [01:23:06] [ID 56] Game Offline [1] [01:23:06] [ID 27] Game Offline [1] [01:23:06] [ID 92] Game Offline [1] [01:23:07] [COMM] Laurynas_Santos: /sms ovis baikit tas nesamones [01:23:07] [ID 18] Game Offline [1] [01:23:07] [ID 89] Game Offline [1] [01:23:08] [chat] [Paulius_Ratkevicius]: davai'D [01:23:08] [ID 69] Game Offline [1] [01:23:08] Crash [01:23:08] [part] Povilas_Trol has left the server (0:0) [01:23:08] [ID 17] Game Offline [1] [01:23:09] Game [01:23:09] [ID 109] Game Offline [1] [01:23:09] [ID 28] Game Offline [1] [01:23:10] Game [01:23:10] Game [01:23:10] [COMM] Dziugas_Dogital: /r reike taxsi [01:23:10] [ID 82] Game Offline [1] [01:23:10] OnPlayerEnterCheckpoint [01:23:10] Game [01:23:10] [ID 81] Game Offline [1] [01:23:11] [COMM] Simis_Ofenas: /zvejoti [01:23:11] [ID 11] Game Offline [1] [01:23:11] [ID 34] Game Offline [1] [01:23:11] Game [01:23:12] [ID 47] Game Offline [1] [01:23:12] [ID 93] Game Offline [1] |
I had a similar problem, easy fix:
Run a global timer and just loop players in that, plus it's way more efficient because you're just calling one function every interval. And don't forget to use IsPlayerConnected in your function, and definitely make sure you have edited your MAX_PLAYERS in a_samp.inc OR using foreach for loops. |