Making variables universal
#1

I have an include file, where a certain value is stored in an array. When I set the value from a particular filterscript, for example setting the value from filterscript A to 23. Whatever function from that filterscript wants the variable from that include file is correct. But if I want to get this variable from another filterscript which also includes this file, it gives me a whole new variable. The variables of the SAME file does not match when called to get or set from different files. How do I make it so that if the variable of that file is set to 23 from filterscript A, I will get 23 when I check the value from filterscript B? My code:

Include File:

Код:
forward GetInformation(playerid, info[]);
forward SetInformation(playerid, info[], value);

new BankMoney[MAX_PLAYERS];


public GetInformation(playerid, info[]){
	if(strcmp(info, "TheBankMoney", true) == 0) return BankMoney[playerid];
}

public SetInformation(playerid, info[], value){
	if(strcmp(info, "TheBankMoney", true) == 0) 
	{ BankMoney[playerid] = value; }
}
Function called::

Код:
GetInformation(playerid, "TheBankMoney")
SetInformation(playerid, "TheBankMoney", 42);
Reply
#2

Including a file will include it for compiling, so it's more of a copy not an reference to the include.
I believe what you're looking for is this https://sampwiki.blast.hk/wiki/CallRemoteFunction
Reply
#3

Quote:
Originally Posted by cessil
Посмотреть сообщение
Including a file will include it for compiling, so it's more of a copy not an reference to the include.
I believe what you're looking for is this https://sampwiki.blast.hk/wiki/CallRemoteFunction
Oh my God..thanks alot, it worked perfectly!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)