Jump to content

Recommended Posts

Posted
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

  • 1 year later...
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

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