MatiMTA Posted March 26, 2020 Share Posted March 26, 2020 Hello, I made a script wich creates an object with some properties. The problem is when I crash my car with the object, the object breaks. It breaks like a fence. There is some function to make the object invincible to car crashes? I created the object in server-side. Thanks. Link to comment
Motar2k Posted March 26, 2020 Share Posted March 26, 2020 1 hour ago, MatiMTA said: Hello, I made a script wich creates an object with some properties. The problem is when I crash my car with the object, the object breaks. It breaks like a fence. There is some function to make the object invincible to car crashes? I created the object in server-side. Thanks. You need use this https://wiki.multitheftauto.com/wiki/SetObjectBreakable but is only for clientside for this use triggerClientEvent Link to comment
MatiMTA Posted March 27, 2020 Author Share Posted March 27, 2020 17 hours ago, Motar2k said: You need use this https://wiki.multitheftauto.com/wiki/SetObjectBreakable but is only for clientside for this use triggerClientEvent I put this on the client side: function setTheObjectUnbreakable(object) setObjectBreakable(object,false) end addEvent("setTheObjectUnbreakable",true) addEventHandler("setTheObjectUnbreakable",root,setTheObjectUnbreakable) And this in the server-side: -- I created an object like this local tOb = createObject(ob['model'], ob['x'], ob['y'], ob['z'], ob['rx'], ob['ry'], ob['rz']) -- setTimer(function() if ob['health'] > 0 then triggerClientEvent("setTheObjectUnbreakable",root,tOb) end end,1000,1,tOb) But this doesn't work. Where is the problem? Link to comment
Motar2k Posted March 28, 2020 Share Posted March 28, 2020 11 hours ago, MatiMTA said: I put this on the client side: function setTheObjectUnbreakable(object) setObjectBreakable(object,false) end addEvent("setTheObjectUnbreakable",true) addEventHandler("setTheObjectUnbreakable",root,setTheObjectUnbreakable) And this in the server-side: -- I created an object like this local tOb = createObject(ob['model'], ob['x'], ob['y'], ob['z'], ob['rx'], ob['ry'], ob['rz']) -- setTimer(function() if ob['health'] > 0 then triggerClientEvent("setTheObjectUnbreakable",root,tOb) end end,1000,1,tOb) But this doesn't work. Where is the problem? I dont see errors Why don't you call the function after the object is created? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now