SSCANF Question - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SSCANF Question (
/showthread.php?tid=436045)
SSCANF Question -
PaulDinam - 09.05.2013
How do I made like a CMD for example, and when I type ID it will show to someone else the drugs, and when I don't type ID it will show the drugs to me.
pawn Код:
CMD:mydrugs(playerid, params[])
{
new id;
if(!sscanf(params,"U(-1)#playerid", id))
{
ShowPlayerDrugs(playerid, id);
}
return 1;
}
It isn't working
Re: SSCANF Question -
Babul - 09.05.2013
try
pawn Код:
if(!sscanf(params,"U("#playerid")", id))
Re: SSCANF Question -
Vince - 09.05.2013
I might be wrong, but I think that will just insert the literal string "playerid" rather than formatting the actual number. So, you can either format the format (
) before passing it to sscanf. Or you can check if the playerid is -1 after sscanf is done processing.
Re: SSCANF Question -
Knappen - 09.05.2013
pawn Код:
CMD:mydrugs(playerid, params[])
{
new id;
if(isnull(params))
{
ShowPlayerDrugs(playerid, playerid) // like this perhaps?
}
else
{
if(!sscanf(params,"u", id))
{
if(id != INVALID_PLAYER_ID) ShowPlayerDrugs(playerid, id);
}
}
return 1;
}
Not sure I understood what you meant, but this could be one way I guess?
Re: SSCANF Question -
PaulDinam - 10.05.2013
Yes, thank you man.