Bilal135 Posted December 10, 2019 Share Posted December 10, 2019 local weaponTable = { -- [weap_id] = { torso, ass, left_arm, right_arm, left_leg, right_leg, head } [24] = { 45, 35, 30, 30, 25, 25, 70 }, } addEventHandler("onPlayerDamage", getRootElement(), function (attacker, weapon, bodypart, loss) if getElementType(attacker) == "player" and getPlayerWeapon(attacker) and weaponTable[ getPlayerWeapon(attacker) ] then setElementHealth(source, getElementHealth(source) - weaponTable[ getPlayerWeapon(attacker) ] [ bodyPart - 2] + loss) end end ) This is supposed to set the damage for each weapon according to the body parts, but for some reason, the code isnt working and the only error im getting is this: Attempt to perform arithmetic on 'bodyPart' (a nil value). Any help would be appreciated. Link to comment
Moderators IIYAMA Posted December 10, 2019 Moderators Share Posted December 10, 2019 1 hour ago, Lynch said: Attempt to perform arithmetic on 'bodyPart' (a nil value). You made a typo. bodypart ( line 8 ) > bodyPart ( line 10 ) 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