Problem with giveplayerMoney to right person
#7

pawn Код:
new count = 0; //Amount of players online
new robamount;

for(new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i)) //Foreach is a better option
    {
        count++;
        robamount += ((GetPlayerMoney(i)) / count);
    }
}
GivePlayerMoney(playerid, robamount);
It's hard to explain how loops work in my point of view :P
So read this: https://sampwiki.blast.hk/wiki/Loops

Just remember, I'm not trying to have a go at you here because you got something wrong, I just want to explain it further, so the OP doesn't have to post about two problems in one thread, or make a new one out of it.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)