21.08.2011, 02:47
I made a custom /kick command, but everytime i use it..it kicks me instead of the targetid. Can someone point out the problem?
pawn Code:
COMMAND:kick(playerid, params[])
{
if(GetPlayerAdminLevel(playerid) <= 1) return SendClientMessage(playerid, COLOR_RED, "You are not authorized to use this command!");
{
new
targetid,
reason[128];
if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /kick (playerid | name) (reason)");
else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "That player is not connected!");
{
new
string[128];
format(string, sizeof(string), "Staff Member %s has kicked %s for %s", PlayerName(playerid), PlayerName(targetid), reason);
SendClientMessageToAll(COLOR_WHITE, string);
format(string, sizeof(string), "You have been kicked from this server | Reason: %s", reason);
SendClientMessage(targetid, COLOR_WHITE, string);
SendClientMessage(playerid, COLOR_WHITE, "You have kicked the player successfully.");
KickPlayer(targetid, PlayerName(playerid), reason);
}
}
return 1;
}