21.02.2014, 20:29
Help me please. I tried to fix this many times, but when i kick the player it gives the text, add it to log and everything, but it doesn't kick him off the server.
Код:
if(strcmp(cmd, "/kick", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid/PartOfName] [reason]"); return 1; } giveplayerid = ReturnUser(tmp); if(IsPlayerNPC(giveplayerid)) return 1; if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 4) { if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[96]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid/PartOfName] [reason]"); return 1; } new logstring[256]; new year, month, day; getdate(year, month, day); if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin]) { format(logstring, sizeof(logstring), "{AA3333}AdmCmd{FFFF00}: %s was kicked, reason: Attempting to kick admin %s (%d-%d-%d).", sendername, giveplayer,month,day,year); KickLog(logstring); format(string, sizeof(string), "{AA3333}AdmCmd{FFFF00}: %s was kicked, reason: Attempting to kick a higher admin.", sendername); SendClientMessageToAll(COLOR_LIGHTRED, string); SetTimerEx("GettingKicked", 2000, false, "i", giveplayer); return 1; } format(logstring, sizeof(logstring), "{AA3333}AdmCmd{FFFF00}: %s was kicked by %s, reason: %s (%d-%d-%d).", giveplayer, sendername, (result),month,day,year); KickLog(logstring); format(string, sizeof(string), "{AA3333}AdmCmd{FFFF00}: %s was kicked by %s, reason: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); SetTimerEx("GettingKicked", 2000, false, "i", giveplayer); return 1; } } else { format(string, sizeof(string), " %d is not an active player !", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } else { SendClientMessage(playerid, COLOR_GRAD2, " You are not authorized to use that command !"); } } return 1; }