Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print('Script loaded')
- function changeLivery(vehicle) -- Function to change the livery
- print('changeLivery function loaded')
- -- It changes the livery between the first one (0), to the 10th one (9)
- if livery < 9 then -- If the current livery is between 0 and 8 (we are still able to go further)
- livery = livery + 1 -- So we change to the next one
- else if livery == 9 then -- If the current livery is the last one (9)
- livery = 0 -- Since we can't change to the nexxt one (cause the next is 10, which does not exist), we change it back to 0 (first one)
- end
- SetVehicleLivery(vehicle, livery) -- Native function to set the livery of the vehicle to the above specified livery
- print('Livery should''ve been changed now')
- DisplayHelpText("~b~Livery ~g~Changed.") -- Success message
- end
- Citizen.CreateThread(function()
- while true do -- Loop that triggers the livery changer function
- print('The script is OK')
- Wait(0)
- ped = GetPlayerPed(-1)
- if IsPedInAnyVehicle(ped, false) then -- Only be able to change the livery if the player is in a vehicle
- print('Vehicle enter event TRIGGERED')
- vehicle = GetVehiclePedIsUsing(ped) -- Get the player vehicle's entity
- livery = GetVehicleLivery(vehicle) -- Current livery
- if IsControlJustPressed(1, 182) then -- If player presses the L key
- print('L key press event TRIGGERED')
- changeLivery(vehicle) -- The livery changer function gets triggered, on the player's vehicle
- else
- DisplayHelpText("~b~You must be in a vehicle in order to change your livery!") -- Error message
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement