LiOneLMeSsIShoT Posted July 14, 2013 Posted July 14, 2013 Hello guys .. I made this script to set Levels every 100 Points in weapon skills...but i got some script ERRORS...may you help me with it? Client: function WeaponLevels (killer, weapon, bodypart) local Nothing = tonumber(getPedStat(killer, 69)) if Nothing = 100 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 1",Nothing) elseif Nothing = 200 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 2",Nothing) elseif Nothing = 300 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 3",Nothing) elseif Nothing = 400 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 4",Nothing) elseif Nothing = 500 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 5",Nothing) elseif Nothing = 600 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 6",Nothing) elseif Nothing = 700 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 7",Nothing) elseif Nothing = 800 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 8",Nothing) elseif Nothing = 900 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 9",Nothing) elseif Nothing = 1000 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 10",Nothing) end end addEventHandler( "onClientRender",getRootElement(), WeaponLevels) ERROR: WeaponPoints.lua:125: 'then' expected near '=' Please help
iMr.3a[Z]eF Posted July 14, 2013 Posted July 14, 2013 try this: function WeaponLevels (killer, weapon) local Nothing = tonumber(getPedStat(killer, 69)) if Nothing = 100 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 1",Nothing) elseif Nothing == 200 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 2",Nothing) elseif Nothing == 300 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 3",Nothing) elseif Nothing == 400 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 4",Nothing) elseif Nothing == 500 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 5",Nothing) elseif Nothing == 600 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 6",Nothing) elseif Nothing == 700 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 7",Nothing) elseif Nothing == 800 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 8",Nothing) elseif Nothing == 900 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 9",Nothing) elseif Nothing == 1000 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 10",Nothing) end end addEventHandler( "onClientRender",getRootElement(), WeaponLevels)
iMr.3a[Z]eF Posted July 14, 2013 Posted July 14, 2013 Use dxDrawText instead of guiSetText. I think he made a panel.
LiOneLMeSsIShoT Posted July 14, 2013 Author Posted July 14, 2013 Use dxDrawText instead of guiSetText. I think he made a panel. I made a panel Already
DNL291 Posted July 14, 2013 Posted July 14, 2013 (edited) Try this: function WeaponLevels (killer, weapon, bodypart) local Nothing = tonumber(getPedStat(killer, 69)) if Nothing <= 100 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 1",Nothing) elseif Nothing <= 200 and Nothing > 100 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 2",Nothing) elseif Nothing <= 300 and Nothing > 200 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 3",Nothing) elseif Nothing <= 400 and Nothing > 300 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 4",Nothing) elseif Nothing <= 500 and Nothing > 400 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 5",Nothing) elseif Nothing <= 600 and Nothing > 500 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 6",Nothing) elseif Nothing <= 700 and Nothing > 600 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 7",Nothing) elseif Nothing <= 800 and Nothing > 700 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 8",Nothing) elseif Nothing <= 900 and Nothing > 800 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 9",Nothing) elseif Nothing <= 1000 and Nothing > 900 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 10",Nothing) end end addEventHandler( "onClientRender",getRootElement(), WeaponLevels) Edited July 14, 2013 by Guest
LiOneLMeSsIShoT Posted July 14, 2013 Author Posted July 14, 2013 try this: function WeaponLevels (killer, weapon) local Nothing = tonumber(getPedStat(killer, 69)) if Nothing = 100 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 1",Nothing) elseif Nothing == 200 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 2",Nothing) elseif Nothing == 300 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 3",Nothing) elseif Nothing == 400 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 4",Nothing) elseif Nothing == 500 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 5",Nothing) elseif Nothing == 600 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 6",Nothing) elseif Nothing == 700 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 7",Nothing) elseif Nothing == 800 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 8",Nothing) elseif Nothing == 900 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 9",Nothing) elseif Nothing == 1000 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 10",Nothing) end end addEventHandler( "onClientRender",getRootElement(), WeaponLevels) Now i got another ERROR: WeaponPoints_c.lua:128: 'then' expected near '='
LiOneLMeSsIShoT Posted July 14, 2013 Author Posted July 14, 2013 (edited) try this: function WeaponLevels (killer, weapon) local Nothing = tonumber(getPedStat(killer, 69)) if Nothing = 100 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 1",Nothing) elseif Nothing == 200 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 2",Nothing) elseif Nothing == 300 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 3",Nothing) elseif Nothing == 400 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 4",Nothing) elseif Nothing == 500 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 5",Nothing) elseif Nothing == 600 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 6",Nothing) elseif Nothing == 700 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 7",Nothing) elseif Nothing == 800 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 8",Nothing) elseif Nothing == 900 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 9",Nothing) elseif Nothing == 1000 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 10",Nothing) end end addEventHandler( "onClientRender",getRootElement(), WeaponLevels) Now i got another ERROR: WeaponPoints_c.lua:128: 'then' expected near '=' The ERROR is here in :128:...Just shows because it's not the full script if Nothing = 100 and weapon = 22 then Edited July 14, 2013 by Guest
LiOneLMeSsIShoT Posted July 14, 2013 Author Posted July 14, 2013 try this: function WeaponLevels (killer, weapon) local Nothing = tonumber(getPedStat(killer, 69)) if Nothing = 100 and weapon = 22 then guiSetText (GUIEditor.label[3], "Level: 1",Nothing) elseif Nothing == 200 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 2",Nothing) elseif Nothing == 300 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 3",Nothing) elseif Nothing == 400 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 4",Nothing) elseif Nothing == 500 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 5",Nothing) elseif Nothing == 600 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 6",Nothing) elseif Nothing == 700 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 7",Nothing) elseif Nothing == 800 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 8",Nothing) elseif Nothing == 900 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 9",Nothing) elseif Nothing == 1000 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 10",Nothing) end end addEventHandler( "onClientRender",getRootElement(), WeaponLevels) Now i got another ERROR: WeaponPoints_c.lua:128: 'then' expected near '=' The ERROR is here in :128:...Just shows because it's not the full script if WeaponLevels = 100 and weapon = 22 then HEllo?!!! Are you here guys?
LiOneLMeSsIShoT Posted July 14, 2013 Author Posted July 14, 2013 Try the code I edited above. DID it already~
LiOneLMeSsIShoT Posted July 14, 2013 Author Posted July 14, 2013 Try the code I edited above. DID it already~ The Same ERROR...: weaponPoints_c.lua:124: 'then' expected near '=' if Nothing = 100 and weapon = 22 then
LiOneLMeSsIShoT Posted July 14, 2013 Author Posted July 14, 2013 I fixed an error, try it again. Again........Same ERROR...I think the error with Nothing = 100 ... about local Nothing = tonumber(getPedStat(killer, 69)) if Nothing = 100 I think it's not correct? Please check ... I want the 100 Means....the Weapon Skill Points..Understand what i mean?
DNL291 Posted July 15, 2013 Posted July 15, 2013 I did not put 'if Nothing = 100 ...' in my code. Make sure you updated that resource on the server.
LiOneLMeSsIShoT Posted July 15, 2013 Author Posted July 15, 2013 (edited) I did not put 'if Nothing = 100 ...' in my code.Make sure you updated that resource on the server. Okay now Tested your Script...ERROR: WeaponPoints_c.lua:116: Bad Argument @ 'guiSetText' [Expected gui-element at argument 1,got nil Edited July 15, 2013 by Guest
LiOneLMeSsIShoT Posted July 15, 2013 Author Posted July 15, 2013 In guiSetText, remove ",Nothing" lol!! look :116: is function WeaponPoints() local WeaponPoints = getPedStat( localPlayer, 69 ); guiSetText( GUIEditor.label[2],"Points: "..WeaponPoints ); end addEventHandler( "onClientRender", root, WeaponPoints ); it's the script i use to set player points in the label...it was working 1000000% before i put this new script function WeaponLevels (killer, weapon) local Nothing = tonumber(getPedStat(killer, 69)) if Nothing <= 100 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 1") elseif Nothing <= 200 and Nothing > 100 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 2") elseif Nothing <= 300 and Nothing > 200 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 3") elseif Nothing <= 400 and Nothing > 300 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 4") elseif Nothing <= 500 and Nothing > 400 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 5") elseif Nothing <= 600 and Nothing > 500 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 6") elseif Nothing <= 700 and Nothing > 600 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 7") elseif Nothing <= 800 and Nothing > 700 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 8") elseif Nothing <= 900 and Nothing > 800 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 9") elseif Nothing <= 1000 and Nothing > 900 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 10") end end end addEventHandler( "onClientRender",getRootElement(), WeaponLevels)
LiOneLMeSsIShoT Posted July 15, 2013 Author Posted July 15, 2013 Show us where is GUIEditor.label[3] defined. Sure GUIEditor.label[3] = guiCreateLabel(80, 71, 88, 21, "Level: 0", false, GUIEditor.tab[1])
iMr.3a[Z]eF Posted July 15, 2013 Posted July 15, 2013 it won't works try this function WeaponLevels (killer, weapon) local Nothing = tonumber(getPedStat(killer, 69)) if Nothing <= 100 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 1") elseif Nothing <= 200 and Nothing > 100 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 2") elseif Nothing <= 300 and Nothing > 200 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 3") elseif Nothing <= 400 and Nothing > 300 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 4") elseif Nothing <= 500 and Nothing > 400 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 5") elseif Nothing <= 600 and Nothing > 500 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 6") elseif Nothing <= 700 and Nothing > 600 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 7") elseif Nothing <= 800 and Nothing > 700 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 8") elseif Nothing <= 900 and Nothing > 800 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 9") elseif Nothing <= 1000 and Nothing > 900 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 10") end end addEventHandler( "onClientRender",getRootElement(), WeaponLevels)
LiOneLMeSsIShoT Posted July 15, 2013 Author Posted July 15, 2013 it won't workstry this function WeaponLevels (killer, weapon) local Nothing = tonumber(getPedStat(killer, 69)) if Nothing <= 100 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 1") elseif Nothing <= 200 and Nothing > 100 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 2") elseif Nothing <= 300 and Nothing > 200 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 3") elseif Nothing <= 400 and Nothing > 300 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 4") elseif Nothing <= 500 and Nothing > 400 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 5") elseif Nothing <= 600 and Nothing > 500 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 6") elseif Nothing <= 700 and Nothing > 600 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 7") elseif Nothing <= 800 and Nothing > 700 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 8") elseif Nothing <= 900 and Nothing > 800 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 9") elseif Nothing <= 1000 and Nothing > 900 and weapon == 22 then guiSetText (GUIEditor.label[3], "Level: 10") end end addEventHandler( "onClientRender",getRootElement(), WeaponLevels) ERROR: :124: attempt to compare nil with number Warning: :123: Bad Argument @ 'getPedStat' :116: Bad Argument @ 'guiSetText' [Expected gui-element at argument 1,got nil :123:...Script local Nothing = tonumber(getPedStat(killer, 69)) :116: Script guiSetText( GUIEditor.label[2],"Points: "..WeaponPoints ); :116: its another function...but it was working 100% before i add this new script for levels...also i think this levels need server side or what?..please help
LiOneLMeSsIShoT Posted July 15, 2013 Author Posted July 15, 2013 at 116 be sure that the label name is correct GUIEditor.label[2] = guiCreateLabel(80, 52, 87, 17, "Points: 0", false, GUIEditor.tab[1]) It's the Label...Correct right?
LiOneLMeSsIShoT Posted July 15, 2013 Author Posted July 15, 2013 at 116 be sure that the label name is correct GUIEditor.label[2] = guiCreateLabel(80, 52, 87, 17, "Points: 0", false, GUIEditor.tab[1]) It's the Label...Correct right? look Nevermind about this script problem...it's because i was puted guisetVisible... it was making A lot of ERRORS...
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