18.04.2016, 14:24
I made this command long time ago, i found it at the script that i once made so i pasted it to the script that i'm recently scripting.
The problem is when i /kick 0 (playerid) DM it sends me a message saying "SERVER: Unknown Command" And i really don't know why. But when i /kick 0 0(a number) It kicks me.
I tried /kick 1 0 even though my ID is 0, and i'm the only player at the server it just kicked me.
This is the code.
The problem is when i /kick 0 (playerid) DM it sends me a message saying "SERVER: Unknown Command" And i really don't know why. But when i /kick 0 0(a number) It kicks me.
I tried /kick 1 0 even though my ID is 0, and i'm the only player at the server it just kicked me.
This is the code.
PHP код:
CMD:kick(playerid, params[])
{
if(pInfo[playerid][pAdmin] <= 1)
return SendClientMessage(playerid, GREY, "You are not authorized to use that command.");
new
targetid,
reason,
str[128]
;
if(sscanf(params, "us", targetid, reason))
return SendClientMessage(playerid, GREY, "USAGE: /kick [playerid] [reason]");
if(!IsPlayerConnected(targetid))
return SendClientMessage(playerid, GREY, "Player is not connected");
new
pname[MAX_PLAYER_NAME],
tname[MAX_PLAYER_NAME]
;
GetPlayerName(playerid, pname, sizeof(pname));
GetPlayerName(targetid, tname, sizeof(tname));
format(str, sizeof(str), "You have been kicked by %s. REASON: %s", pname, reason);
SendClientMessage(targetid, LIGHTBLUE, str);
format(str, sizeof(str), "You have kicked %s REASON: %s.", tname, reason);
SendClientMessage(playerid, LIGHTBLUE, str);
SetTimerEx("KickPlayer", 100, false, "i", targetid);
return 1;
}
forward KickPlayer(targetid);
public KickPlayer(targetid)
{
Kick(targetid);
}