Save variable outside a public
#1

Hey guys, I've got the following code:

pawn Код:
new x; // on top of my script

...

public _function()
{
    ...
    x = 11;
    ...
    return true;
}

public _function2() return printf("%d", x); // returns 0 (like x is just initialised)
What I want is the value of x in _function2() (after it has been filled in _function() ofc).
It is not an option for me to return the value at the end of _function() so I can do newvar = _function().

How can I do that?
Reply
#2

I do not understand what you mean.
Reply
#3

I defined x on top of the script, filled it in function1 and want to use it on function2.
Reply
#4

Well, if you are sure that _function was called before _function2, then it should return 11.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)