Filterscript use gamemode's variables
#5

Here is what I usually.

1.) Create public functions that can access the data I want.
2.) Create an include to access those functions.

Example.

In gamemode.

pawn Код:
new SomeVariable;

forward GetSomeVariable();
public GetSomeVariable() { return SomeVariable; }

forward SetSomeVariable(value);
public SetSomeVariable(value) { SomeVariable = value; }
Your include.

pawn Код:
#define GetSomeVariable() CallRemoteFunction("GetSomeVariable","")
#define SetSomeVariable(%0) CallRemoteFunction("SetSomeVariable","i",%0)
Some people might recommend using PVars I am going to say that is a very lousy method and I will explain why. Any time that variable changes you need to set the PVar as well which is inefficient or replace all instances of that variable with Set/Get PVar functions which is again inefficient and you would also lose the benefit of error checking incorrect variable names.

@Stinged You will always want to use #define rather than a function.
Reply


Messages In This Thread
Filterscript use gamemode's variables - by Jimmy0wns - 13.09.2014, 14:15
Re: Filterscript use gamemode's variables - by Infinity - 13.09.2014, 14:16
Re: Filterscript use gamemode's variables - by Jimmy0wns - 13.09.2014, 14:22
Re: Filterscript use gamemode's variables - by Stinged - 13.09.2014, 14:25
Re: Filterscript use gamemode's variables - by Pottus - 13.09.2014, 14:26
Re: Filterscript use gamemode's variables - by Jimmy0wns - 13.09.2014, 14:27
Re: Filterscript use gamemode's variables - by Pottus - 13.09.2014, 14:31
Re: Filterscript use gamemode's variables - by Lordzy - 13.09.2014, 16:11
Re: Filterscript use gamemode's variables - by Jimmy0wns - 13.09.2014, 17:05
Re: Filterscript use gamemode's variables - by PMH - 13.09.2014, 18:13

Forum Jump:


Users browsing this thread: 1 Guest(s)