Statebags

As mentioned previously, chaser is synced and uses statebags to do so, chaser statebags are as follow:

currentgear

This Statebag is responsible for keeping the data necessary for transmission syncronization, alongside the current vehicle gear, and you can access it to show the current gear on your speedometer

gear = Entity(entity).state.currentgear[1]

currentengine

This Statebag is responsible for keeping the data necessary for engine syncronization, alongside the current audiohash, and you can access it to show the current gear on your speedometer

currentengine = Entity(entity).state.currentengine[1]
currentaudiohash = Entity(entity).state.currentengine[2]

dumpvalvefired

A State bag which can be used to playback a dumpvalve sound when chaser turbo system dumpvalve is fired using statebagchangehandler example:

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