15.12.2011, 14:19
as realcop228 stated above i would definetely use zcmd so let me show you a cage command using zcmd and sscanf:
hope i helped
pawn Code:
CMD:cage(playerid,params[])
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1,"ERROR:You are not Rcon Administrator to use this command!");
else
{
new pid,pname[MAX_PLAYERS],string[128],reason[50];
GetPlayerName(playerid,pname,sizeof(pname));
if(sscanf(params,"rs[50]",pid,reason)) return SendClientMessage(playerid,-1,"SYNTAX ERROR:/cage [playerid] [reason]");
else if(!IsPlayerConnected(pid)||pid == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"ERROR:This player isn't connected");
else
{
format(string,sizeof(string),"ADMIN CAGE:%s has been caged-%s",pname,reason);
SendClientMessageToAll(-1,string);
CagePlayer(playerid);
}
}
return 1;