Jump to content

[C#] SharedData


Laelon

Recommended Posts

Hi there! I'm trying to get the SharedData for a Vehicle working. But it looks like the Data is not getting set. Maybe you can help!

Server Code:

[Command("veh")]
public void CreateVehicle(Client player, string hash, int color1, int color2, string plate) {
    VehicleHash vehicleHash = NAPI.Util.VehicleNameToModel(hash);
    Vehicle vehicle = NAPI.Vehicle.CreateVehicle(vehicleHash, player.Position, 0, color1, color2);

    Random rnd = new Random();
    int guid = rnd.Next(100000000, 999999999);

    vehicle.SetSharedData("VehicleGUID", guid);

    //DEBUG
    NAPI.Util.ConsoleOutput("GUID: " + vehicle.GetSharedData("VehicleGUID"));
}

Output:

nv6xj3co.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...