Payday system?
#1

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);
}
?
Reply
#2

Mmmh ya...

But use

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

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?
Reply
#4

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.
Reply
#5

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);
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)