26.05.2011, 21:23
Hey ive got problem ill want to make a ban command to ban only account....
this command makes ipban
i thought delete
but then i get error how i need to delete the ipban ? or it cant ?
this command makes ipban
Код:
if(strcmp(cmd, "/ban", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]"); return 1; } giveplayerid = ReturnUser(tmp); if (PlayerInfo[playerid][pAdmin] >= 3) { 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[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]"); return 1; } new year, month,day; getdate(year, month, day); format(string, sizeof(string), "[ADMIN]: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year); BanLog(string); AdminLog(string); format(string, sizeof(string), "[ADMIN]: %s was banned by %s, reason: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year); SendClientMessageToAll(COLOR_LIGHTRED, string); new ipaddress[16]; GetPlayerIp(giveplayerid,ipaddress,sizeof(ipaddress)); new BannedReason[126]; format(BannedReason, sizeof(BannedReason), "Banned. Reason: %s", (result)); Ban(giveplayerid); Kick(giveplayerid); return 1; } }//not connected } else { format(string, sizeof(string), " %d is not an active player.", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; }
Код:
new ipaddress[16]; GetPlayerIp(giveplayerid,ipaddress,sizeof(ipaddress));