Jump to content

onClientPlayerDamage - executes 1-4 times


ds1-e

Recommended Posts

  • Scripting Moderators

Hey, i have noticed a problem with that event. Weapons which cause explosions, for example: 51, 19, as topic say execute 1-4 times. Any idea how to fix it? Another question associated with this, it's possible/worth to move damage system (functions) on server side?

It happens mostly with car explosion, example function below. 

function damage(attacker, weapon, bodypart, loss)
	cancelEvent()
	outputChatBox(weapon)
end
addEventHandler("onClientPlayerDamage", getLocalPlayer(), damage)

 

Edited by majqq
Link to comment
  • Moderators

1.

Not really. It probably has multiple damage layers.

2.

You can't cancel damage serverside, as that event triggers much too late. There is connection delay (ping). By the time you reset the health, the player might have been (insta) killed already.

 

Possible solution for an overwrite:

https://wiki.multitheftauto.com/wiki/OnClientExplosion

cancelEvent()

https://wiki.multitheftauto.com/wiki/CreateExplosion

 

 

  • Thanks 1
Link to comment
  • 2 months later...

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