Sign in to follow this  
Flow

Acting with close vehicles

Recommended Posts

5 часов назад, Django93 сказал:

On my server all data is stored in Mysql. When a player wants to lock or unlock a vehicle, it is checked if he has a key for the vehicle. But I cut the part out.

Everyone has to know that himself, how he wants to implement it. Both varieties work.

I meant the definition vehicle of near player

Share this post


Link to post
Share on other sites
Posted (edited)
Am 13.3.2018 um 15:42 schrieb Bryan63:

What for? If there is a special tool for this?

//client-side
let localPlayer = mp.players.local
let idVehicle = mp.game.vehicle.getClosestVehicle(localPlayer.position.x, localPlayer.position.y, localPlayer.position.z, 10, 0, 70)
let vehicle = mp.vehicles.atHandle(idVehicle)
mp.events.callRemote("lockVehicle", vehicle)


//server-side
mp.events.add("lockVehicle", (player, vehicle) => vehicle.locked = !vehicle.locked)

 

Hey Bryan,

I tried 3 hours figuring out why your code doesn't want to work for me. Unfortunately i couldn't find the issue. Does that Code work for you?

 

Edit: I figured out your code works, but only when i press F at the same time. Do you know where the issue could be?

dofH5lfECgQIECBAgAABAgQIECBAgMDGAovAY9mG

Edited by CancerKid

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.