Jump to content

global variable from if


A3kri

Recommended Posts

Hello ..

I have an if statement inside function1 which has two variables, source and source2.

is it possible to store these to variable for use in function2?

function 1 ( ) 
    if ( xxx == 1) then 
            outputChatBox (getPlayerName(source1) .. "< source1 " .. getPlayerName(source2) .. "< source2 ", getRootElement (), 255, 170, 0 )  
            toggleControl (source1, "fire", false )          
    end 
end 
  
function 2( ) 
    givePlayerMoney(source1, 10000) 
end 

is it possible?^

Link to comment
You can send the arguments to the second function.
Also, if you don't have 'local' in the function, it will be stored as a global variable.

thanks, what I did was i set them to nil then re set them to a value which made it possible =)

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...