#cw-racingapp- Error copying checkpoint

1 messages · Page 1 of 1 (latest)

slender musk
#

When you select a race from the interface and copy the checkpoints, it doesn't do anything. It only allows you to enter the race coordinates by copying them from the database. Even copying them from the database doesn't allow you to create the new track. Below is a video showing the error it displays in this location (@cw-racingapp/web/dist/assets/index-qZMRHULT.js:13).

Excellent work with the new UI.

slender musk
#

cw-racingapp- Error copying checkpoint

slender musk
#

I have tried to recompile the code but the error still persists. I think it is necessary to review that part of the source code since it is obfuscated and nothing can be done.

idle reef
#

Nothing in the script is obfuscated haha. It's fully open source.

I'll have a look when I have time 👍

slender musk
#

After yesterday's update, the cheatpoint copying section works, but the confirm button is not working and shows this error in the new build.

idle reef
#

I don't get that print, but I found the solution for the error pepe_taking_notes

idle reef
#

Pushed a fix for this

#

was just missing the name in the data 😅

slender musk
#

now this is excellent broh thanks💪

slender musk
#

hey men
Some people on my server have suggested reducing the number of pillars to one, since having three pillars makes them more visible.

I've made several changes so that you can set the number of pillars displayed in the path from the config, in case you want to add that to the main code.

#

Add this to the config.lua variable:

Config.UseDrawTextWaypoint = true
Config.DrawTextSetup = {
markerType = 1,
minHeight = 1.0,
maxHeight = 100.0,
baseSize = 0.1,
markerColor = { r = 255, g = 255, b = 255, a = 200 },
distanceColor = { r = 0, g = 255, b = 0, a = 255 },
primaryColor = { r = 255, g = 0, b = 250, a = 255 },
maxPillars = 1 --: Number of pillars to display
}

#

Modify the getUpcomingCheckpoints() function in main.lua

local function getUpcomingCheckpoints()
local coord1, coord2, coord3, coord4, coord5
local coord1Label, coord2Label, coord3Label, coord4Label, coord5Label
local totalCheckpoints = #CurrentRaceData.Checkpoints
local currentIndex = CurrentRaceData.CurrentCheckpoint + 1
local checkpoints = {}
local maxPillars = Config.DrawTextSetup.maxPillars or 3

if CurrentRaceData.Lap < 2 and CurrentRaceData.CurrentCheckpoint == 1 then
    checkpoints[1] = {
        coord = vector3(
            CurrentRaceData.Checkpoints[1].coords.x,
            CurrentRaceData.Checkpoints[1].coords.y,
            CurrentRaceData.Checkpoints[1].coords.z
        ),
        label = Lang('starting_line')
    }
end

for i = 1, maxPillars do
    local coord = getCheckpointCoord(currentIndex + i - 1, totalCheckpoints)
    if coord then
        local label
        if i == 1 then
            label = getFinishLabel(totalCheckpoints, currentIndex) or Lang("checkpoint_next")
        elseif i == 2 then
            label = getFinishLabel(totalCheckpoints, currentIndex + 1) or Lang("checkpoint_2nd")
        elseif i == 3 then
            label = getFinishLabel(totalCheckpoints, currentIndex + 2) or Lang("checkpoint_3rd")
        else
            label = Lang("checkpoint") .. " " .. i 
        end
        
        checkpoints[#checkpoints + 1] = { coord = coord, label = label }
    end
end

return checkpoints

end

#

Also modify the markWithDrawTextWaypoint() function

local function markWithDrawTextWaypoint()
if UseDrawTextWaypoint then
CreateThread(function()
while true and RaceData.InRace do
local playerPed = PlayerPedId()
local playerCoords = GetEntityCoords(playerPed)

            local checkpoints = getUpcomingCheckpoints()

            for i, checkpoint in ipairs(checkpoints) do
                local distance = #(playerCoords - checkpoint.coord)
                local height = math.min(MaxHeight, math.max(MinHeight, distance / 2.5))

                DrawRacingMarker(checkpoint.coord, height)

                local baseTextHeight = checkpoint.coord.z + height
                local labelHeight = baseTextHeight + 0.7 + height * 0.05
                local distanceHeight = baseTextHeight + 0.5

                local color = DistanceColor
                if i == 1 or i == 2 then 
                    color = PrimaryColor 
                end

                local labelCoords = vector3(checkpoint.coord.x, checkpoint.coord.y, labelHeight)
                Draw3DText(labelCoords, checkpoint.label, 0.25, color)

                local distanceCoords = vector3(checkpoint.coord.x, checkpoint.coord.y, distanceHeight)
                Draw3DText(distanceCoords, string.format("%.0fm", distance), 0.5, DistanceColor)
            end

            Wait(0)
        end
    end)
end

end

#

and improve the getCheckpointCoord() function
local function getCheckpointCoord(index, totalCheckpoints)
if index > totalCheckpoints + (#CurrentRaceData.Checkpoints * (CurrentRaceData.TotalLaps - 1)) then
return nil
end

if CurrentRaceData.TotalLaps == 0 then
    if index > totalCheckpoints then
        return nil
    end
    return vector3(
        CurrentRaceData.Checkpoints[index].coords.x,
        CurrentRaceData.Checkpoints[index].coords.y,
        CurrentRaceData.Checkpoints[index].coords.z
    )
else
    local actualIndex = ((index - 1) % totalCheckpoints) + 1
    return vector3(
        CurrentRaceData.Checkpoints[actualIndex].coords.x,
        CurrentRaceData.Checkpoints[actualIndex].coords.y,
        CurrentRaceData.Checkpoints[actualIndex].coords.z
    )
end

end