Payday system error
#1

Hey guys, I made a "cheap" payday system for my server but I got a small problem. When It gives the payday it doesn't gives me only 1 exp point it gives me like 37 xD. Yeah I can see the "Payday: You aquired 1 exp point" message but is sent like 37/38 times. How can I make it to send only one time?

Placed under my SaveDataTimer (saves all the stats at every sec [less lag than OnPlayerUpdate])
pawn Код:
gettime(hour,minute);
if(minute == 0)
{
     SetTimerEx("payday", 1, false, "i", playerid);
}
This is not placed under SaveDataTimer
pawn Код:
public payday(playerid)
{
    PlayerInfo[playerid][pExp]++;
    SendClientMessageToAll(-1, "-------------PAYDAY-------------");
    SendClientMessageToAll(-1, "Ai primit 1 punct de experienta.");
}
Reply
#2

This should do it i think. What you needed was a loop to go through all the players and then update each one individually.

pawn Код:
forward public payday();
public payday()
{

    for(new i=0; i<MAX_PLAYERS; i++)
    {
       
        if(IsPlayerConnected(i))
        {
            PlayerInfo[i][pExp]++;
            SendClientMessage(i, -1, "-------------PAYDAY-------------");
            SendClientMessage(i, -1, "Ai primit 1 punct de experienta.");
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)