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



string - omer5198 - 23.09.2011

how can i disassemble a value? i mean... i have this:
new num;
how can i check if the first char is something?


Re: string - [HiC]TheKiller - 23.09.2011

pawn Код:
if(num[0] != 0)
Also, take a look at my tutorial https://sampforum.blast.hk/showthread.php?tid=284112


Re: string - omer5198 - 23.09.2011

but my num is without cells...


Re: string - [HiC]TheKiller - 23.09.2011

Quote:
Originally Posted by omer5198
Посмотреть сообщение
but my num is without cells...
Strings are multi-celled rather then single celled. You cannot have a string without multiple cells, each character has a cell, read the tutorial. If you have a number and you want to find the first number. Convert it like this

pawn Код:
new num = 954398085904, string[25];
format(string, 25, "%d", num);
printf("%c", string[0]):
That will print 9.


Re: string - xDeadlyBoy - 23.09.2011

lol you came to ask here?
hint: you don't need to convert the value to string. you can check the digits of a number by using division and remainder.


Re: string - omer5198 - 23.09.2011

ok... DeadlyBoy... i just wanted to see why Ron's Answer was wrong...


Re: string - xDeadlyBoy - 23.09.2011

because when using char value as integer it returns the Unicode value.