64 lines
1.3 KiB
Lua
64 lines
1.3 KiB
Lua
function GetFuel(vehicle)
|
|
return DecorGetFloat(vehicle, Config.FuelDecor)
|
|
end
|
|
|
|
function SetFuel(vehicle, fuel)
|
|
if type(fuel) == 'number' and fuel >= 0 and fuel <= 100 then
|
|
SetVehicleFuelLevel(vehicle, fuel + 0.0)
|
|
DecorSetFloat(vehicle, Config.FuelDecor, GetVehicleFuelLevel(vehicle))
|
|
end
|
|
end
|
|
|
|
function LoadAnimDict(dict)
|
|
if not HasAnimDictLoaded(dict) then
|
|
RequestAnimDict(dict)
|
|
|
|
while not HasAnimDictLoaded(dict) do
|
|
Citizen.Wait(1)
|
|
end
|
|
end
|
|
end
|
|
|
|
function Round(num, numDecimalPlaces)
|
|
local mult = 10^(numDecimalPlaces or 0)
|
|
|
|
return math.floor(num * mult + 0.5) / mult
|
|
end
|
|
|
|
function CreateBlip(coords)
|
|
local blip = AddBlipForCoord(coords)
|
|
|
|
SetBlipSprite(blip, 361)
|
|
SetBlipScale(blip, 0.9)
|
|
SetBlipColour(blip, 4)
|
|
SetBlipDisplay(blip, 4)
|
|
SetBlipAsShortRange(blip, true)
|
|
|
|
BeginTextCommandSetBlipName("STRING")
|
|
AddTextComponentString("Gas Station")
|
|
EndTextCommandSetBlipName(blip)
|
|
|
|
return blip
|
|
end
|
|
|
|
function DrawText3Ds(x, y, z, text)
|
|
local onScreen,_x,_y=World3dToScreen2d(x,y,z)
|
|
|
|
if onScreen then
|
|
SetTextScale(0.35, 0.35)
|
|
SetTextFont(4)
|
|
SetTextProportional(1)
|
|
SetTextColour(255, 255, 255, 215)
|
|
SetTextEntry("STRING")
|
|
SetTextCentre(1)
|
|
AddTextComponentString(text)
|
|
DrawText(_x,_y)
|
|
end
|
|
end
|
|
|
|
function ShowNotification(msg)
|
|
SetNotificationTextEntry('STRING')
|
|
AddTextComponentString(msg)
|
|
DrawNotification(0,1)
|
|
end
|