SA-MP Forums Archive
split a date using 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)
+--- Thread: split a date using sscanf (/showthread.php?tid=595090)



split a date using sscanf - DetoNater - 28.11.2015

I want to split a date for example 2015-11-26 using sscanf , I did a code but not working

pawn Код:
CMD:tests(playerid,params[])
{
    new s[128];
    new date[3]; // date[0] = day       date[1] = month         date[2] = year
    if(sscanf(params,"p<.>iii",date[2],date[1],date[0]))
    {
    format(s,sizeof(s),"Test: %i %i %i ",date[2],date[1],date[0]);
    SendClientMessage(playerid,_COLOR_AQUA,s);
    }
    return 1;
}
wanna fix , thanks in advance .


Re: split a date using sscanf - fordawinzz - 28.11.2015

replace the sscanf line with this:
pawn Код:
if(!sscanf(params,"p<->iii",date[2],date[1],date[0]))



Re: split a date using sscanf - DetoNater - 28.11.2015

thank you so much its working