Quote:
Originally Posted by fordawinzz
pawn Код:
//---------------------------------------------------------------<[Giveallevel]>----------------------------------------------------------------------// if(strcmp(cmd, "/givelevelall", true) == 0) { if(PlayerInfo[playerid][pAdmin] >= 6) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { PlayerInfo[i][pLevel] ++; format(string, sizeof(string), " Administrator %s gave up 1 level all players who are online",sendername); return SendClientMessageToAll(COLOR_LIGHTGREEN, string); } } } return 1; }
|
Do you know how to use loops at all? Your code will only affect ID 0 and if the return was removed it would spam the server with a ton of messages.
@ Poster
Use this:
pawn Код:
//---------------------------------------------------------------<[Giveallevel]>----------------------------------------------------------------------//
if(strcmp(cmd, "/givelevelall", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 6)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayerInfo[i][pLevel]++;
}
new string[128];
format(string, sizeof(string), " Administrator %s gave up 1 level all players who are online",sendername);
SendClientMessageToAll(COLOR_LIGHTGREEN, string);
}
return 1;
}
Just a note, it's better to not check for a connected player if you're doing something as simple as setting a variable.