zcmd optional integer help -
THE_KNOWN - 18.03.2011
Код:
CMD:jail(playerid,params[])
{
new c,id,p;
if(sscanf(params,"uI(1)[2]",p,id)) return SendClientMessage(playerid,red,"USAGE:/jail [playerid] [cell]");
if(c>0) c=id-1;
else c=0;
SetPlayerPos(p,cspwn[c][0],cspwn[c][1],cspwn[c][2]);
return 1;
}
thats the code i tried. well when i /jail 0 it still shows the SendClientMessage even though i made the cell optional. so help?
Re: zcmd optional integer help -
iggy1 - 18.03.2011
pawn Код:
if(sscanf(params,"uI(1)",p,id))//try that
EDIT: my bad didn't notice you did use 'c'
Re: zcmd optional integer help -
THE_KNOWN - 18.03.2011
i use c after i get the value of id.
theres a mistake in the if
its if(id>0) not if(c>0)....
and i did try ur method didnt work =(
Re: zcmd optional integer help -
ricardo178 - 18.03.2011
Why not a normal jail command? Normal jail command is for example:
pawn Код:
COMMAND:jail(playerid, params[])
{
new id;
if(IsPlayerConnected(id))
{
if(IsPlayerAdmin(playerid))
{
if(!sscanf(params, "u", id))
{
new string[64];
new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), "You have been jailed by %s.", name);
SendClientMessage(id, 0x0259EAAA, string);
format(string, sizeof(string), "You jailed %s .", PlayerName);
SendClientMessage(playerid, 0x0259EAAA, string);
SetPlayerPos(id, 264.6288,77.5742,1001.0391);
SetPlayerInterior(id, 3);
return 1;
}
else return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /jail [PlayerId/PartOfName]");
}
else return SendClientMessage(playerid, 0x0259EAAA, "You are not admin.");
}
else return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected.");
}
Re: zcmd optional integer help -
THE_KNOWN - 18.03.2011
Well i have mapped a custom jail with diff spawns and i want to use that. so i need c as a optional thing
Re: zcmd optional integer help -
THE_KNOWN - 18.03.2011
******, a little help with your sscanf func?
Re: zcmd optional integer help -
THE_KNOWN - 18.03.2011
okay doesnt work =(
new code :
Код:
CMD:jail(playerid,params[])
{
new c,id,p,t,s[128],n[32],j[32];
if(sscanf(params,"uiI(1)",p,t,id)) return SendClientMessage(playerid,red,"USAGE:/jail [playerid] [time] [cell]");
if(id>0) c=id-1;
else c=0;
SetPlayerPos(p,cspwn[c][0],cspwn[c][1],cspwn[c][2]);
SetTimerEx("jailedd",t*60000,false,"i",p);
GetPlayerName(playerid,n,32);
GetPlayerName(p,j,32);
format(s,128,"***%s has been jailed by officer %s.",j,n);
SendClientMessageToAll(COLOR_YELLOW,s);
jailed[playerid]=1;
return 1;
}
still Shows me the SendClientMessage if i leave the optional one blank