SA-MP Forums Archive
Give Level All! - 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: Give Level All! (/showthread.php?tid=592415)



Give Level All! - norton2 - 24.10.2015

The command does not work properly!
Код HTML:
CMD:givelevelall(playerid, params[])
{
    if(pInfo[playerid][pAdmin] < 6) return 1;
    for(new i = GetPlayerPoolSize(); i != -1; --i)
    {
        pInfo[i][pScore] += 1; VPUpdate(i, pScoreu);
        SetPlayerScore(i, pInfo[playerid][pScore]);
    }
    return 1;
}
Each player must receive one level. But it gets extra level 3-4.
On the server are around 60-70 players.


Re: Give Level All! - fuckingcruse - 24.10.2015

Don't write SetPlayerScore again
Код:
CMD:givelevelall(playerid, params[])
{
    if(!pInfo[playerid][pAdmin] < 6) return 0;
    for(new i = GetPlayerPoolSize(); i != -1; --i)
    {
        pInfo[i][pScore] += 1; VPUpdate(i, pScoreu);

    }
    return 1;
}



Re: Give Level All! - norton2 - 24.10.2015

And then I set myself how are players score?


Re: Give Level All! - LovelySoomro - 24.10.2015

CMD:givelevelall(playerid, params[])
{
if(pInfo[playerid][pAdmin] < 6)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
pInfo[i][pScore] += 1; VPUpdate(i, pScoreu);
SetPlayerScore(i, pInfo[playerid][pScore]);
}
}
return 1;
}


try this


Re: Give Level All! - PrO.GameR - 24.10.2015

SetPlayerScore(i, pInfo[playerid][pScore]);
^^^ You are setting player 'i' 's score
to the one that used the cmd, as simple as that :P have fun.