SA-MP Forums Archive
sscanf2 array of strings help. - 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 array of strings help. (/showthread.php?tid=531841)



sscanf2 array of strings help. - yanir3 - 14.08.2014

PHP код:
new var[MAX_PLAYERS][10][32];
new 
var2[MAX_PLAYERS][10];
public 
OnGameModeInit()
{
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    new 
var3[256];
    
format(var3256"None,None,None,None,None,None,None,None,None,None,3,4,1,3,5,0,0,4,6,0");
    
sscanf(var3"p<,>a<s[4]>[10]a<i>[10]", var[0], var2[0]);
    for(new 
=i<10;i++)
        
printf("var %d = %s, %d"i, var[0][i], var2[0][i]);
    return 
1;

The code above would not insert the strings into the array, it will just remain empty. But if I replace the sscanf to
PHP код:
p<,>a<s[600]>[10]a<i>[10
It would work with the 600 as expected length of string.
Can somebody explain it to me?


Re: sscanf2 array of strings help. - yanir3 - 15.08.2014

Quote:
Originally Posted by ******
Посмотреть сообщение
"None" is 4 characters, but you forgot the NULL.
Actually I tried even 10 as string length, did not work.