Sign in to follow this  
Minokon

Global variables

Recommended Posts

Hello

I have next question: Can I create variable which I can use in all resources? If I can, how do create it?

Thanks for help.

http://polish-law.strefa.pl/

Regards,

Minokon

Edited by Guest

Share this post


Link to post

No, you can't create a variable used in all resources.

local variables are used only in thier block(function , etc, etc...),

global variables are used in all the scripts in the resources.

you can do something like that:

function getMyVariable() 
      return theVariable 
end 

and export it so it can be used in another scripts.

Share this post


Link to post
  
setElementData(element theElement,string name,string/float/table/boolean data, boolean sync) 
getElementData(element theElement,string name) 
  

but you need to call setElementData each time you change the var.

Share this post


Link to post

Exporting a function that gets the variable is easier, because you don't have to update it.

Share this post


Link to post

Thank very much for help. I will use it.

My head thinking like in SA-MP, I just used to, maybe somobody know how to create global variable in Pawn xD

top_gradient.jpg

Regards,

Minokon

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.