SA-MP Forums Archive
[Include] VVars - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] VVars (/showthread.php?tid=235945)



VVars - DexXTer - 06.03.2011

Like PVars just for Vehicles.

Set
SetVVarInt(vehicleid,"VarName",Value);
SetVVarFloat(vehicleid,"VarName",Float:Value);
SetVVarString(vehicleid,"VarName",Text[]);

Get
GetVVarInt(vehicleid,"VarName");
GetVVarFloat(vehicleid,"Varname");
GetVVarString(vehicleid,"VarName");

Specials
DeleteVVar(vehicleid,"VarName");



SetVVar(Int/Float/String):
Sets the vehicles var "VarName" to the value. If success: returns the ID of the slot where the value is saved. If fail (e.g. not enough slots avaible): returns -1.
GetVVar(Int/Float/String):
Gets the vehicles var "VarName". If success: returns the saved value. If fail (e.g. no var is named "VarName": returns 0 like the PVars.
DeleteVVar
Resets Integer, Float and String from vehicles var "VarName" to 0.

Pastebin: http://pastebin.com/3TFv5E4L

Notes:
- #define MAX_VARS defines the number of slots per vehicle. More slots more the time to compile and more ressources needed. Keep it as low a possible
- Theoretically but not practically tested. Should work anyhow
- Bugs are not known yet


Re: VVars - Johnny_Xayc - 06.03.2011

shit,use GVar
p.s. My Include(don't in public) based on GVar and worked perfect!


Re: VVars - Ash. - 06.03.2011

Quote:
Originally Posted by ******
Посмотреть сообщение
Why is GetVVarFloat public? PVars are shared between all scripts and reset when a player leaves, this does neither of those things so has all the problems and none of the advantages of PVars. ATM this is frankly just a slow replacement for normal variables, with which there is nothing wrong. If you can solve the other problems (and they are both possible to solve - look at function hooking and properties (look at properties anyway for this)) then this could be useful.
Agreed. Although this could be useful for cross script vehicle control


AW: VVars - DexXTer - 06.03.2011

Youre right but itґs just an old code found on my plate. Will rewrite in later on - maybe. Thanks for your comments.