kaos057 Posted May 20, 2012 Share 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? Link to comment
Jaysds1 Posted May 20, 2012 Share Posted May 20, 2012 Sorry, you have to add it server-sided, the client side doesn't get effected if you try canceling it. Link to comment
kaos057 Posted May 20, 2012 Author Share 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? Link to comment
Jaysds1 Posted May 20, 2012 Share Posted May 20, 2012 (edited) if you canceled the event Client-side it should work: onClientPlayerDamage Edited May 20, 2012 by Guest Link to comment
X-SHADOW Posted May 20, 2012 Share Posted May 20, 2012 Try Using this addEventHandler ( "onPlayerDamage", getRootElement(), cancelEvent ) Link to comment
myonlake Posted May 20, 2012 Share 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. Link to comment
X-SHADOW Posted May 20, 2012 Share Posted May 20, 2012 why it wont work on serverside? if i try trigger it well work or not ? Link to comment
Stanley Sathler Posted May 20, 2012 Share 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) Link to comment
X-SHADOW Posted May 20, 2012 Share Posted May 20, 2012 lol i never thougt about this StanleySathler its cool idea ! Link to comment
Mefisto_PL Posted May 20, 2012 Share 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 Link to comment
myonlake Posted May 20, 2012 Share 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 Link to comment
Stanley Sathler Posted May 20, 2012 Share 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(). Link to comment
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