SA-MP Forums Archive
How to.. - 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: How to.. (/showthread.php?tid=549113)



How to.. - dundolina - 04.12.2014

How to make a payday to give me on every round hour to give me award and need to played 20 minutes in server?


Re: How to.. - AIped - 04.12.2014

you need to use a timer

search for function SetTimer or SetTimerEx


Re: How to.. - UltraScripter - 04.12.2014

On player connect

SetTimerEx("payday", 1200000, true, "i", playerid);

Creating public

forward payday(playerid);

public payday(playerid)
{
GivePlayerMoney(playerid, 500);
return 1;
}


Re: How to.. - dundolina - 04.12.2014

Код:
SetTimer("paytime", 3600000, 1);
This is my timer it is for only round hour or?


Re: How to.. - Raweresh - 04.12.2014

Yes, you can do something like that if you are not sure:
Код:
1000 * 60 * 60
In timer:
Код:
for(new A,B = GetMaxPlayers(); A < B; A++)
{
	if(IsPlayerConnected(A))
	{
		//Code for all players after every one hour.
	}
}



Re: How to.. - dundolina - 04.12.2014

So it's ok the timer? And this a,b for what it?


Re: How to.. - Raweresh - 04.12.2014

It's loop for all players. If you want for one player you need to use SetTimerEx. Same time but other parameters.
https://sampwiki.blast.hk/wiki/SetTimerEx


Re: How to.. - dundolina - 04.12.2014

Where to add it, i have 2 timers on ongamemodeinit and onfilterscriptinit..?


Re: How to.. - Raweresh - 04.12.2014

Код:
SetTimerEx("paytime",3600000,1,"i",playerid);
In OnPlayerConnect.
And that callback somewhere:
Код:
forward paytime(playerid);
public paytime(playerid)
{
	//Code for player every one hour.
}



Re: How to.. - dundolina - 04.12.2014

Yeah but the timers it's not work.. Dont give me money on round hour..