Need a script

Hello so I am working on a script and I have some problems with it so can anyone help me with it? So the thing is that I want a door thats looked and then you press E in a cirkle and then a progres bar pops up maybe GitHub - HalCroves/mythic_progbar: FiveM Client-sided Progress Bar and after that the door opens 90 degres. Pls help!

Hey :slight_smile:
There is a very very good post about a native doorlocking system :

If you want the door opening by herself you can use the following Natives :

-- To get the door/you might get it another way if you use part of the method in the post I linked above
GetClosestObjectOfType()
-- To rotate the door 
SetEntityRotation()

yea but I want it to open after triggering a event is it Triggerevent then?

That depends, there is multiple ways to implement the Natives from the guide above or the ones I was talking about. When I writte a script I base his structure on the environment (framework, other resources etc) and my needs at the moment.

One example base on the two natives I was talking before could be :

  1. Write a function to display the marker in front of the door.
  2. Check the position of the player to see If is inside the marker.
    2.1 If he’s inside the marker then display a notification “Press E to open the door”
  3. Write the function that will open the door using the two Natives (GetClosestObejectOfType() & SetEntityRotation())
  4. Trigger a server event that will then trigger a client event (on all clients) that will call the funtion to open the door. (Other wise the other players wont see the door opening when the player will open it)

That’s just the general idea and based on the fact that it is for a specific door (doing that for multiple doors will be bad optimisation wise). If you plan on doing this for a bunch of doors I would recommand to check out the [Lock doors guide] above and ask around in the topic if someone know how to use the built-in system to do an automatic opening of the door (might be possible with one of the door related native, but I don’t know personnaly)