SA-MP Forums Archive
[Solved] Sscanf. - 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: [Solved] Sscanf. (/showthread.php?tid=121355)



[Solved] Sscanf. - CaHbKo - 16.01.2010

Hi,

I am trying to make a command to set house's description. How to make "sscanf" get the entered ID in "id" array, and the description(which contains spaces) in "desc[128]" array.
I heard that the "z" format character is used here, but I'm not sure how to use it.

Thanks.


Re: [Help] Sscanf. - Calgon - 16.01.2010

pawn Код:
command(confiscate, playerid, params[])
{
    new id, item[128], string[128];
    if (sscanf(params, "uz", id, item))
    {
      SendClientMessage(playerid, WHITE, "Syntax: /confiscate [playerid] [item]");
      SendClientMessage(playerid, GREY, "Items: Pot, Cocaine, Materials, Weapons, Phone, WalkieTalkie");
    }
    else
    {
    }
    return 1;
}
Example.


Re: [Help] Sscanf. - CaHbKo - 16.01.2010

Quote:
Originally Posted by CalgonX
pawn Код:
command(confiscate, playerid, params[])
{
    new id, item[128], string[128];
    if (sscanf(params, "uz", id, item))
    {
      SendClientMessage(playerid, WHITE, "Syntax: /confiscate [playerid] [item]");
      SendClientMessage(playerid, GREY, "Items: Pot, Cocaine, Materials, Weapons, Phone, WalkieTalkie");
    }
    else
    {
    }
    return 1;
}
Example.
Works, many thanks. ;]