10.11.2010, 11:24
Код:
if(strcmp(cmd, "/ban", true) == 0 || strcmp(cmd, "/ban", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "Use: /ban [User ID or Name user] [reason]"); SendClientMessage(playerid, COLOR_GRAD2, "If the user has a high level of 3+, take the F8 and post on forum his ban"); 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, "Use: /ban [User ID or Name user] [reason]"); SendClientMessage(playerid, COLOR_GRAD2, "If the user has a high level of 3+, take the F8 and post on forum his ban"); return 1; } if(PlayerInfo[giveplayerid][pAdmin]) return SendClientMessage(playerid, 0xFFFFFFFF, "You can not ban Admins!"); if(PlayerInfo[giveplayerid][pGameMaster]) return SendClientMessage(playerid, 0xFFFFFFFF, "You can not ban Gamemastere!"); new year, month,day; getdate(year, month, day); format(string, sizeof(string), "Asus: %s the ban %s from server! Reason: %s", giveplayer, sendername, (result),month,day,year); BanLog(string); format(string, sizeof(string), "Asus: %s the ban %s from server! Reason: %s", giveplayer, sendername, (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); SendClientMessage(giveplayerid,COLOR_RED, "If you think this is mistake, report Admin"); SendClientMessage(giveplayerid,COLOR_RED, "Set the request on the forum unban"); SendClientMessage(giveplayerid,COLOR_RED, "Do not despair, because you might not get unban"); SetPlayerPos(giveplayerid,264.6288,77.5742,1001.0391); SetPlayerInterior(giveplayerid, 6); PlayerInfo[giveplayerid][pJailTime] = 300; PlayerInfo[giveplayerid][pJailed] = 1; PlayerInfo[giveplayerid][pAdmin] = PlayerInfo[giveplayerid][pLevel]; PlayerInfo[giveplayerid][pLevel] = -999; Ban(giveplayerid); return 1; } }//not connected } else { format(string, sizeof(string), " %d not an active player.", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1;