ManeXi Posted June 2, 2016 Share 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 Link to comment
ViRuZGamiing Posted June 2, 2016 Share 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. Link to comment
ManeXi Posted June 2, 2016 Author Share 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 Link to comment
Moderators IIYAMA Posted June 2, 2016 Moderators Share Posted June 2, 2016 if attacker then end Link to comment
ViRuZGamiing Posted June 2, 2016 Share 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). Link to comment
ManeXi Posted June 3, 2016 Author Share 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 Link to comment
Moderators IIYAMA Posted June 3, 2016 Moderators Share 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. Link to comment
ViRuZGamiing Posted June 3, 2016 Share 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? Link to comment
Moderators IIYAMA Posted June 3, 2016 Moderators Share 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. Link to comment
ManeXi Posted June 3, 2016 Author Share 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. Link to comment
ViRuZGamiing Posted June 3, 2016 Share 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. 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