28.12.2009, 11:10
Here is a command to kick a player.
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256], idx; cmd = strtok(cmdtext, idx); if(strcmp("/kick", cmd, true) == 0) { if(AdminLevel[playerid] < 1) return 0; new tmp[256]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_PDRIVER, "[ ! ] USAGE : /kick <ID du joueur>"); if(!isNumeric(tmp)) return SendClientMessage(playerid, COLOR_RED, "[ ! ] ID du joueur invalide !"); new otherid = strval(tmp); if(!IsPlayerConnected(otherid)) return SendClientMessage(playerid, COLOR_RED, "[ ! ] Ce joueur n'est pas connectй !"); if(otherid == playerid) return SendClientMessage(playerid, COLOR_RED, "[ ! ] Vous ne pouvez pas vous kicker vous mкme !"); if(AdminLevel[otherid] - AdminLevel[playerid] >= 0) return SendClientMessage(playerid, COLOR_RED, "[ ! ] Vous n'avez pas le droit de kicker ce joueur !"); new AdminName[MAX_PLAYER_NAME], KickedName[MAX_PLAYER_NAME]; GetPlayerName(playerid, AdminName, sizeof(AdminName)); GetPlayerName(otherid, KickedName, sizeof(KickedName)); new string[256]; format(string, 256,"[ ! ] %s a йtй kickй par %s !", KickedName,AdminName); TogglePlayerControllable(otherid,0); SendClientMessageToAll( 0xff6348ff, string); SendClientMessage(otherid,0xff6348ff, "[ ! ] Vous кtes kickй pour ( VOUS ETES KICKЙ DU SERVEUR !!! )"); new Float: x, Float: y, Float: z; GetPlayerPos(otherid,x,y,z); SetPlayerPos(otherid,x,y,z); Kick(otherid); return 1; } return 0; }