05.06.2015, 11:02
Quote:
These two functions are for you to use when you want to ban someone.
It may be a command: pawn Код:
pawn Код:
|
Код:
CMD:kick(playerid, params[]) { new id, reason[128]; if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!"); else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_WHITE, "Usage: /kick [id/name][reason]"); else if(id==playerid)SendClientMessage(playerid,COLOR_WHITE,"Error: You can not kick yourself!"); else if(IsPlayerAdmin(id))SendClientMessage(playerid,COLOR_WHITE,"Error: You can not kick another admin!"); else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!"); else { new Name[MAX_PLAYER_NAME], KickMessage[128]; new Name2[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name, sizeof(Name)); GetPlayerName(id, Name2, sizeof(Name2)); format(KickMessage, sizeof(KickMessage), "%s(%d) has kicked player %s(%d). Reason: %s", Name, playerid, Name2, id); SendClientMessageToAll(COLOR_WHITE, KickMessage); Kick(id); } return 1; } CMD:ban(playerid, params[]) { new id, reason[128]; if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!"); else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_WHITE, "Usage: /ban [id/name][reason]"); else if(id==playerid)SendClientMessage(playerid,COLOR_WHITE,"Error: You can not ban yourself!"); else if(IsPlayerAdmin(id))SendClientMessage(playerid,COLOR_WHITE,"Error: You can not ban another admin!"); else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!"); else { new Name3[MAX_PLAYER_NAME], BanMessage[128]; new Name4[MAX_PLAYER_NAME]; GetPlayerName(playerid, Name3, sizeof(Name3)); GetPlayerName(id, Name4, sizeof(Name4)); format(BanMessage, sizeof(BanMessage), "%s(%d) has Banned player %s(%d). Reason: %s", Name3, playerid, Name4, id); SendClientMessageToAll(COLOR_WHITE, BanMessage); Ban(id); } return 1; }