mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Add server-side object events onObjectBreak & onObjectDamage

Open FileEX opened this issue 1 year ago • 3 comments

This PR adds onObjectBreak and onObjectDamage events on the server side.

addEventHandler('onObjectBreak', root, function(attacker)
    print('Object: ', source)
    print('Attacker: ', attacker)
end)

addEventHandler('onObjectDamage', root, function(loss,attacker)
     print('Object: ', source)
     print('Attacker: ', attacker)
     print('Loss: ', loss)
end)

FileEX avatar May 01 '24 23:05 FileEX

Idea is very good, but what you "forgot" to include are functions to enable these events, for example, SetDamageStateOnObject and GetDamageStateOnObject

myusernamewo avatar May 02 '24 01:05 myusernamewo

Idea is very good, but what you "forgot" to include are functions to enable these events, for example, SetDamageStateOnObject and GetDamageStateOnObject

I do not understand what you mean. If you don't want the object to take damage or be destroyed, you can cancel client-side events or use setObjectBreakable & isObjectBreakable

FileEX avatar May 02 '24 12:05 FileEX

I removed the onObjectDamage event. I wanted to do it in the same way as it is done with onPlayerDamage, i.e. in the synchronization package, but object synchronization does not seem to work. I haven't found a definition anywhere for "WITH_OBJECTS_SYNC", which is a condition for this synchronization.

Objects sync has been disabled in https://github.com/multitheftauto/mtasa-blue/issues/460

FileEX avatar May 06 '24 18:05 FileEX