ManeXi Posted May 13, 2016 Share Posted May 13, 2016 (edited) Well I have made custom settings to disable/enable GTA:SA glitches via admin panel, it works but I use a timer to keep being able to enable/disable them on real time. Idk if it's my paranoia, but I find it pretty annoying, so my question is How can I use a "for" loop with it. This is the code: function executeGlitches() local super_sprint = get("super_sprint") local fastmove = get("fastmove") local crouchbug = get("crouchbug") local fastfire = get("fastfire") local quickstand = get("quickstand") local hitanim = get("hitanim") setGlitchEnabled ( "fastsprint", super_sprint ) setGlitchEnabled ( "fastmove", fastmove ) setGlitchEnabled ( "crouchbug", crouchbug ) setGlitchEnabled ( "fastfire", fastfire ) setGlitchEnabled ( "quickstand", quickstand ) setGlitchEnabled ( "hitanim", hitanim ) end setTimer(executeGlitches,500, 0) Edited May 17, 2016 by Guest Link to comment
denny199 Posted May 13, 2016 Share Posted May 13, 2016 Alternative you could use a command for this instead of a timer. An "for", "while" or "timers" are pretty bad for this purpose. Link to comment
Moderators IIYAMA Posted May 13, 2016 Moderators Share Posted May 13, 2016 You can't replace a timer with a for loop! But you can make the code dynamic with a "for" loop. local glitchesTable = { {"super_sprint", "fastsprint"}, {"fastmove", "fastmove"}, -- etc.! } for i=1, #glitchesTable do local glitchData = glitchesTable[i] local glitchValue = tostring(get(glitchData[1])) local glitchName = glitchData[2] if glitchValue ~= "" then setGlitchEnabled ( glitchName , glitchValue:lower() == "true" ) end end Link to comment
ManeXi Posted May 17, 2016 Author Share Posted May 17, 2016 It's ok, thanks for helping, this can be set as Solved 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