Hello, I am creating a siren controller but when I want to create a decorator it does not work.
My code ↓
local sirenControl = {}
sirenControl.config = nil
CreateThread(function()
if not DecorIsRegisteredAsType("sirenControl.state", 2) then
DecorRegister("sirenControl.state", 2)
end
RegisterKeyMapping('sirenControl.active', '[~r~Véhicule Urgence~s~] Activer/Désactiver la sirène.', 'keyboard', 'LMENU')
RegisterCommand("sirenControl.active", function()
local playerPed = PlayerPedId()
if (playerPed == 0 or not DoesEntityExist(playerPed)) then
return
end
local playerVehicle = GetVehiclePedIsIn(playerPed, false)
if (playerVehicle == 0) then
return
end
--local vehicleModel = GetEntityModel(playerVehicle)
--local findModel = false
--for i = 1, #sirenControl.config.vehicle do
-- local currentModel = GetHashKey(sirenControl.config.vehicle[i])
-- if (currentModel == vehicleModel) then
-- findModel = true
-- end
--end
--
--if (not findModel) then
-- return
--end
if (not DecorExistOn(playerVehicle, "sirenControl.state")) then
DecorSetBool(playerVehicle, "sirenControl.state", true)
print("DecorSetBool", playerVehicle, "sirenControl.state", true)
end
print("GO CHECK CURRENT STATE")
local currentSirensState = DecorGetBool(playerVehicle, "sirenControl.state")
print("DecorGetBool", playerVehicle, "sirenControl.state", currentSirensState)
end)
end)