Here you go:
pawn Код:
CMD:kick(playerid,params[]) {
if(PlayerInfo[playerid][LoggedIn] == 1) {
if(PlayerInfo[playerid][Level] >= 4) {
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(params)) return SendMessageToPlayer(playerid,COLOR_RED, "USAGE: /kick [playerid] [reason]");
new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
player1 = strval(tmp);
if (IsPlayerNPC(player1)) return SendClientMessage(playerid, -1, "Sir you can not ban bot (>‘o’)>.");
new playname[MAX_PLAYER_NAME];
GetPlayerName(playerid, playname, sizeof(playname));
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
CMDMessageToAdmins(playerid,"KICK");
if(isnull(tmp2)) {
format(string,sizeof(string),"%s has been kicked by Administrator %s [no reason given] ",playername,adminname); SendMessageToAll(COLOR_BRIGHTRED,string);
SaveToFile("KickLog",string); print(string);
return Kick(player1);
} else {
format(string,sizeof(string),"%s has been kicked by Administrator %s [reason: %s] ",playername,adminname,params[2]); SendMessageToAll(COLOR_BRIGHTRED,string);
SaveToFile("KickLog",string); print(string);
return Kick(player1);}
} else return SendMessageToPlayer(playerid,COLOR_RED, "Player is not connected or is yourself or is the highest level admin");
} else return SendMessageToPlayer(playerid, -1, "Error");
} else return SendMessageToPlayer(playerid,COLOR_RED,"ERROR: You must be logged in to use this commands");}
Your code is very messy... Try to indent it the right way, and work a little more, "Indenting" in the future..
makes it alot easier to add easy/small things