Jump to content

[HELP] SetObjectBreakable


Recommended Posts

Hello, I would like to make sure that I have a gate created on the server side and I don't want it to be broken, e.g. with a car, when you go to it. I tried with triggerClientEvent but it is not good, it says that the event is not found on the client side, can anyone help?
 
 
 
Link to comment

Let me guess, you're calling triggerClientEvent from onPlayerJoin. But onPlayerJoin is triggered before the client scripts have been downloaded and started so it won't work. You have to call triggerClientEvent when you know the client-side script has started. In the older days, we would use triggerServerEvent from the client-side script to let the server know. Now there's onPlayerResourceStart event for that.

Link to comment

Hey Bro , I Hope I Can Help You 😄

You Can Use https://wiki.multitheftauto.com/wiki/OnClientObjectDamage Event To Canceling Damage (GodMode The Gate) 

I Write Part Of Example Code

 

local gate = createObject(19912,x,y,z) -- 19912 is Example Gate ID You Can Replace Your Gate ID , And x,y,z is The Pos Of Gate 

addEventHandler("onClientObjectDamage",gate,function() -- The Event To Know When Object Get Damage From Any Element 
cancelEvent() -- Canceling Event For Canceling Damage (GodMode Gate)
end)


You Can Use This And Enjoy ❤️  

Link to comment

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