ManeXi Posted June 2, 2016 Posted June 2, 2016 (edited) I want to cancel damage in every weapon with some exceptions, but because god wanted RPG(35) and RPG-HS(36) can't be exceptions. function cancelPedDamage ( attacker, weapon ) --This is to cancel the damage if not (weapon == 16) or (weapon == 35) or (weapon == 36) then cancelEvent() end outputChatBox("Player Weapon is: "..getPedWeapon(attacker, weapon).."") end addEventHandler ( "onClientPedDamage", getRootElement(), cancelPedDamage ) addEventHandler ( "onClientPlayerDamage", getRootElement(), cancelPedDamage ) In other words, damage is not cancelled in Grenade(16) but yes in RPG(35) and in RPG-HS(36) And for another unknown reason I can't output the weapon that the attacker used it puts: ERROR: damage_c.lua:5: attempt to concatenate a boolean value Edited June 3, 2016 by Guest Interested on a paid 3D modder? My Skype: awdsasda.sdasdaad
ViRuZGamiing Posted June 2, 2016 Posted June 2, 2016 this .."" isn't needed only if you want to continue a string afterwards. getPedWeapon's 2nd argument is weapon SLOT and you provide the weapon ID, that's not the same. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ManeXi Posted June 2, 2016 Author Posted June 2, 2016 this .."" isn't needed only if you want to continue a string afterwards. getPedWeapon's 2nd argument is weapon SLOT and you provide the weapon ID, that's not the same. No, sir. https://wiki.multitheftauto.com/wiki/On ... ayerDamage weapon: An integer representing the weapon ID the attacker used And I still getting the output error Interested on a paid 3D modder? My Skype: awdsasda.sdasdaad
Moderators IIYAMA Posted June 2, 2016 Moderators Posted June 2, 2016 if attacker then end Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
ViRuZGamiing Posted June 2, 2016 Posted June 2, 2016 this .."" isn't needed only if you want to continue a string afterwards. getPedWeapon's 2nd argument is weapon SLOT and you provide the weapon ID, that's not the same. No, sir. https://wiki.multitheftauto.com/wiki/On ... ayerDamage weapon: An integer representing the weapon ID the attacker used And I still getting the output error Uhm, yes https://wiki.multitheftauto.com/wiki/GetPedWeapon Optional Arguments weaponSlot: an integer representing the weapon slot (set to the ped's current slot if not given). "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
ManeXi Posted June 3, 2016 Author Posted June 3, 2016 function cancelPedDamage ( attacker, weapon ) --This is to cancel the damage if attacker then if not (weapon == 16) or (weapon == 35) or (weapon == 36) then cancelEvent() end end -- outputChatBox("Player Weapon is: "..getPedWeapon(attacker, weapon)) end addEventHandler ( "onClientPedDamage", getRootElement(), cancelPedDamage ) addEventHandler ( "onClientPlayerDamage", getRootElement(), cancelPedDamage ) this is my code now, I don't care much about Ped's weapon, but still canceling RPG and RPG-HS damage, I have tried to put special IDs like explosions etc... but nothing Interested on a paid 3D modder? My Skype: awdsasda.sdasdaad
Moderators IIYAMA Posted June 3, 2016 Moderators Posted June 3, 2016 Explosion damage can't be cancelled, because the weapon is most of the time unknown. Unless you write a system, that replaces the damage dealing. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
ViRuZGamiing Posted June 3, 2016 Posted June 3, 2016 Explosion damage can't be cancelled, because the weapon is most of the time unknown. Unless you write a system, that replaces the damage dealing. Couldn't you cancel the shoot event if getPedTarget equals a player? "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
Moderators IIYAMA Posted June 3, 2016 Moderators Posted June 3, 2016 Explosions are splash damage and not bullet damage. The use of getPedTarget won't help you. Only a GTA san damage overwrite would. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
ManeXi Posted June 3, 2016 Author Posted June 3, 2016 Instead of making a list of exceptions(Grenade, RPG...) I made a list of all the weapons I want to be their damage canceled, now is working, thanks alot, this can be set as solved. Interested on a paid 3D modder? My Skype: awdsasda.sdasdaad
ViRuZGamiing Posted June 3, 2016 Posted June 3, 2016 Explosions are splash damage and not bullet damage. The use of getPedTarget won't help you.Only a GTA san damage overwrite would. I know but what I ment was if the bullet wasn't fired there wouldn't be no splash damage, so wouldn't it be better to cancel the shooting instead of cancelling the damage and still having the explosion. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
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