CMD:kickall(playerid,params[]) { if (adlvl[playerid] < 6) return 0; new string[1000]; format(string,sizeof(string),""COLOR_BLUE"{FF0000}[SERVER]:{FFFFFF} Admin\"%s (%d)\" has kicked all players except admins",GetName(playerid),playerid); SendClientMessageToAll(-1,string); for(new i=0; i < MAX_PLAYERS; i++) { if (adlvl[playerid] < 5) { Kick(i); } } return 1; }
C:\Users\xavie\Desktop\Elite Gaming Server 0.3.7-R2\gamemodes\EliteGaming.pwn(23801) : error 001: expected token: "-string end-", but found "-identifier-" C:\Users\xavie\Desktop\Elite Gaming Server 0.3.7-R2\gamemodes\EliteGaming.pwn(23801) : warning 215: expression has no effect C:\Users\xavie\Desktop\Elite Gaming Server 0.3.7-R2\gamemodes\EliteGaming.pwn(23801) : error 001: expected token: ";", but found "-string-" C:\Users\xavie\Desktop\Elite Gaming Server 0.3.7-R2\gamemodes\EliteGaming.pwn(23801) : warning 215: expression has no effect C:\Users\xavie\Desktop\Elite Gaming Server 0.3.7-R2\gamemodes\EliteGaming.pwn(23801) : error 017: undefined symbol "GetName" C:\Users\xavie\Desktop\Elite Gaming Server 0.3.7-R2\gamemodes\EliteGaming.pwn(23801) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
CMD:kickall(playerid,params[])
{
if (adlvl[playerid] < 6) return 0;
new string[144], namr[MAX_PLAYER_NAME];
GetPlayerName(playerid, 24, namr);
format(string,sizeof(string),""COLOR_BLUE"{FF0000}[SERVER]:{FFFFFF} Admin %s (%d) has kicked all players except admins",namr,playerid);
SendClientMessageToAll(-1,string);
for(new i = 0; i < MAX_PLAYERS; i++)
if (adlvl[playerid] < 5)
Kick(i);
return 1;
}
stock GetName(playerid) { new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name)); return Name; } CMD:kickall(playerid,params[]) { new string[100]; if (adlvl[playerid] < 6) return 0; for(new i=0; i < MAX_PLAYERS; i++) { Kick(i); } format(string,sizeof(string),"{FF0000}[SERVER]:{FFFFFF} Admin\"%s (%d)\" has kicked all players except admins",GetName(playerid),playerid); SendClientMessageToAll(-1,string); return 1; }
Код:
stock GetName(playerid) { new Name[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name)); return Name; } CMD:kickall(playerid,params[]) { new string[100]; if (adlvl[playerid] < 6) return 0; for(new i=0; i < MAX_PLAYERS; i++) { if (adlvl[playerid] < 5) { Kick(i); } format(string,sizeof(string),"{FF0000}[SERVER]:{FFFFFF} Admin\"%s (%d)\" has kicked all players except admins",GetName(playerid),playerid); SendClientMessageToAll(-1,string); return 1; } |
stock GetName(playerid) { new Name[50]; GetPlayerName(playerid, Name, sizeof(Name)); return Name; }
for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(adlvl[i] < 5) { Kick(i); } } }
Also you should optimize the loop a bit otherwise you will face server lag or even crashes
|