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



Difference - Spenker - 15.10.2016

What's the difference?
Код HTML:
mysql_format(MySQLCon, qMYSQL[8], 290, "UPDATE `players` SET `BankMoney`=%d WHERE `ID`=%d", plInfo[playerid][pBankMoney],plInfo[playerid][pID]), mysql_tquery(MySQLCon, qMYSQL[8]);
Код HTML:
mysql_format(MySQLCon, qMYSQL[8], 290, "UPDATE `players` SET `BankMoney`=%i WHERE `ID`=%d", plInfo[playerid][pBankMoney],plInfo[playerid][pID]), mysql_tquery(MySQLCon, qMYSQL[8]);
%d / %i?

%d inserts and large numbers? Exemple: 192230192334


Re: Difference - TheDrx - 15.10.2016

%d stands for double. A double will allow your script to save numbers with a . in that specific variable. For example: 1.2 or 23.451. Usually used for cash.

%i stands for int (integer). An integer will allow your script to save complete numbers. For example 2 or 254 or 85478.


Re: Difference - Threshold - 15.10.2016

I don't know where you got this whole float value thing for %d, but %d literally is the same as %i. They are both used for integers, not floats.

If you want a number with a decimal value in it, you should be using %f not %d.

https://sampwiki.blast.hk/wiki/Format

In short, there is no difference.


Re: Difference - Mencent - 15.10.2016

Quote:
Originally Posted by TheDrx
Посмотреть сообщение
A double will allow your script to save numbers with a . in that specific variable. For example: 1.2 or 23.451. Usually used for cash.
Not in PAWN. In PAWN, the f (%f) is for numbers with a point, d and i are in PAWN the same.


Re: Difference - TheDrx - 15.10.2016

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Not in PAWN. In PAWN, the f (%f) is for numbers with a point, d and i are in PAWN the same.
My bad then. Thank you.