VarHolder
means Variable Holder.
In server.cfg
plugins squirrel04rel32 varholder04rel32
Then in scripts/main.nut
CreateVar( "CPlayer", "adminlevel", 3); //to use player.adminlevel
CreateVar( "CVehicle", "property", "OK"); //for vehicle.property
CreateVar( "CPickup", "value", 0);
CreateVar( "CObject", "alpha", 2.33);
CreateVar( "CCheckpoint", "alpha", [1]);
and
player.adminlevel = 4;
FindCheckpoint(0).alpha[0] = 2;
pickup.value = 1
vehicle.property = "NO";
You can create functions too...
CreateVar( "CPlayer", "warn", function(){::MessagePlayer("You have been warned", this);} )
...
player.warn();
These topics ?topic=468 (https://forum.vc-mp.org/index.php?topic=468) (2015), ?topic=257.0 (https://forum.vc-mp.org/index.php?topic=257.0) (2015), of the forum related to the same subject.
Download links(plugin): varholder.zip (https://www.mediafire.com/file/2x2oi4p5sha49pi/varholder.zip/file) (mediafire)
Function documentationNo:of functions : 1
- CreateVar( string classname, string varname, initialvalue )
where
classname is one of "CPlayer", "CVehicle", "CPickup", "CCheckpoint" and "CObject".
varname : The name of the variable you want to create
initialvalue : Can be any data type. If table, array or classinstance it works internally by creating clone of it.
Return value : always null
Behaviour : If variable already exists, it will be deleted and recreated.
Some question and answers- Do the property i created resets automatically when for example a player with ID 2 leaves server and another player joins with ID 2. Do my property resets to initial value for this new player?
Yes. The values of old player are erased and the properties are fresh initialvalue you provided when creating the property.
Tested to work in 64-bit Linux (Ubuntu) - The plugin is tested to work on WSL ubuntu.
Source available : varholder-source.zip (https://www.mediafire.com/file/yj5oyz504v4dh46/varholder-source.zip/file) (19.06 KB)