PayDay System - 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: PayDay System (
/showthread.php?tid=351165)
PayDay System -
L0calNet - 15.06.2012
Hello! I am Russian, so I apologize for my mistakes, I do not know very well English. Help please write a function call Public exactly %d:00 minutes. And then I had a little constipation.
Re: PayDay System -
[ABK]Antonio - 15.06.2012
Quote:
Originally Posted by L0calNet
Hello! I am Russian, so I apologize for my mistakes, I do not know very well English. Help please write a function call Public exactly %d:00 minutes. And then I had a little constipation.
|
What?
Ohh, I think I understand now, you want a function that get's called every hour exactly on the hour?
Re: PayDay System -
L0calNet - 15.06.2012
You know how it works PayDay?
I need to be evoked once per hour. But no matter how much a player is logged in
Re: PayDay System -
L0calNet - 15.06.2012
No, that function need me

Sorry
Re: PayDay System -
[NWA]Hannes - 15.06.2012
pawn Код:
//Anywhere in script but not in a callback
forward PayDay();
public PayDay()
{
new hour, minute;
gettime(hour, minute);
if(minute == 0)
{
//Payday code here
}
}
//GameModeInit
SetTimer("PayDay", 1000, true);
Re: PayDay System -
TheArcher - 15.06.2012
Quote:
Originally Posted by [NWA]Hannes
pawn Код:
//Anywhere in script but not in a callback forward PayDay(); public PayDay() { new hour, minute; gettime(hour, minute); if(minute == 0) { //Payday code here } }
//GameModeInit SetTimer("PayDay", 1000, true);
|
Example on " //PayDay code here " space
pawn Код:
forward PayDay();
public PayDay()
{
new hour, minute;
gettime(hour, minute);
if(minute == 0)
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i)) continue;
GivePlayerMoney(i, 5000);
}
}
}
That allows you to give to all player connected $5000
Re: PayDay System -
L0calNet - 16.06.2012
This is my PayDay Code:
PHP код:
public PayDay() {
new hour,
minutes,
second;
gettime(hour, minutes, second);
if(minutes == 0) {
for(new i = 0; i<MAX_PLAYERS; i++) {
new exp = playerVariable[i][aLevel]*4+4;
if(playerVariable[aExp] == exp) {
playerVariable[i][aLevel]++;
}
GivePlayerMoney(i, paycheck); // paycheck - Global Variable
}
}
}
Re: PayDay System -
L0calNet - 16.06.2012
Quote:
Originally Posted by TheArcher
Example on " //PayDay code here " space
pawn Код:
forward PayDay(); public PayDay() { new hour, minute; gettime(hour, minute); if(minute == 0) { for(new i = 0; i<MAX_PLAYERS; i++) { if(!IsPlayerConnected(i)) continue; GivePlayerMoney(i, 5000); } } }
That allows you to give to all player connected $5000
|
No! This code running all minute! Need check for seconds == 0
Re: PayDay System -
TheArcher - 16.06.2012
Quote:
Originally Posted by L0calNet
No! This code running all minute! Need check for seconds == 0
|
What i used "if" not "while". When the minute goes to 0 it does all the work not from 0 seconds to 59 seconds. LOL
Edit & Note: I didn't use the timer.
Edit2:
Quote:
Originally Posted by L0calNet
This is my PayDay Code:
PHP код:
public PayDay() {
new hour,
minutes,
second;
gettime(hour, minutes, second);
if(minutes == 0) {
for(new i = 0; i<MAX_PLAYERS; i++) {
new exp = playerVariable[i][aLevel]*4+4;
if(playerVariable[aExp] == exp) {
playerVariable[i][aLevel]++;
}
GivePlayerMoney(i, paycheck); // paycheck - Global Variable
}
}
}
|
Where did you take paycheck from? I think you copied that system from your GameMode.