16.12.2013, 12:16
I want a FS which will give Score every 3-4 minutes ...
public OnGameModeInit()
{
SetTimer("Score", 180000,true);//1800000 = 3 minutes , true means the timer will repeat!
return 1;
}
forward Score();//here we are calling the callback of the timer !
public Score()//when the timer pass
{
for(new i = 0; i < MAX_PLAYERS; i++)//loop through all players are connected
{
if(!IsPlayerConnected(i)) continue;//check the connect players
SetPlayerScore(i,GetPlayerScore(playerid)+1);//that line will set score for all players +1 you can change that!
}
}
#include <a_samp> new ScoreFunc[MAX_PLAYERS]; forward ScoreTimer[playerid]; public OnPlayerConnect(playerid) { ScoreFunc[playerid] = SetTimer("ScoreTimer",2,1); return 1; } public ScoreTimer(playerid) { SetPlayerScore(playerid, GetPlayerScore(playerid) +6); KillTimer(ScoreFuc[playerid]); ScoreFunc[playerid] = SetTimer("ScoreTimer",2,1); return 1; }