SA-MP Forums Archive
Payday system error - 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 error (/showthread.php?tid=460330)



Payday system error - ZeroTheScyther - 28.08.2013

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.");
}



Re: Payday system error - EiresJason - 28.08.2013

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