[Solved] Sscanf.
#1

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.
Reply
#2

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.
Reply
#3

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. ;]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)