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



Variable - Micko123 - 08.11.2016

Can someone tell me how big variable should be for this
PHP код:
mysql_format(g_SQLquerysizeof(query), "UPDATE `players` SET `money` = %d"ammount); 
And how should I know how big new query[]; should be??


Re: Variable - AjaxM - 08.11.2016

Insert the query lenght as 90 ( new query[90]; ). mysql_format is not the same as the normal formatting.


Re: Variable - Micko123 - 08.11.2016

But how to know how big lenght should be?? Why declaring 100 if I need lets say 60..


Re: Variable - AjaxM - 08.11.2016

If you need 60, then insert it as 60. I just told you an estimate.


Re: Variable - Micko123 - 08.11.2016

But how to know how much do I need??
Should letters be counted same as in format(string..
??


Re: Variable - AjaxM - 08.11.2016

Quote:
Originally Posted by Micko123
Посмотреть сообщение
But how to know how much do I need??
Should letters be counted same as in format(string..
??
Of course, it should ; That's why we insert the length in: new query[length];


Re: Variable - Micko123 - 08.11.2016

Okay thx


Re: Variable - denNorske - 08.11.2016

Your query max length will be the string length you've got. = 33

Код:
UPDATE `players` SET `money` = %d
Then, take away "%d" as this will be replaced with a number. = 31

Код:
UPDATE `players` SET `money` =
This number can maximum be 999,999,999 (without the commas, dont write it, imagine it). = 40

Код:
UPDATE `players` SET `money` = 999999999
So in your case I would recommend a string length on 41-45 just to be sure. If this was a bank amount of cash, the max amount a integer can hold is: 2,147,483,647. That makes 1 more.
This is how you calculate the lengths


Re: Variable - Micko123 - 08.11.2016

Thank you bro Repped both