Vice City: Multiplayer

Server Development => Community Plugins => Topic started by: habi on May 16, 2023, 06:50 PM

Title: VarHolder - Add custom properties to Player, Vehicle, Pickup, Checkpoint, Object
Post by: habi on May 16, 2023, 06:50 PM
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 documentation
No:of functions : 1

Some question and answers

Tested to work in 64-bit Linux (Ubuntu)

Source available : varholder-source.zip (https://www.mediafire.com/file/yj5oyz504v4dh46/varholder-source.zip/file) (19.06 KB)