Events & Exports

Server Events

rm_decalv2:server:onDecalAdded

AddEventHandler('rm_decalv2:server:onDecalAdded', function(data)
    if data.type == 'graffiti' then
        -- print(data.source)
        -- print(data.fileName)
        -- print(vec3(data.posX, data.posY, data.posZ))
    elseif data.type == 'sticker' then
        -- print(data.source)
        -- print(data.fileName)
        -- print(data.plate)
    end
end)

rm_decalv2:server:onDecalRemoved

AddEventHandler('rm_decalv2:server:onDecalRemoved', function(data)
    if data.type == 'graffiti' then
        -- print(data.source)
        -- print(data.fileName)
        -- print(vec3(data.posX, data.posY, data.posZ))
    elseif data.type == 'sticker' then
        -- print(data.source)
        -- print(data.fileName)
        -- print(data.plate)
    end
end)

Server Exports

If the vehicle stickers are not properly placed after you have put your vehicle in and out of the garage, place this function under the vehicle creation event of your garage script.

initializeStickers

exports['rm_decalv2']:initializeStickers(vehicle--[[entity]])

Example: qb_garages/server/main.lua

QBCore.Functions.CreateCallback('qb-garages:server:spawnvehicle', function(source, cb, plate, vehicle, coords)
    local vehType = QBCore.Shared.Vehicles[vehicle] and QBCore.Shared.Vehicles[vehicle].type or GetVehicleTypeByModel(vehicle)
    local veh = CreateVehicleServerSetter(GetHashKey(vehicle), vehType, coords.x, coords.y, coords.z, coords.w)
    local netId = NetworkGetNetworkIdFromEntity(veh)
    SetVehicleNumberPlateText(veh, plate)
    local vehProps = {}
    local result = MySQL.rawExecute.await('SELECT mods FROM player_vehicles WHERE plate = ?', { plate })
    if result and result[1] then vehProps = json.decode(result[1].mods) end
    OutsideVehicles[plate] = { netID = netId, entity = veh }
    cb(netId, vehProps, plate)
    
    exports['rm_decalv2']:initializeStickers(veh)
end)

Last updated