SA-MP Forums Archive
sscanf2 Example. - 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: sscanf2 Example. (/showthread.php?tid=514677)



sscanf2 Example. - rappy93 - 22.05.2014

Hey there. Is there anyone who can give me an example of I can use sscanf to do this instead of explode function ?

pawn Код:
stock AssignPlayerTickets(playerid, tickets[])
{
    new tmp[MAX_PLAYER_TICKETS][32];
    explode(tmp, tickets, "|");
    for(new i = 0; i < MAX_PLAYER_TICKETS; i ++)
    {
        PlayerInfo[playerid][pTickets][i] = strval(tmp[i]);
    }
}
I'm not that good with sscanf,I'm still learning how to make use of it.
Any help is much appreciated.


Re : sscanf2 Example. - S4t3K - 22.05.2014

PHP код:

new tmp[MAX_PLAYER_TICKETS][32], selse[sizeof(tickets)];
sscanf(tickets"s[MAX_PLAYER_TICKETS]p<|>s[sizeof(tickets)]"tmpselse); 
Before the delimiter, the string will be cut and stored in tmp, and after the delimiter, it will be stored in selse.


Re: sscanf2 Example. - rappy93 - 22.05.2014

I'll try it , thanks.