SA-MP Forums Archive
Problem with PayCheck - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with PayCheck (/showthread.php?tid=244213)



Problem with PayCheck - bijoyekuza - 26.03.2011

this is my first time making paycheck
I want to make something simple
so I have this
forward PayCheck(playerid);

ongamemodinit
SetTimer("PayCheck",59000,1);

and the public
Код:
public PayCheck(playerid)
{
	new hour,seconds;
	new minutes = 00;
	if(gettime(hour,minutes,seconds))
	{
		if(PlayerInfo[playerid][pScore] == 1 ||PlayerInfo[playerid][pScore] == 2)
		{
			new score12[][6]
			{GivePlayerMoney(playerid,1337);}
			{GivePlayerMoney(playerid,2301);}
			{GivePlayerMoney(playerid,1591);}
			{GivePlayerMoney(playerid,2678);}
			{GivePlayerMoney(playerid,2671);}
			{GivePlayerMoney(playerid,1996);}
			PlayerInfo[playerid][pHours] = PlayerInfo[playerid][pHours] + 1;
		}
 		if(PlayerInfo[playerid][pScore] == 2 ||PlayerInfo[playerid][pScore] == 3)
		{
			new score23[][6]
			{GivePlayerMoney(playerid,2010);}
			{GivePlayerMoney(playerid,2150);}
			{GivePlayerMoney(playerid,3150);}
			{GivePlayerMoney(playerid,1999);}
			{GivePlayerMoney(playerid,2567);}
			{GivePlayerMoney(playerid,1996);}
			PlayerInfo[playerid][pHours] = PlayerInfo[playerid][pHours] + 1;
		}
 		if(PlayerInfo[playerid][pScore] == 4 ||PlayerInfo[playerid][pScore] == 5)
		{
			new score45[][6]
			{GivePlayerMoney(playerid,3500);}
			{GivePlayerMoney(playerid,3156);}
			{GivePlayerMoney(playerid,3955);}
			{GivePlayerMoney(playerid,312);}
			{GivePlayerMoney(playerid,2101);}
			{GivePlayerMoney(playerid,2995);}
			PlayerInfo[playerid][pHours] = PlayerInfo[playerid][pHours] + 1;
		}
 		if(PlayerInfo[playerid][pScore] == 6 ||PlayerInfo[playerid][pScore] == 7)
		{
			new score67[][6]
			{GivePlayerMoney(playerid,7156);}
			{GivePlayerMoney(playerid,9150);}
			{GivePlayerMoney(playerid,7555);}
			{GivePlayerMoney(playerid,4954);}
			{GivePlayerMoney(playerid,7595);}
			{GivePlayerMoney(playerid,7101);}
			PlayerInfo[playerid][pHours] = PlayerInfo[playerid][pHours] + 1;
		}
 		if(PlayerInfo[playerid][pScore] == 8||PlayerInfo[playerid][pScore] == 9)
		{
			new score89[][6]
			{GivePlayerMoney(playerid,20100);}
			{GivePlayerMoney(playerid,17126);}
			{GivePlayerMoney(playerid,15121);}
			{GivePlayerMoney(playerid,21122);}
			{GivePlayerMoney(playerid,19151);}
			{GivePlayerMoney(playerid,13123);}
			PlayerInfo[playerid][pHours] = PlayerInfo[playerid][pHours] + 1;

		}
	}
}
I dont know if it works or not ...
cuz I need to wait till XX:00 and check that ?


Re: Problem with PayCheck - antonio112 - 26.03.2011

I doubt it`ll work.

Try using like:

pawn Код:
forward PaydayTime();
public PaydayTime()
    new hh, mm, ss;
    gettime( hh, mm, ss );

    if( mm == 0 )
    {
           //blabla, your code here
And set a timer, once at minute, on gamemode init, like:

pawn Код:
SetTimer( "PaydayTime", 60000, true );
What does this do? It checks every minute, if the new 'minutes' is 00 ... which means, that only at :00 you`ll get paycheck. Don`t worry about few seconds delay.


Re: Problem with PayCheck - Medal Of Honor team - 26.03.2011

SetTimerEx( "PaydayTime", 60000, true, "d", playerid );


Re: Problem with PayCheck - antonio112 - 26.03.2011

Why would you use SetTimerEx in OnGameModeInit? the 'playerid' it`s not even defined ... Can`t use SetTimerEx.

Don`t know if my example works 100% ...