SA-MP Forums Archive
ID on a 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: ID on a variable (/showthread.php?tid=515472)



ID on a variable - TheSimpleGuy - 26.05.2014

I've been experiencing troubles on getting the ID and putting it on a variable, I could not use CallLocalFunction because I will use a public for it. I will show you an example on how it will work:

- Activate it using a command(with the ID)
- Saving the ID on the variable
- Set the variable into a public(e.g. OnPlayerKeyStateChange)
- Ta-da! Thaz it. Hao du I du it.


Re: ID on a variable - Rittik - 26.05.2014

For example.

Okay, so make global variable (which can be used in any functions).
Q."How can I make it ?"
Ans. At the top of your gamemode insert "new var;"(you can name it on your own)

Under your command ,save the ID in this global variable named as "var".

Then,apply/set the variable under OnPlayerKeyStateChange.


Re: ID on a variable - TheSimpleGuy - 26.05.2014

Already tried that and it didn't work.


Re: ID on a variable - Rittik - 26.05.2014

If you can PM or post your code ,it would be better ..


Re: ID on a variable - Zex Tan - 26.05.2014

I don't understand of what you're trying to create.

For what I did for adding IDs is by MySQL (using mysql_insert_id), and insert it into the var.
pawn Код:
new id = mysql_insert_id();
format(msg, 5, "ID is %i", id);
So it would produce an auto-increment ID starting from 1.