Statebags
currentgear
gear = Entity(entity).state.currentgear[1]currentengine
currentengine = Entity(entity).state.currentengine[1]
currentaudiohash = Entity(entity).state.currentengine[2]dumpvalvefired
AddStateBagChangeHandler("dumpvalvefired", nil, function(bagName, key, value)
local entity = GetEntityFromStateBagName(bagName)
if DoesEntityExist(GetPedInVehicleSeat(entity, -1)) then
local dumpvalve = value
if entity ~= 0 and GetPedInVehicleSeat(vehicle, -1) ~= player then
if dumpvalve == true then -- if dumpvalve was fired
PlayTurboSound("dumpvalve_01") -- here you call your function to play your dumpvalve sound
Entity(entity).state:set('dumpvalvefired',false,true) -- set the state to false again, for the
next release.
end
end
end)Last updated