Using variables from other scripts. - 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: Using variables from other scripts. (
/showthread.php?tid=380899)
Using variables from other scripts. -
zappydude - 27.09.2012
Basically, I've got a registration script which I plan to put a 'VIP' type system into. However, I do plan to put in special buildings etc. that are only accessible by VIPs - now, for me to check if they are a VIP, I'd have to read from the file using INI as the variables of course that hold whether they are a VIP are stored in the filterscript.
In terms of getting around this, I can only think of the file reading method, however I usually only update the files using INI when they disconnect - the problem this poses is that if I make them a VIP while they are connected, it will stay in a variable that's created for every player and it will not be updated in the file until they disconnect and it writes.
As a solution I could make it save automatically after a command that edits the game-file, however I'd rather not.
Any clues? I'd also like to avoid joining the filterscript to the gamemode - worst case scenario I'll put all of the VIP system related code within the registration system, but I would of liked to of kept it within the gamemode just so I'd be able to keep all the vehicles (specifically the VIP ones) inside the gamemode.
Re: Using variables from other scripts. -
SuperViper - 27.09.2012
This is what
PVars are used for. They're cross script.
https://sampwiki.blast.hk/wiki/SetPVarInt
https://sampwiki.blast.hk/wiki/GetPVarInt
Re: Using variables from other scripts. -
zappydude - 27.09.2012
Quote:
Originally Posted by SuperViper
|
You legend.
I'll look into them and hopefully they sort the issue out - thanks a bunch.