#snippets-and-stuff

1 messages · Page 1 of 1 (latest)

sturdy storm
#

Ohhhh

#

clean

foggy scaffold
#

what is this on right side ? what he show ?

cerulean stirrup
foggy scaffold
#

thats is in script or just he doing ?

cerulean stirrup
#

It was half made already. Not sure if he used what was already there or made more. See #racingapp-🏁 for the discussion

tribal sedge
#

anyone have a quick snip of what to put in items.lua for the racing tablet? I would appreciate it

pine jackal
#
['racing_gps'] = {
        label = 'Racing GPS',
        weight = 500,
        stack = false,
        close = true,
        description = 'Wroom wroom.',
    }, 

this is for ox

neon burrow
#

Whoever wants to fix the GPS should replace this function in:
client/main.lua :

local function updateGpsForRace(started)
deleteAllCheckpoints()

if IgnoreRoadsForGps then
    ClearGpsCustomRoute()
    StartGpsCustomRoute(Config.Gps.color, true)
else
    ClearGpsMultiRoute()
    StartGpsMultiRoute(Config.Gps.color, true, true)
end

local currentCheckpoint = CurrentRaceData.CurrentCheckpoint or 1
local lastCheckpoint = currentCheckpoint + Config.MarkAmountOfCheckpointsAhead - 1
local totalCheckpoints = #CurrentRaceData.Checkpoints
local isCircuit = CurrentRaceData.TotalLaps > 0

for i = currentCheckpoint, lastCheckpoint do
    local checkpointIndex = isCircuit and ((i - 1) % totalCheckpoints) + 1 or i
    if checkpointIndex > totalCheckpoints and not isCircuit then break end

    local checkpointData = CurrentRaceData.Checkpoints[checkpointIndex]
    local coords = checkpointData.coords

    if IgnoreRoadsForGps then
        AddPointToGpsCustomRoute(coords.x, coords.y, coords.z or 0.0)
    else
        AddPointToGpsMultiRoute(coords.x, coords.y, coords.z or 0.0)
    end

    local pileModel = isFinishOrStart(checkpointIndex) and StartAndFinishModel or CheckpointPileModel
    checkpointData.pileleft = createPile(checkpointData.offset.left, pileModel)
    checkpointData.pileright = createPile(checkpointData.offset.right, pileModel)

    if checkpointData.blip then
        SetBlipDisplay(checkpointData.blip, 2) 
        ShowHeightOnBlip(checkpointData.blip, true) 
    end
end

if IgnoreRoadsForGps then
    SetGpsCustomRouteRender(ShowGpsRoute, 16, 16)
else
    SetGpsMultiRouteRender(ShowGpsRoute, 16, 16)
end

end

#

before :

#

after :

#

@cerulean stirrup

agile niche
#

Made cw-tuning work with qb-inventory and implemented cw-rep into the system for item using your can disable by commenting out the check.

-- Your performance items goes here to server.lua
local perfoItems = {
    "turbo1",
    "turbo2",
    "turbo3",
    "turbo4",
    "emuffler1",
    "emuffler2",
    "emuffler3",
    "crankshaft1",
    "crankshaft2",
    "crankshaft3",
    "intercooler1",
    "intercooler2",
    "intercooler3",
    "ecu1",
    "ecu2",
    "ecu3",
    "brakes1",
    "brakes2",
    "brakes3",
    "autotrans",
    "manualtrans",
    "clutch1",
    "clutch2",
    "clutch3",
    "tyres1",
    "tyres2",
    "tyres3",
    "antiroll1",
    "antiroll2",
    "antiroll3",
    "weightreduction1",
    "weightreduction2",
    "weightreduction3",
}
-- Add this into server.lua
for k, v in pairs(perfoItems) do
    QBCore.Functions.CreateUseableItem(v, function(source, item)
        local src = source
        local Player = QBCore.Functions.GetPlayer(src)
        local playerSkill = exports["cw-rep"]:fetchSkills(src)
        local metadata = item.info
        if Player.Functions.GetItemByName(item.name) then
            if metadata and metadata.ptype and metadata.variant and metadata.skill then
                if metadata.skill > playerSkill['underground'] then
                    TriggerClientEvent('QBCore:Notify', src, 'You lack '..(metadata.skill - playerSkill['underground'])..' skill points to use this part.', 'error')
                    return
                end
                if metadata.tier then
                    TriggerClientEvent('cw-tuning:client:addTuningPart', src, metadata.ptype, metadata.variant, metadata.tier, item.name)
                    TriggerEvent('qb-log:server:CreateLog', "tuning", "Tuning Part Used", "red", "**Part:** "..getVariantName(metadata.variant).." T"..metadata.tier.." "..getTypeName(metadata.ptype).." | **Item:** "..item.name .. " | **Player Name:** " .. GetPlayerName(src) .. " | **Player ID:** " .. src .. " | **Skill:** " .. playerSkill['underground'] .. " | **Player Citizen ID:** " .. Player.PlayerData.citizenid)
                else
                    TriggerClientEvent('cw-tuning:client:addTuningPart', src, metadata.ptype, metadata.variant, nil, item.name)
                    TriggerEvent('qb-log:server:CreateLog', "tuning", "Tuning Part Used", "red", "**Part:** "..getVariantName(metadata.variant).." "..getTypeName(metadata.ptype).." | **Item:** "..item.name .. " | **Player Name:** " .. GetPlayerName(src) .. " | **Player ID:** " .. src .. " | **Skill:** " .. playerSkill['underground'] .. " | **Player Citizen ID:** " .. Player.PlayerData.citizenid)
                end
            else
                TriggerClientEvent('QBCore:Notify', src, 'Error with part data.', 'error')
            end
        else
            TriggerClientEvent('QBCore:Notify', src, 'Item not found in inventory.', 'error')
        end
    end)
