tonihenkel

Create Vehicle with NumerPlate at server-side

Recommended Posts

Posted (edited)

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

Share this post


Link to post
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 ?)

Share this post


Link to post
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";

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.