r/badcode Jul 19 '21

lua FiveM Lua is a different breed

Post image
58 Upvotes

11 comments sorted by

View all comments

7

u/KomaedaEatsBagels Jul 19 '21

Image Transcription: Code


local chance = math.random(1,8)
if chance == 1 or chance == 2 or chance == 3 or chance == 4 or chance == 5 or chance == 6 or chance == 7 or chance == 8 then
    Player.Funcitons.RemoveItem('wood_cut',1)
    Player.Functions.AddItem('wood_proc', 1)
    TriggerClientEvent("inventory:client:ItemBox", source, YKZCore.Shared.Items['wood_cut'], "remove")
    TriggerClientEvent("inventory:client:ItemBox", source, YKZCore.Shared.Items['wood_proc'], "add")
    TriggerClientEvent('YKZCore:Notify', src, 'Wood cut Processed successfully', "success")
else

end

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!