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



Payday system? - Luis- - 24.10.2010

Is this the correct format for a Payday system?
pawn Код:
forward payday(playerid);
public payday(playerid)
{
    print("Payday has arrvied");
    SendClientMessage(playerid, COLOR_ADMIN, "P_______A_______Y_______D_______A_______Y");
    SendClientMessage(playerid, COLOR_ADMIN, "$500 Has been added to your bank account");
    GivePlayerMoney(playerid, 500);
}
?


Re: Payday system? - Bogdanovic - 24.10.2010

Mmmh ya...

But use

forward PayDay();
public PayDay {
for(new i=0;i<MAX_PLAYERS;i++)
{
//YOUR CODE
}
}


Re: Payday system? - admantis - 24.10.2010

Quote:
Originally Posted by Bogdanovic
Посмотреть сообщение
Mmmh ya...

But use

forward PayDay();
public PayDay {
for(new i=0;i<MAX_PLAYERS;i++)
{
//YOUR CODE
}
}
can you explain me the difference?


Re: Payday system? - WillyP - 24.10.2010

Quote:
Originally Posted by admantis
Посмотреть сообщение
can you explain me the difference?
The code will make a loop through everyone who is connected on the server. In this case; giving everyone a payday.


Re: Payday system? - Lenny the Cup - 24.10.2010

Just call this function when you want a payday:
pawn Код:
PayDay()
{
    print("Payday has arrvied");
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerOnline(i))
            continue;
        SendClientMessage(i, COLOR_ADMIN, "P_______A_______Y_______D_______A_______Y");
        SendClientMessage(i, COLOR_ADMIN, "$500 Has been added to your bank account");
        GivePlayerMoney(i, 500);
    }
}