Jump to content

[HELP] Invincible object of car crash


MatiMTA

Recommended Posts

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

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