SA-MP Forums Archive
SetTimer score - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SetTimer score (/showthread.php?tid=418878)



SetTimer score - Ell3n - 26.02.2013

Hey im trying to make a SetTimer

I want it to give a person 12score each 5 mins

But the problem i have, i have no idea where to place the SetTimer and the code.

Would love some help!


If someone could make a quick FS and show me on Pastebin i would be greatful.


Re: SetTimer score - LarzI - 26.02.2013

You would have to use SetTimerEx for player-specific timers, and you should start them at OnPlayerConnect for your purpose:

pawn Код:
SetTimerEx( "MyTimer", ( 5 * 60 * 1000 ), true, "i", playerid );
// 5 * 60 * 1000 = 5 minutes, i = integer, playerid is the chosen integer to use as parameter
pawn Код:
forward MyTimer(playerid); //here put the parameter - you may call it whatever you like, but make sure it matches the data you send( in this case: integer)
public MyTimer(playerid)
{
    SetPlayerScore( playerid, ( GetPlayerScore( playerid ) + 12 ));
    return true;
}
And there you have it.