03.11.2011, 14:54
I'm quite new to dcmd and sscanf so I need some help with kick, the problem is I dont know the proper operators (or whatever the official name) to use in string to show player names and id's
pawn Код:
dcmd_kick(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1) return SendClientMessage(playerid,COLOR_RED, "You must be administrator level 1 to use that command!");
new id, pname[MAX_PLAYER_NAME], reason[64], string[128];
GetPlayerName(playerid, pname, sizeof(pname));
if (sscanf(params, "pname", id, reason)) return SendClientMessage(playerid,COLOR_RED, "Usage: /kick [playerid/partofname] [reason]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_GREY, "Player not connected!");
format(string, sizeof(string), "You have been kicked! Reason: %s", reason);
SendClientMessage(id,COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s(%d) has been kicked by %s(%d) for: %s",pname,id,reason); // <--These
SendClientMessageToAll(COLOR_RED,string);
Kick(id);
return 0;
}