Making variables universal - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Making variables universal (
/showthread.php?tid=389458)
Making variables universal -
Brandlax - 02.11.2012
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);
Re: Making variables universal -
cessil - 02.11.2012
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
Re: Making variables universal -
Brandlax - 02.11.2012
Quote:
Originally Posted by cessil
|
Oh my God..thanks alot, it worked perfectly!