Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- demonstration: https://gfycat.com/fairdisloyalafricanfisheagle
- local function DrawLabelText(x, y, size, text)
- SetTextFont(4)
- SetTextCentre(0)
- SetTextProportional(1)
- SetTextScale(0.0, size)
- SetTextColour(255, 255, 255, 200)
- SetTextDropShadow(0, 0, 0, 0,255)
- SetTextEdge(2, 0, 0, 0, 255)
- SetTextDropShadow()
- SetTextOutline()
- SetTextEntry("STRING")
- AddTextComponentString(text)
- DrawText(x, y)
- end
- -- ignore that
- local function GetVehicleWheelieState(vehicle)
- return Citizen.InvokeNative(GetHashKey("GET_VEHICLE_WHEELIE_STATE") & 0xFFFFFFFF, vehicle)
- end
- -- ignore that
- local function SetVehicleWheelieState(vehicle, state)
- return Citizen.InvokeNative(GetHashKey("SET_VEHICLE_WHEELIE_STATE") & 0xFFFFFFFF, vehicle, state)
- end
- local wheeliemodes = {
- [0] = "Only musclecars",
- [1] = "All vehicles",
- [2] = "Always enabled",
- [3] = "Always disabled"
- }
- local wheeeliestates = {
- [0] = "~b~Unknown~w~",
- [1] = "~b~Not wheeling~w~",
- [65] = "~y~Ready to wheelie~w~",
- [129] = "~r~They see me rollin~w~"
- }
- Citizen.CreateThread(function()
- local mode = 0
- while true do
- Wait(1)
- local veh = GetVehiclePedIsIn(PlayerPedId(), false)
- if veh ~= 0 then
- local state = GetVehicleWheelieState(veh)
- -- draw debug info
- local statetext = wheeeliestates[state] or "wtf"
- local modetext = wheeliemodes[mode] or "wtf"
- DrawLabelText(0.02, 0.505, 0.6, "~c~WHEELIE~w~")
- DrawLabelText(0.032, 0.54, 0.45, "State: " .. statetext .. "~c~ (" .. tostring(state) .. ")")
- DrawLabelText(0.032, 0.57, 0.45, "Mode: ~p~" .. modetext .. "~c~ (" .. mode .. ")")
- -- apply overrides
- if mode == 1 or mode == 2 then
- -- fixme
- if mode == 2 or (IsControlPressed(0, 76) and IsControlPressed(0, 71)) then -- space + w
- SetVehicleWheelieState(veh, 129)
- end
- -- some non-muscle vehicle can have not enough engine power to do wheelie
- -- so probably you will need to add torque/power multiplier
- if state == 129 and GetVehicleClass(veh) ~= 4 then
- --SetVehicleEngineTorqueMultiplier(veh, 1.5)
- end
- elseif mode == 3 then
- SetVehicleWheelieState(veh, 1)
- end
- -- modes switch hotkeys
- if IsControlPressed(0, 19) then -- alt
- if IsControlJustPressed(0, 174) then -- arrow left
- mode = (mode - 1 < 0) and 3 or mode - 1
- end
- if IsControlJustPressed(0, 175) then -- arrow right
- mode = (mode + 1 > 3) and 0 or mode + 1
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement