[Include] VVars
#1

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
Reply
#2

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

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
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)