Jump to content

Create Vehicle with NumerPlate at server-side


tonihenkel

Recommended Posts

Hi,

I build a Garage for the Basic Jobs with NativeLUA.


CLIENT:

Zitat

 

[..]

mp.events.callRemote("TEST", player);

[..]

 

SERVER:

Zitat

[..]

mp.events.add("TEST", (player) => {
    mp.vehicles.new(mp.joaat("turismor"), new mp.Vector3(0, 10, 70),
        {
            numberPlate: "Test",
            heading: 10,
            locked: false,
            color: [[255,255,0],[255,255,0]],
        });
})

[..]

I have the Problem,

The Number Plate is Blank. I testing anythings. When I use Client Side Version, I see the Number Plate, but the spawn Vehicle I can see only (Simple: Its Client version and only for me). When I use for server side: mp.events.add("playerJoin", (player) => { its work too, but I need the Number plate from a transfered from client to server side.

With call from client-side: http://prntscr.com/ngyfm0

With PlayerJoin and at client-side: http://prntscr.com/ngyhox

 

PS:

I test this script with :

   

Zitat

  player.vspawner_Vehicle = mp.vehicles.new(mp.joaat(vehicle), position, {heading: player.heading, numberPlate: player.name, dimension: player.dimension});
   

Here you can't see your Name too in the Numer Plate

 

How I can visible the NumberPlate at server side ?

Edited by tonihenkel
Link to comment
Share on other sites

Zitat

function playerEnterVehicleHandler(player, vehicle, seat) {
    oldPlate = player.vehicle.numberPlate;
    player.vehicle.numberPlate = oldPlate
}
mp.events.add("playerEnterVehicle", playerEnterVehicleHandler);

Currently I used this or do you have a better Idea? (Direct use with mp.vehicles.new ?)

Link to comment
Share on other sites

I've found that I need to re-set the plate after creating the vehicle to ensure it takes:

 var veh = NAPI.Vehicle.CreateVehicle(NAPI.Util.GetHashKey(car), client.Position.Around(5), 30, 2, 3, "My Plate", 255);
  veh.NumberPlate = "My Plate";

 

So in your example:

let veh = mp.vehicles.new(mp.joaat("turismor"), new mp.Vector3(0, 10, 70),
        {
            numberPlate: "Test",
            heading: 10,
            locked: false,
            color: [[255,255,0],[255,255,0]],
        });
veh.numberPlate = "Test";

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...