kewizzle Posted April 2, 2017 Share Posted April 2, 2017 my progress bar doesnt change to my weapon stat stays frozen at the first number it was set to. client local stat8 = getPlayerStat (getLocalPlayer(),77) addEventHandler("onClientGUIClick", ak47B, function() if source == ak47B then triggerServerEvent ("setAK471",getLocalPlayer(),setAK471) guiProgressBarSetProgress(ak47Pr,tonumber(stat8/10)) end end) end) server addEvent("setAK471",true) addEventHandler("setAK471",root, function() if getPlayerStat(source,77) == 0 and getPlayerMoney(source) >= getPlayerStat(source,77) + 2500 then takePlayerMoney(source, getPlayerStat(source,77) + 2500) setPlayerStat(source, 77, 100) else if getPlayerStat(source,77) == 100 and getPlayerMoney(source) >= getPlayerStat(source,77) + 2500 then takePlayerMoney(source, getPlayerStat(source,77) + 2500) setPlayerStat(source, 77, 200) else if getPlayerStat(source,77) == 200 and getPlayerMoney(source) >= getPlayerStat(source,77) + 2500 then takePlayerMoney(source, getPlayerStat(source,77) + 2500) setPlayerStat(source, 77, 300) else if getPlayerStat(source,77) == 300 and getPlayerMoney(source) >= getPlayerStat(source,77) + 2500 then takePlayerMoney(source, getPlayerStat(source,77) + 2500) setPlayerStat(source, 77, 400) else if getPlayerStat(source,77) == 400 and getPlayerMoney(source) >= getPlayerStat(source,77) + 2500 then takePlayerMoney(source, getPlayerStat(source,77) + 2500) setPlayerStat(source, 77, 500) else if getPlayerStat(source,77) == 500 and getPlayerMoney(source) >= getPlayerStat(source,77) + 2500 then takePlayerMoney(source, getPlayerStat(source,77) + 2500) setPlayerStat(source, 77, 600) else if getPlayerStat(source,77) == 600 and getPlayerMoney(source) >= getPlayerStat(source,77) + 2500 then takePlayerMoney(source, getPlayerStat(source,77) + 2500) setPlayerStat(source, 77, 700) else if getPlayerStat(source,77) == 700 and getPlayerMoney(source) >= getPlayerStat(source,77) + 2500 then takePlayerMoney(source, getPlayerStat(source,77) + 2500) setPlayerStat(source, 77, 800) else if getPlayerStat(source,77) == 800 and getPlayerMoney(source) >= getPlayerStat(source,77) + 2500 then takePlayerMoney(source, getPlayerStat(source,77) + 2500) setPlayerStat(source, 77, 900) else if getPlayerStat(source,77) == 900 and getPlayerMoney(source) >= getPlayerStat(source,77) + 2500 then takePlayerMoney(source, getPlayerStat(source,77) + 2500) setPlayerStat(source, 77, 1000) else if getPlayerStat(source,77) == 1000 then outputChatBox("You maxed out your AK-47!",source,0,255,0) else local pMoney = getPlayerStat(source,77) local convertedMoney = convertNumber(pMoney + 2500) outputChatBox("$"..convertedMoney.." required to purchase this skill!",source,255,0,0) end end end end end end end end end end end end) Link to comment
MIKI785 Posted April 3, 2017 Share Posted April 3, 2017 The code is a mess but I guess the problem is that you're not updating stat8. Just move local stat8 = getPlayerStat (getLocalPlayer(),77) into the event handler before guiProgressBarSetProgress. Link to comment
NanoBob Posted April 4, 2017 Share Posted April 4, 2017 Also if you write elseif as one word you will only need one end to end your entire if statement. Link to comment
kewizzle Posted April 4, 2017 Author Share Posted April 4, 2017 7 hours ago, NanoBob said: Also if you write elseif as one word you will only need one end to end your entire if statement. i just learned this 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