Question about variables...
#1

Let's say that i declared a variable named 'Candy' in my gamemode, and let's say i created a filterscript that has to use the 'Candy' variable.

How to read/write values to that variable throw my filterscript?

Thanks.
Reply
#2

I suggest you to use the GVar Plug-In by Incognito.
https://sampforum.blast.hk/showthread.php?tid=151076

(Currently is the one with the last reply, the first in the list)

Then use SetGVarInt("Candy", 0);
Reply
#3

PVars and GVar can be used, however they're memory consumers.
Reply
#4

As said, PVar and GVar, but also CallRemoteFunction and setproperty/getproperty.
Reply
#5

I know about PVar's and GVar's but the problem is my old gamemode doesn't use those (it uses regular variables) and i can't recompile because i don't have the .pwn for it. So is there a way i can read/write to those regular variables?

Can i do it with setproperty/getproperty Vince mentioned? If yes, can i have an example please?

Thanks.
Reply
#6

BUMP. :/
Reply
#7

Quote:
Originally Posted by Lorenc_
View Post
however they're memory consumers.
Ofcourse PVars are memory consumers, they are cross script variables, so they eat more memory.

Have a nice day !
Reply
#8

Quote:
Originally Posted by Whizion
View Post
I know about PVar's and GVar's but the problem is my old gamemode doesn't use those (it uses regular variables) and i can't recompile because i don't have the .pwn for it. So is there a way i can read/write to those regular variables?

Can i do it with setproperty/getproperty Vince mentioned? If yes, can i have an example please?

Thanks.
^ Bump.
Reply
#9

Quote:
Originally Posted by Whizion
View Post
^ Bump.
The syntax is written in the "core.inc" include by ITB CompuPhase.

pawn Code:
native getproperty(id, const name[], value=cellmin, string[], size=sizeof (string));
native setproperty(id, const name[], value=cellmin, const string[]);
native deleteproperty(id, const name[], value=cellmin);
native existproperty(id, const name[], value=cellmin);
Example

pawn Code:
setproperty(0, "Candy", cellmin, "Hello");

new str[256];
getproperty(0, "Candy", cellmin, str);

printf("The value of Candy is %s", str);
If you haven't the source of your old GameMode, you can't get that variable... It must be public
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)