SA-MP Forums Archive
Need help with string functions - 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: Need help with string functions (/showthread.php?tid=618041)



Need help with string functions - Maheerali - 30.09.2016

PHP код:
new str[128] = "2.00000|55.33333|0|55|My Test";
new 
posX[10], posY[10], font[10], color[10], text[128];
/*Get first part(2.00000) to posX, second(55.33333) to posY, third(0) to font, fourth(55) to color and last(My Test) to text as a string */



Re: Need help with string functions - Konstantinos - 30.09.2016

Sscanf is the way. Documentation here: https://sampforum.blast.hk/showthread.php?tid=602923

pawn Код:
new str[128] = "2.00000|55.33333|0|55|My Test";
new Float: posX, Float: posY, font, color, text[128];
sscanf(str, "p<|>ffiis[128]", posX, posY, font, color, text);
printf("\nposX: %f\nposY: %f\nfont: %i\ncolor: %i\ntext: \"%s\"", posX, posY, font, color, text);



Re: Need help with string functions - Maheerali - 30.09.2016

Thnks