Jump to content

[HELP] Invincible object of car crash


MatiMTA

Recommended Posts

Posted

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.

Posted
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

My discord: Armisael_#1719

 Did my help work for you? Don't forget to thank 

¿Mi ayuda funcionó para ti? No olvides agradecer

How give thanks

 

 

 

 

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

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

My discord: Armisael_#1719

 Did my help work for you? Don't forget to thank 

¿Mi ayuda funcionó para ti? No olvides agradecer

How give thanks

 

 

 

 

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