17.05.2014, 00:32
I've been doing a kick command but its strange that the sendclientmessagetoall is being processed AFTER the Kick(targetid). Anyone how to fix this?
Код:
CMD:kick(playerid, params[]) { if(!IsPlayerAdmin(playerid)) { new targetid; new reason[128]; new string[256]; new pName[MAX_PLAYER_NAME]; if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "That player isn't connected."); if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /kick [id] [reason]"); if(!sscanf(params, "us[128]", targetid, reason)) { GetPlayerName(targetid, pName, sizeof(pName)); format(string, sizeof(string), "Server Admin(-1) has kicked %s(%d) < > Reason: %s", pName, targetid, reason); SendClientMessageToAll(COLOR_YELLOW, string); Kick(targetid); } } else { SendClientMessage(playerid, COLOR_RED, "You are not an admin!"); } return 1; }