DRW Posted May 9, 2015 Posted May 9, 2015 I tried to remove negative money by doing this: local money = getPlayerMoney (source) addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), function () setTimer (function () if (money < 0) then setPlayerMoney (source, 0) end end end), 10000,0) Not working, says that is a ) expected to close function in line 4 ( I try to make it another way but it's not working, edited a lot of times and still giving me errors... What can I do?
xTravax Posted May 9, 2015 Posted May 9, 2015 wtf you talking unpredictable?plz stop addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), function () setTimer (function () local money = getPlayerMoney (localPlayer) if (money < 0) then setPlayerMoney (localPlayer, 0) end end, 10000,0) end)
DRW Posted May 9, 2015 Author Posted May 9, 2015 wtf you talking unpredictable?plz stop addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource()), function () setTimer (function () local money = getPlayerMoney (localPlayer) if (money < 0) then setPlayerMoney (localPlayer, 0) end end, 10000,0) end) God dammit, I'm an idiot, I combined serverside and clientside things, lol. Thank you so much
WhoAmI Posted May 9, 2015 Posted May 9, 2015 It won't work. addEventHandler ("onClientResourceStart", resourceRoot, function () setTimer (function () local money = getPlayerMoney () if (money < 0) then setPlayerMoney (0) end end, 10000,0) end) I prefer you to do this s-side like that addEventHandler ("onResourceStart", resourceRoot, function () setTimer (function () for _, player in pairs ( getElementsByType ( "player" ) ) do local money = getPlayerMoney (player) if (money < 0) then setPlayerMoney (player, 0) end end end, 10000,0) end)
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