SA-MP Forums Archive
SSCANF Problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SSCANF Problem (/showthread.php?tid=154156)



SSCANF Problem - Jonni8 - 12.06.2010

Hey.

I have a question:

Can i out Either a string or an id into an array using sscanf?

like:
pawn Код:
if (sscanf(params, "s||u", params[0]))
i can't figureout how i do this

BTW:
I need it for a /goto command either to teleport to a person or to a certain place.


Re: SSCANF Problem - LarzI - 12.06.2010

In what case do you want this?
If you want it for playername/ID, use 'u'.


Re: SSCANF Problem - Jonni8 - 12.06.2010

i want it for a place or for user-id.
so:
if i type /goto bsn i will be teleported to bsn
if i type in /goto 1 i go to id 1.

But how?


Re: SSCANF Problem - MadeMan - 12.06.2010

Try this:

pawn Код:
new userid, place[32];
if(sscanf(params, "u", userid))
{
    if(sscanf(params, "s", place))
    {
        // Wrong syntax
    }
    else
    {
        // goto place
    }
}
else
{
    // goto player
}



Re: SSCANF Problem - Jonni8 - 12.06.2010

didnt work... doesnt matter.
i made a new command (/gotop)