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



PayDay - Dainyzxz - 09.08.2007

hi, how i can do this PayDay to work ?
pawn Код:
public PayDay(playerid, cash)
{
GameTextForPlayer(playerid, "~w~Pay~y~Day ~n~ ~n~ ~b~700 $", 1000, 1);
GivePlayerMoney(playerid, 700);
SetTimer("IsPlayerLogged",10000,10000);
}



Re: PayDay - Antironix - 09.08.2007

just make a timer on ongamemodeinit.


Re: PayDay - Towlies - 09.08.2007

Alright there are many things wrong with this...For example you never use the cash param you simply give them 700 dollars. Also I don't see the point of setting timer for IsPlayerLogged.

Correct way to use it would be like this

pawn Код:
public PayDay(playerid, cash)
{
new string[256];
format(string, sizeof(string),"~w~Pay~y~Day ~n~ ~n~ ~b~%d $",cash);
GameTextForPlayer(playerid,string, 1000, 1);
GivePlayerMoney(playerid,cash);
}
The way to call it would be like this

PayDay(playerid,700);

That would give them 700 dollars or whatever amount you specify there and will display message and give money accordingly.


Re: PayDay - Antironix - 09.08.2007

ehm.. every hour a payday? Thats why i use a timer.


Re: PayDay - Towlies - 09.08.2007

Quote:
Originally Posted by Antironix
ehm.. every hour a payday? Thats why i use a timer.
Do you want only certain players to receive these paydays or just anyone in the server to receive the cash. Also do you just want the amount to be 700 dollars or changeable.


Re: PayDay - Antironix - 09.08.2007

hmm there's a point


Re: PayDay - Dainyzxz - 09.08.2007

i need all players get "payday" after 30min and after 30min get "payDay" and t.t..


Re: PayDay - Zero:VCK - 09.08.2007

so u would put it on a timer.


add
pawn Код:
SetTimerEx("PayDay", 1800000, 1, "i", playerid, cash);
to OnGameModeInit

and if that dont work make it

pawn Код:
SetTimerEx("PayDay", 1800000, 1, "i", playerid);



Re: PayDay - Towlies - 09.08.2007

Zero OnGameModeInit doesn't have a playerid. It runs on startup. That would not work.

Best way to do it is just call a normal SetTimer and have the function loop through all playerid's and give money accordingly.

Above main() or under #include lines..Usually up on top of script
pawn Код:
#define PayDay_Amount 700
Under OnGameModeInit
pawn Код:
SetTimer("PayDay", 3600000, 1);
The function
pawn Код:
public PayDay() {
new string[256];
for(new i=0; i<=MAX_PLAYERS; i++)
GivePlayerMoney(i,PayDay_Amount);
format(string, sizeof(string),"~w~Pay~y~Day ~n~ ~n~ ~b~%d $",PayDay_Amount);
GameTextForAll(string, 1000, 1);
}
That should do it. I also put PayDay_Amount into a define that way you can change it simple in that area. Its currently 700 but just change that to change payday amount.


Re: PayDay - Dainyzxz - 14.08.2007

Towlies thanks