SA-MP Forums Archive
Storing a vaule - 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: Storing a vaule (/showthread.php?tid=320916)



Storing a vaule - Abreezy - 25.02.2012

Hey guys, this might be a nooby question, but I can't figure this out, might just be how tired I am.

I want to store a value of "baddress" basically, I want it to start at 1000, so I had first did:

pawn Код:
new baddress = 1000;
But now, on /bcreate which is my business create command, I did

pawn Код:
baddress ++;
therefore making the address 1001. But, Now i do it again, and it comes out at 1001 again, so how could I store the 1001, therefore making 1002, then 1003..etc. Thank you advance! I use mysql, if thats important to know.


Re: Storing a vaule - FalconX - 25.02.2012

Quote:
Originally Posted by Abreezy
Посмотреть сообщение
Hey guys, this might be a nooby question, but I can't figure this out, might just be how tired I am.

I want to store a value of "baddress" basically, I want it to start at 1000, so I had first did:

pawn Код:
new baddress = 1000;
But now, on /bcreate which is my business create command, I did

pawn Код:
baddress ++;
therefore making the address 1001. But, Now i do it again, and it comes out at 1001 again, so how could I store the 1001, therefore making 1002, then 1003..etc. Thank you advance! I use mysql, if thats important to know.
Hello friend,

Hmm, so you are making a command called "/bcreate" and want to start the value from 1000, so it increases a digit on each time when type the command /bcreate.

Well then actually in my opinion it's correct to use "baddress++;" as it increase 1 digit on each time the command is used (The value will not be saved in the MySQL database unless you run a mysql_query, this is just a temporary value it will be turned back to 1000 when the server restarts).

If this is what you meant then i guess i've helped you if not then please try to explain even more better.

-FalconX


Re: Storing a vaule - park4bmx - 25.02.2012

The baddress value show be global !
So it can store its value.


Re: Storing a vaule - Abreezy - 25.02.2012

Yeah, I found quick fix to my issue, I place new baddress = 1000; in the loading of business, with a baddresss++; so now when I load business, it loads the last digit i was at in the 1000s therefore placing the next one with /bcreate.

Thank you both for your responses though.


Re: Storing a vaule - FalconX - 25.02.2012

Quote:
Originally Posted by Abreezy
Посмотреть сообщение
Yeah, I found quick fix to my issue, I place new baddress = 1000; in the loading of business, with a baddresss++; so now when I load business, it loads the last digit i was at in the 1000s therefore placing the next one with /bcreate.

Thank you both for your responses though.
No problem mate.