#Paper Posted July 11, 2011 Posted July 11, 2011 error: attempt to index upvalue on "headShots" (a table value) it happen when i use "test" cmd and the text is setted to: "table: xxxxxxxx" local headShots = 1 local legShots = 0 local torsoShots = 0 local armShots = 0 local assShots = 0 function modifyKillCounter(killer, weapon, bodypart) if bodypart == 9 then headShots = headShots + 1 elseif bodypart == 7 or bodypart == 8 then legShots = legShots + 1 elseif bodypart == 5 or bodypart == 6 then armShots = armShots + 1 elseif bodypart == 3 then torsoShots = torsoShots + 1 elseif bodypart == 4 then assShots = assShots + 1 end headShots:text("HeadShots#FF7256: [ #ffffff"..tostring(headShots).." #FF7256]") leg:text("Leg#FF7256: [ #ffffff"..tostring(legShots).." #FF7256]") torso:text("Torso#FF7256: [ #ffffff"..tostring(torsoShots).." #FF7256]") arm:text("Arm#FF7256: [ #ffffff"..tostring(armShots).." #FF7256]") ass:text("Ass#FF7256: [ #ffffff"..tostring(assShots).." #FF7256]") end addEventHandler("onClientPlayerWasted", getRootElement(), modifyKillCounter) function test () headShots = headShots + 1 end addCommandHandler("test", test) My skype: skiper964 I helped you? Help me! ^^ Help me bro! ^^
Buffalo Posted July 11, 2011 Posted July 11, 2011 headShots:text("HeadShots#FF7256: [ #ffffff"..tostring(headShots).." #FF7256]") change to textHeadshots:text("HeadShots#FF7256: [ #ffffff"..tostring(headShots).." #FF7256]") Powered by Kimsufi© ☢ ZHP on Facebook ☢ ZHP on Youtube ☢ Support us ☢
#Paper Posted July 11, 2011 Author Posted July 11, 2011 headShots:text("HeadShots#FF7256: [ #ffffff"..tostring(headShots).." #FF7256]") change to textHeadshots:text("HeadShots#FF7256: [ #ffffff"..tostring(headShots).." #FF7256]") the name is headShots not textHeadshots My skype: skiper964 I helped you? Help me! ^^ Help me bro! ^^
Buffalo Posted July 11, 2011 Posted July 11, 2011 The point is you need to use different names or it will cause that error. headShots for counting and textHeadshots for text display. Powered by Kimsufi© ☢ ZHP on Facebook ☢ ZHP on Youtube ☢ Support us ☢
#Paper Posted July 11, 2011 Author Posted July 11, 2011 The point is you need to use different names or it will cause that error. headShots for counting and textHeadshots for text display. Thanks bro My skype: skiper964 I helped you? Help me! ^^ Help me bro! ^^
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