SA-MP Forums Archive
Problem With Splitting Data - 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: Problem With Splitting Data (/showthread.php?tid=313560)



Problem With Splitting Data - liquid13 - 26.01.2012

-fixed-


Re: Problem With Splitting Data - Universal - 26.01.2012

1) Use sscanf: (Im not sure if my code will work, not tested it, but you should get the point)
pawn Код:
sscanf(data, "p<,>a<i>[8]", newArray); // the "p" is the delimter, and the "a" is the array which type is integer and the array size is 8
2) As long as there's no other symbols than numbers, use Int, otherwise use Varchar and if it has .0 use Float.


Re: Problem With Splitting Data - liquid13 - 26.01.2012

Thanks I'm trying now ...


Re: Problem With Splitting Data - liquid13 - 26.01.2012

sorry for flood but didnt work


Re: Problem With Splitting Data - Universal - 26.01.2012

Quote:
Originally Posted by liquid13
Посмотреть сообщение
sorry for flood but didnt work
What happened now? Any errors? Or just didnt work as it suppossed to?


Re: Problem With Splitting Data - liquid13 - 26.01.2012

-fixed-


Re: Problem With Splitting Data - MP2 - 26.01.2012

Where's the query?


Re: Problem With Splitting Data - Universal - 26.01.2012

Try this:
pawn Код:
new
    IDS[3000],
    ces[500];

sscanf(IDS, "p<,>a<i>[500]", ces);

new i = 0;

while(i < 500)
{
   printf("%d", ces[i]);
 
   i++;
}



Re: Problem With Splitting Data - liquid13 - 26.01.2012

-fixed-


Re: Problem With Splitting Data - Universal - 26.01.2012

Quote:
Originally Posted by liquid13
Посмотреть сообщение
yeah it worked thanks a lot. so can i try a thing like this :

pawn Код:
while(i < 500)
{
   if(ces[i]==theid)
{
//something
}
 
   i++;
}
if ces arrray has theid variable it 'll work right ?
Yes, it'll work:


pawn Код:
while(i < 500)
{
   if(ces[i] == 1234)
   {
         print("ces[%d] is 1234!!!", i);
    }
 
   i++;
}