AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   variable question (https://forums.alliedmods.net/showthread.php?t=53885)

CipryXXX 04-12-2007 15:54

variable question
 
is it posible to make a global variable,set a new value of the variable in a function and then test in a new function something with that variable from the first function,here is a example of what i am asking:
Code:

new variable
public test()
{
variable =1
}
public test2()
{
if (variable ==1)
...
}

i know its wron what is did in this code but i dont know how to say :)

Drak 04-12-2007 15:56

Re: variable question
 
Well of course. You're example code is perfectly fine...
Just try it, instead of having to ask.

CipryXXX 04-12-2007 16:17

Re: variable question
 
u are sayng that if i am setting a value in a function to a global variable , the global varibale is going to take that value from the function and if i am using it again it will have the value from that function?

Drak 04-12-2007 18:42

Re: variable question
 
Yes... What else would global variables do? There accessed by everything.


All times are GMT -4. The time now is 06:42.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.