08.04.2016, 14:42
Once again, i scripted a /kick command to kick a player but i don't know how to show the "targetid" who kicked him/her and what the reason is.
To those who are interested on helping me, please edit/add a line that shows the KICKED player who kicked him/her and what the reason is.
OR make this command more unique and understandable for a newbie like me.
To those who are interested on helping me, please edit/add a line that shows the KICKED player who kicked him/her and what the reason is.
OR make this command more unique and understandable for a newbie like me.
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[128],
str[128]
;
if(sscanf(params, "us[128]", 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(playerid, tname, sizeof(tname));
format(str, sizeof(str), "You have been kicked by %s.", tname, Reason);
SendClientMessage(targetid, RED, str);
format(str, sizeof(str), "You have kicked %s.", pname, Reason);
SendClientMessage(playerid, RED, str);
Kick(targetid);
return 1;
}