end
-- Remove Item event into server.lua
RegisterNetEvent('cw-tuning:server:removeTuningPart', function(item)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    Player.Functions.RemoveItem(item, 1)
    TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[item], 'remove', 1)
end)
Add item argument to addTuningPart(ptype, variant, tier, isMechanic, vehicle, item)
-- Add this into addTuningPart function in client.lua right before 'cw-tuning:server:setMods'
TriggerServerEvent('cw-tuning:server:removeTuningPart', item)
-- Extra check for item validation before setting mods add right on finishing the progress bar 
        if not QBCore.Functions.HasItem(item) then
             notify('You do not have the item', 'error') 
            Entity(vehicle).state:set('workedOn', false, true)
             return end
#
-- Add skill into item info when creating for example I'm creating the items using cw-crafting
    ['turbo1'] = {
        category = "Turbo Tuning",
        toItems = {
            turbo1 = 1,
        },
        materials = {
            turboblock = 1, turbosegment = 3, turbocomponent = 1, alloy = 2, bolts = 4,
        },
        craftingTime= 10000,
        metadata = {
            ptype = 'turbo',
            variant = 'TurboCharger',
            skill = 1000,
            tier = '1',
        },
        skillName = 'underground',
        craftingSkill= 1000,
        customSkillGain = 25,
        maxCraft = 1,
        tables = {'underground'},
    },
daring narwhal
#

racing_gps image already scaled too 100x100 Smile

cerulean stirrup
cerulean stirrup
#

It's already in, but thanks salut

empty ruin
#

Anyone managed to get cw-performance working with garages? for example, showing the class of the vehicle in the label?

terse lagoon
empty ruin
terse lagoon
cerulean stirrup
terse lagoon
#

i think you only need to forward spawncode since it pulls data from handling.meta

empty ruin
#

Okay, thank you for your help both

I'll do some testing and post a snippet if I get it working reliably

terse lagoon
#

i think debug print is making it fail

#

and maybe getvehicleacceleration native since it may require entity to exist on client to get that data

cerulean stirrup
#

I suggest always checking if entity exists before calling the export

terse lagoon
#

but again those are only for debug prints

cerulean stirrup
terse lagoon
#

ive just tested these natives and confirmed that entity has to be spawned in for calculation to work properly, with that being said, i would store this information in the database alongside with vehicle before vehicle gets despawned and "put in garage" as suggested earlier

issue is if you want realistic representation of vehicle class because native for GetVehicleAcceleration changes depending on current upgrades on the vehicle

impact on the calculation should not be too major but in some edge cases it might show different class depending if car has upgrades or not

cerulean stirrup
#

Turbo adds a shit ton to the PI

#

And even then, that still uses turbos from gta - which are so fucking broken

terse lagoon
#

dno how you are applying values and which values you are applying to the vehicle with those upgrades but i know that, before at least, some values did not apply correctly/consistently to vehicles, maybe they fixed it in later versions although i did not test them in a while

i think i was using SetVehicleHandlingFloat/Int/Field variants and eventually just gave up since it was really inconsistent with multiple people in the server

cerulean stirrup
#

That's how they are applied in Tuning. Syncing has been one of the main issues. But we've seen very few issues the past months.

Our version is leaps ahead of the Tuning that's released tho