Hey, how can I create an LUA loop similar to the jump "command" in Cleo?
This code works fine, but only one time, then I need to use the command again...
Is there a way to loop it? If yes, how?
I've tried codes like this:
But I think I used them wrong, as the script wouldn't work anymore.
:sadpepe:
Code:
script_name('HealthRefill')
script_author('Mila, example by FYP')
--- Config
cheatToggle = 'refill'
--- Main
function main()
while true do
wait(0)
if isPlayerPlaying(playerHandle) then
if testCheat(cheatToggle) then
activated = not activated
printStringNow('HealthRefill' .. (activated and '~g~activated' or '~r~deactivated') .. '.~n~~y~Made by Mila~n~~w~Ugbase.eu', 2000)
if activated then
setCharHealth(playerPed, 100)
end
end
end
end
end
end
This code works fine, but only one time, then I need to use the command again...
Is there a way to loop it? If yes, how?
I've tried codes like this:
Code:
i = 1
repeat
i = i + 1
until i > 5
:sadpepe: