17.10.2012, 06:53
Try Use This
Код:
CMD:ban(playerid, params[]) { if (PlayerInfo[playerid][pAdmin] >= 2) { new string[128], giveplayerid, reason[64]; if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "[Usage]: /ban [playerid] [reason]"); giveplayerid = strval(params); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid == playerid) return SendClientMessage(playerid,COLOR_RED,"ERROR: You cant ban ur self"); if(PlayerInfo[giveplayerid][pAdmin] > PlayerInfo[playerid][pAdmin]) { format(string, sizeof(string), "AdmCmd: %s has been auto-banned by GOD, reason: Attempt to ban a higher Administrator.", GetPlayerNameEx(playerid)); ABroadCast(COLOR_LIGHTRED,string,2); PlayerInfo[playerid][pBanned] = 1; new ip[32]; GetPlayerIp(playerid,ip,sizeof(ip)); AddBan(ip); Kick(playerid); return 1; } else { new year, month,day; getdate(year, month, day); new playerip[32]; GetPlayerIp(giveplayerid, playerip, sizeof(playerip)); format(string, sizeof(string), "AdmCmd: %s(IP:%s) was banned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason,month,day,year); Log("logs/ban.log", string); format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason); SendClientMessageToAllEx(COLOR_LIGHTRED, string); PlayerInfo[giveplayerid][pBanned] = 1; format(PlayerInfo[giveplayerid][pFlag], 128, ""); new ip[32]; GetPlayerIp(giveplayerid,ip,sizeof(ip)); AddBan(ip); Kick(giveplayerid); return 1; } } } else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified."); return 1; }