Modulo in pawno? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Modulo in pawno? (
/showthread.php?tid=247001)
Modulo in pawno? -
iShnizeL - 07.04.2011
Its passible to use modulo(%) in pawno?
5500%1000 = 500. Thats what should happen.
But i made a stock and its not working :<
Here is the stock:
PHP код:
stock GetNum(num)
{
new num1[256],num2[256],num3[256],final[256];
if(num > 999 && num < 1000000) {
format(num1,sizeof(num1),"%d",(num/1000));
format(num2,sizeof(num2),"%d",(num%1000));
format(final,sizeof(final),"%d,%d",num1,num2); }
if(num > 999999999 && num < 1000000000000) {
format(num1,sizeof(num1),"%d",(num/1000000));
format(num2,sizeof(num2),"%d",(num%1000000/1000));
format(num3,sizeof(num3),"%d",(num%1000));
format(final,sizeof(final),"%d,%d,%d",num1,num2,num3); }
return final;
}
When i enter there there any number its shouls return the number with ',' like this
55470 -> 55,470. but thats return me else numbers :<.
Or if you can give me else stock that do it and works will be nice :]
Re: Modulo in pawno? -
radhakr - 07.04.2011
Pawn has a modulo operator built in.
Код:
main()
{
new var = 5500%1000;
printf("%d", var);
}
Output is 500.