kaos057 Posted May 20, 2012 Posted May 20, 2012 I am trying to make a full MMO with levels, custom armor/weapons, etc. To do this I need to disable default damage and handle it myself in order to take into consideration extra hitpoints and damage modifiers from the custom gear. I know I can disable the damage on client side using onClientPlayerDamage which works for any self inflicted damage but the server side still does damage. So is there any way to either stop all damage completely or somehow make a player have more hitpoints than others?
Jaysds1 Posted May 20, 2012 Posted May 20, 2012 Sorry, you have to add it server-sided, the client side doesn't get effected if you try canceling it.
kaos057 Posted May 20, 2012 Author Posted May 20, 2012 Yes I know that. My question was how to do that if its possible. You cant cancel the server sided damage event as far as i know. So is there any other way to completely cancel damage on server side?
Jaysds1 Posted May 20, 2012 Posted May 20, 2012 (edited) if you canceled the event Client-side it should work: onClientPlayerDamage Edited May 20, 2012 by Guest
X-SHADOW Posted May 20, 2012 Posted May 20, 2012 Try Using this addEventHandler ( "onPlayerDamage", getRootElement(), cancelEvent )
myonlake Posted May 20, 2012 Posted May 20, 2012 @X-SHADOW: No. It should also be noted that canceling this event has no effect. Cancel the client-side event onClientPlayerDamage instead. @kaos057: Use onClientPlayerDamage.
X-SHADOW Posted May 20, 2012 Posted May 20, 2012 why it wont work on serverside? if i try trigger it well work or not ?
Stanley Sathler Posted May 20, 2012 Posted May 20, 2012 How myonlake said, the onPlayerDamage cannot be canceled (has no effect). So, for solve it, can do: function SetPlayerInvencible(attacker, attackerweapon, bodypart, loss) setElementHealth(source, getElementHealth(source)+loss) addEventHandler("onPlayerDamage", getRootElement(), SetPlayerInvencible)
X-SHADOW Posted May 20, 2012 Posted May 20, 2012 lol i never thougt about this StanleySathler its cool idea !
Mefisto_PL Posted May 20, 2012 Posted May 20, 2012 (edited) To delete player damage use: addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), cancelEvent ) To make another damage , you can try this: setElementHealth ( source, getElementHealth(source) - 20 ) -- Example ///EDIT Oh.. someone write this first : | Edited May 20, 2012 by Guest
myonlake Posted May 20, 2012 Posted May 20, 2012 You can anyways use triggers from server side and vice versa if your scripts won't work without this. triggerClientEvent triggerServerEvent
Stanley Sathler Posted May 20, 2012 Posted May 20, 2012 There's two ways: - Use my first example, when you use setElementHealth() - Use client-side script to use onClientPlayerDamage and trigger using triggerClientEvent().
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