25.04.2009, 00:09
Use sscanf.
Makes it much easier and less code.
pawn Код:
dcmd_kick(playerid, params[])
{
new otherid, reason[128];
if(sscanf(params,"ds",otherid,reason))
{
SendClientMessage(playerid, COLOR_WHITE, "[USAGE] : /kick [playerid] [reason]");
return 1;
}
if(dini_Int(GetPlayerPath(playerid), "admin") < 3)
{
SendClientMessage(playerid, COLOR_WHITE, "You dont have permission to access this command!");
return 1;
}
if(!IsPlayerConnected(otherid))
{
SendClientMessage(playerid, COLOR_WHITE, "That player is not online!");
return 1;
}
new player[24],admin[24],string[128];
GetPlayerName(otherid, player, 24);
GetPlayerName(playerid, admin, 24);
format(string, 128, "Administrator %s kicked %s (Reason: %s)", admin, player, reason);
SendClientMessageToAll(COLOR_WHITE, string);
Kick(otherid);
return 1;
}

