12.04.2011, 18:21
Код:
if(strcmp(cmd, "/ban", true) == 0) { new reason[256]; if (Admin[playerid] < 4 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED, "You are not an admin with the required level."); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, ORANGE, "USAGE: /ban [playerid] [reason]"); giveplayerid = ReturnUser(tmp); if(giveplayerid == INVALID_PLAYER_ID) { format(string, sizeof(string), "%s is not an active player.", tmp); SendClientMessage(playerid, RED, string); return 1; } GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; while ((idx < length) && ((idx - offset) < (sizeof(reason) - 1))) { reason[idx - offset] = cmdtext[idx]; idx++; } reason[idx - offset] = EOS; if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /ban [playerid] [reason]"); else { new sstring[256]; new ip[128]; new name[50]; GetPlayerName(giveplayerid,name,50); strins(name,"users/",0); dini_IntSet(name,"Banned",1); dini_Set(name,"BanReason",reason); SendClientMessage(giveplayerid, -1, "Go on our site for unban: {FF0000}http://cls.irc.su"); Kick(giveplayerid); format(string,sizeof(string),"*** BAN: %s has been banned by Admin %s (%s)",giveplayer,sendername,reason); printf(string); SendClientMessageToAll(COLOR_SYSTEM,string); TogglePlayerControllable(giveplayerid,0); BanLog(string); GetPlayerIp(giveplayerid,ip,128); format(sstring, sizeof(sstring),"Player's IP: %s",ip); SendClientMessageToAdmins(COLOR_SYSTEM,sstring,1); } return 1; }
although that's the /ban command ,there is Kick(giveplayerid);..
can the server crash due to this?
If I'll add Bangiveplayerid);when I ban someone,the whole IP Class is banned,or something like this