Jump to content

need help


Recommended Posts

hi all,

i need an expert scripter to can solve my problem pls , pls help me , in /debugscript 3 i have this errors :

1) o22.png

-- race_client.lua

        g_Root = getRootElement() 
        g_ResRoot = getResourceRootElement(getThisResource())
        g_Me = getLocalPlayer()
        g_ArmedVehicleIDs = table.create({ 425, 447, 520, 430, 464, 432 }, true)
        g_WaterCraftIDs = table.create({ 539, 460, 417, 447, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454 }, true)
        g_ModelForPickupType = { nitro = 2221, repair = 2222, vehiclechange = 2223 }
        g_HunterID = 425
         
        g_Checkpoints = {}
        g_Pickups = {}
        g_VisiblePickups = {}
        g_Objects = {}
         
         
        function setNextMap ( mapname )
        g_NextMap = mapname
        end
        addEvent ( "setNextMap", true )
        addEventHandler ( "setNextMap", getRootElement(), setNextMap )
         
         
        addEventHandler('onClientResourceStart', g_ResRoot,
            function()
                g_Players = getElementsByType('player')
               
                exports.scoreboard:scoreboardSetSortBy("race rank")
               
                fadeCamera(false,0.0)
                -- create GUI
                local screenWidth, screenHeight = guiGetScreenSize()
                g_dxGUI = {
                    checkpoint = dxText:create('0/0', screenWidth - 15, screenHeight - 254, false, 'bankgothic', 0.8, 'right'),
                    --
                    mapdisplay = dxText:create('Map: ', 2, screenHeight - dxGetFontHeight(0.4, 'bankgothic'), false, 'bankgothic', 0.6, 'left'),
                    mapdisplayName = dxText:create('-', 55, screenHeight - dxGetFontHeight(0.4, 'bankgothic'), false, 'bankgothic',0.6, 'left'),
                    --
                    nextdisplay = dxText:create('Next Map: ', 2, screenHeight - dxGetFontHeight(0.4, 'bankgothic'), false, 'bankgothic', 0.6, 'left'),
                    nextdisplayName = dxText:create('-', 100, screenHeight - dxGetFontHeight(0.4, 'bankgothic'), false, 'bankgothic', 0.6, 'left'),
                    --
                    }
                g_dxGUI.checkpoint:color(0,170,70,255)
                g_dxGUI.mapdisplay:color(0,170,70,255)
                g_dxGUI.mapdisplayName:color(255,255,255,255)
                g_dxGUI.mapdisplay:type('shadow', 1, 0, 0, 0, 255)
                g_dxGUI.mapdisplayName:type('shadow', 1, 0, 0, 0, 255)
                g_dxGUI.nextdisplay:color(0,170,70,255)
                g_dxGUI.nextdisplayName:color(255, 255, 255, 255)
                g_dxGUI.nextdisplay:type('shadow', 1, 0, 0, 0, 255)
                g_dxGUI.nextdisplayName:type('shadow', 1, 0, 0, 0, 255)
                g_dxGUI.nextdisplay:visible(false)
                g_dxGUI.nextdisplayName:visible(false)    
                g_dxGUI.checkpoint:type('shadow', 2, 0, 0, 0, 255)
                g_GUI = {
                    timeleftbg = guiCreateStaticImage(screenWidth/2-65, 0, 165, 50, 'img/timeleft.png', false, nil),
                    timeleft = guiCreateLabel(screenWidth/2-70, 24, 100, 30, '', false),
                    timepassed = guiCreateLabel(screenWidth/2+38, 24, 100, 30, '', false),
                }
                guiSetFont(g_GUI.timeleft, 'default-bold-small')
                guiSetFont(g_GUI.timepassed, 'default-bold-small')
                guiLabelSetHorizontalAlign(g_GUI.timeleft, 'center')
                --g_GUI.speedbar:setProgress(0)
               
                hideGUIComponents('timeleftbg', 'timeleft', 'healthbar', 'ranknum', 'ranksuffix', 'checkpoint', 'timepassed')
                RankingBoard.precreateLabels(10)
                -- set update handlers
                g_PickupStartTick = getTickCount()
                addEventHandler('onClientRender', g_Root, updateBars)
                g_WaterCheckTimer = setTimer(checkWater, 1000, 0)
               
                -- load pickup models and textures
                for name,id in pairs(g_ModelForPickupType) do
                    engineImportTXD(engineLoadTXD('model/' .. name .. '.txd'), id)
                    engineReplaceModel(engineLoadDFF('model/' .. name .. '.dff', id), id)
                    -- Double draw distance for pickups
                    engineSetModelLODDistance( id, 60 )
                end
         
                if isVersion101Compatible() then
                    -- Dont clip vehicles (1.0.1 function)
                    setCameraClip ( true, false )
                end
         
                -- Init presentation screens
                TravelScreen.init()
                TitleScreen.init()
         
                -- Show title screen now
                TitleScreen.show()
         
                setPedCanBeKnockedOffBike(g_Me, false)
            end
        )
         
         
        -------------------------------------------------------
        -- Title screen - Shown when player first joins the game
        -------------------------------------------------------
        TitleScreen = {}
        TitleScreen.startTime = 0
         
        function TitleScreen.init()
            local screenWidth, screenHeight = guiGetScreenSize()
            local adjustY = math.clamp( -30, -15 + (-30- -15) * (screenHeight - 480)/(900 - 480), -15 );
            g_GUI['titleImage'] = guiCreateStaticImage(screenWidth/2-256, screenHeight/2-256+adjustY, 512, 512, 'img/title.png', false)
            g_dxGUI['titleText1'] = dxText:create('', 30, screenHeight-77, false, 'bankgothic', 0.60, 'left' )
            g_dxGUI['titleText2'] = dxText:create('', 120, screenHeight-77, false, 'bankgothic', 0.60, 'left' )
            g_dxGUI['titleText1']:text( 'KEYS: \n' ..
                                        'F9 \n' ..
                                        'F5 \n' ..
                                        'ENTER' )
            g_dxGUI['titleText2']:text( '\n' ..
                                        '- HELP \n' ..
                                        '- TOP TIMES \n' ..
                                        '- SUICIDE' )
            hideGUIComponents('titleImage','titleText1','titleText2')
        end
         
        function TitleScreen.show()
            showGUIComponents('titleImage','titleText1','titleText2')
            guiMoveToBack(g_GUI['titleImage'])
            TitleScreen.startTime = getTickCount()
            TitleScreen.bringForward = 0
            addEventHandler('onClientRender', g_Root, TitleScreen.update)
        end
         
        function TitleScreen.update()
            local secondsLeft = TitleScreen.getTicksRemaining() / 1000
            local alpha = math.min(1,math.max( secondsLeft ,0))
            guiSetAlpha(g_GUI['titleImage'], alpha)
            g_dxGUI['titleText1']:color(220,220,220,255*alpha)
            g_dxGUI['titleText2']:color(220,220,220,255*alpha)
            if alpha == 0 then
                hideGUIComponents('titleImage','titleText1','titleText2')
                removeEventHandler('onClientRender', g_Root, TitleScreen.update)
            end
        end
         
        function TitleScreen.getTicksRemaining()
            return math.max( 0, TitleScreen.startTime - TitleScreen.bringForward + 10000 - getTickCount() )
        end
         
        -- Start the fadeout as soon as possible
        function TitleScreen.bringForwardFadeout(maxSkip)
            local ticksLeft = TitleScreen.getTicksRemaining()
            local bringForward = ticksLeft - 1000
            outputDebug( 'MISC', 'bringForward ' .. bringForward )
            if bringForward > 0 then
                TitleScreen.bringForward = math.min(TitleScreen.bringForward + bringForward,maxSkip)
                outputDebug( 'MISC', 'TitleScreen.bringForward ' .. TitleScreen.bringForward )
            end
        end
        -------------------------------------------------------
         
         
        -------------------------------------------------------
        -- Travel screen - Message for client feedback when loading maps
        -------------------------------------------------------
        TravelScreen = {}
        TravelScreen.startTime = 0
         
        function TravelScreen.init()
            local screenWidth, screenHeight = guiGetScreenSize()
            g_GUI['travelImage']   = guiCreateStaticImage(screenWidth/2-256, screenHeight/2-20, 512, 256, 'img/travelling.png', false, nil)
            g_dxGUI['travelText1'] = dxText:create('Switching map to:', screenWidth/2, screenHeight/2-130, false, 'bankgothic', 0.6, 'center' )
            g_dxGUI['travelText2'] = dxText:create('', screenWidth/2, screenHeight/2-100, false, 'bankgothic', 0.70, 'center' )
            g_dxGUI['travelText3'] = dxText:create('', screenWidth/2, screenHeight/2-40, false, 'bankgothic', 0.70, 'center' )
            g_dxGUI['travelText4'] = dxText:create('', screenWidth/2, screenHeight/2-70, false, 'bankgothic', 0.6, 'center' )
            g_dxGUI['travelText1']:color(0,170,70)
            g_dxGUI['travelText4']:color(0,170,70)
            hideGUIComponents('travelImage', 'travelText1', 'travelText2', 'travelText3', 'travelText4')
        end
         
        function TravelScreen.show( mapName, authorName )
            TravelScreen.startTime = getTickCount()
            g_dxGUI['travelText2']:text(mapName)
            g_dxGUI['travelText3']:text(authorName and "" .. authorName or "")
            g_dxGUI['travelText4']:text(authorName and "Author:" or "")
            showGUIComponents('travelImage', 'travelText1', 'travelText2', 'travelText3', 'travelText4')
            guiMoveToBack(g_GUI['travelImage'])
        end
         
        function TravelScreen.hide()
            hideGUIComponents('travelImage', 'travelText1', 'travelText2', 'travelText3', 'travelText4')
        end
         
        function TravelScreen.getTicksRemaining()
            return math.max( 0, TravelScreen.startTime + 3000 - getTickCount() )
        end
        -------------------------------------------------------
         
         
        -- Called from server
        function notifyLoadingMap( mapName, authorName )
            fadeCamera( false, 0.0, 0,0,0 ) -- fadeout, instant, black
            TravelScreen.show( mapName, authorName )
        end
         
         
        -- Called from server
        function initRace(vehicle, checkpoints, objects, pickups, mapoptions, ranked, duration, gameoptions, mapinfo, playerInfo)
            outputDebug( 'MISC', 'initRace start' )
            unloadAll()
           
            exports.scoreboard:scoreboardSetSortBy("race rank")
           
            g_Players = getElementsByType('player')
            g_MapOptions = mapoptions
            g_GameOptions = gameoptions
            g_MapInfo = mapinfo
            g_PlayerInfo = playerInfo
            triggerEvent('onClientMapStarting', g_Me, mapinfo )
            ShowingNext(false)
           
            g_dxGUI.mapdisplay:text("Map: ")
            g_dxGUI.mapdisplayName:text(g_MapInfo.name)
           
            fadeCamera(true)
            showHUD(false)
           
            g_Vehicle = vehicle
            setVehicleDamageProof(g_Vehicle, true)
            OverrideClient.updateVars(g_Vehicle)
           
            --local x, y, z = getElementPosition(g_Vehicle)
            setCameraBehindVehicle(vehicle)
            --alignVehicleToGround(vehicle)
            updateVehicleWeapons()
            setCloudsEnabled(g_GameOptions.cloudsenable)
            setBlurLevel(g_GameOptions.blurlevel)
            g_dxGUI.mapdisplay:visible(g_GameOptions.showmapname)
            g_dxGUI.mapdisplayName:visible(g_GameOptions.showmapname)
            if engineSetAsynchronousLoading then
                engineSetAsynchronousLoading( g_GameOptions.asyncloading )
            end
         
            -- checkpoints
            g_Checkpoints = checkpoints
           
            -- pickups
            local object
            local pos
            local colshape
            for i,pickup in pairs(pickups) do
                pos = pickup.position
                object = createObject(g_ModelForPickupType[pickup.type], pos[1], pos[2], pos[3])
                setElementCollisionsEnabled(object, false)
                colshape = createColSphere(pos[1], pos[2], pos[3], 3.5)
                g_Pickups[colshape] = { object = object }
                for k,v in
Link to comment

race client ..

g_Root = getRootElement() 
g_ResRoot = getResourceRootElement(getThisResource())
g_Me = getLocalPlayer()
g_ArmedVehicleIDs = table.create({ 425, 447, 520, 430, 464, 432 }, true)
g_WaterCraftIDs = table.create({ 539, 460, 417, 447, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454 }, true)
g_ModelForPickupType = { nitro = 2221, repair = 2222, vehiclechange = 2223 }
g_HunterID = 425
local localPlayer = getLocalPlayer()
local root = getRootElement()
local resRoot = getResourceRootElement(getThisResource())
local screenWidth, screenHeight = guiGetScreenSize()
 
g_Checkpoints = {}
g_Pickups = {}
g_VisiblePickups = {}
g_Objects = {}
fontX = nil
sW, sH = guiGetScreenSize()
 
local imageX,imageY = 325,150
local scaleX,scaleY = screenWidth/1920,screenHeight/1200
local timeX,timeY = imageX*scaleX, imageY*scaleY
local timeFix = timeX/100
local speedoFont = dxCreateFont( "edf/digital.ttf", 45*scaleX )
local scaleX,scaleY = (scaleX*scaleY),(scaleX*scaleY)
 
speedo = {
    image = {230*scaleX,100*scaleX},
    anim = {1},
}
 
 
spectatorsPosition = {
    arrowL = screenHeight,
    arrowR = screenHeight
}
 
addEventHandler('onClientResourceStart', g_ResRoot,
    function()
        g_Players = getElementsByType('player')
        tosfont = guiCreateFont("edf/font.ttf",28*scaleX)
        fadeCamera(false,0.0)
        -- create GUI
        g_PickupStartTick = getTickCount()
        local fonts = relativeScale(screenHeight)
        fontX = dxGetFontHeight(fonts, 'bankgothic')
        g_dxGUI = {
            checkpoint = dxText:create('#306EFF0/0', screenWidth - 15, screenHeight - 54, false, 'bankgothic', 0.8, 'right'),
            mapdisplay = dxText:create('#306EFFMap: #ffffffNone', 2, screenHeight - fontX/2, false, 'default-bold', fonts*2, 'left'),
            nextmapdisplay = dxText:create('#306EFFNext Map: #ffffffNot set now...', 2, screenHeight - fontX/2, false, 'default-bold', fonts*2, 'left')
        }
        fps = dxText:create('#306EFFFPS #ffffff45', 2, screenHeight - fontX*2.5, false, 'default-bold', fonts*2, 'left')
        spectators = dxText:create('#306EFFSpectators: #ffffff0', 2, screenHeight - fontX*1.5, false, 'default-bold', fonts*2, 'left')
        fps:type('shadow', 1, 0, 0, 0, 175)
        spectators:type('shadow', 1, 0, 0, 0, 175)
        spectators:type('shadow', 1, 0, 0, 0, 175)
        g_dxGUI.checkpoint:type('stroke', 1, 0, 0, 0, 255)
        g_dxGUI.mapdisplay:type('shadow', 1, 0, 0, 0, 175)
        g_dxGUI.nextmapdisplay:type('shadow', 1, 0, 0, 0, 175)
        g_dxGUI.nextmapdisplay:visible(false)
        g_GUI = {
            timeleftbg = guiCreateStaticImage(screenWidth-(timeX)+timeFix, 0-timeFix*2, timeX, timeY, 'img/timeleft.png', false),
            timeleft = guiCreateLabel(screenWidth-(timeX*0.-- s8) -->, timeY*0.25, screenWidth/3.7, screenHeight/30, '',false,timeleftbg),
            timepassed = guiCreateLabel(screenWidth-(timeX*0.385), timeY*0.25, screenWidth/3.7, screenHeight/30, '', false, timeleftbg),
            --healthbar = FancyProgress.create(320, 1000, 'img/progress_health_bg.png', -45, 90, 163, 30, 'img/progress_health.png', 51, 8, 108, 15),
            clientTime = guiCreateLabel(screenWidth-(timeX*0.35), timeY*0.56, screenWidth/3.7, screenHeight/30, '', false, timeleftbg),
        }
        guiSetFont(g_GUI.timeleft, tosfont)
        guiSetFont(g_GUI.timepassed, tosfont)
        guiSetFont(g_GUI.clientTime, tosfont)
        guiLabelSetHorizontalAlign(g_GUI.timeleft, 'left')
        guiLabelSetHorizontalAlign(g_GUI.timeleft, 'left')
        guiLabelSetHorizontalAlign(g_GUI.timepassed, 'left')
        guiSetAlpha(g_GUI.timeleftbg, 0)
        guiSetAlpha(g_GUI.timepassed, 0)
        guiSetAlpha(g_GUI.clientTime, 0)
        guiSetAlpha(g_GUI.timeleft, 0)
        --hideGUIComponents('healthbar')
        RankingBoard.precreateLabels(10)
        -- set update handlers
        addEventHandler('onClientRender', g_Root, updateBars)
        g_WaterCheckTimer = setTimer(checkWater, 1000, 0)
        -- load pickup models and textures
        for name,id in pairs(g_ModelForPickupType) do
            engineImportTXD(engineLoadTXD('model/' .. name .. '.txd'), id)
            engineReplaceModel(engineLoadDFF('model/' .. name .. '.dff', id), id)
            -- Double draw distance for pickups
            engineSetModelLODDistance( id, 60 )
        end
        if isVersion101Compatible() then
            -- Dont clip vehicles (1.0.1 function)
            setCameraClip ( true, false )
        end
        -- Init presentation screens
        TravelScreen.init()
        TitleScreen.init()
        -- Show title screen now
        TitleScreen.show()
        setPedCanBeKnockedOffBike(g_Me, false)
    end
)
 
 
-------------------------------------------------------
-- Title screen - Shown when player first joins the game
-------------------------------------------------------
TitleScreen = {}
TitleScreen.startTime = 0
 
function TitleScreen.init()
    local screenWidth, screenHeight = guiGetScreenSize()
    local adjustY = math.clamp( -30, -15 + (-30- -15) * (screenHeight - 480)/(900 - 480), -15 );
    g_GUI['titleImage'] = guiCreateStaticImage(screenWidth/2-256, screenHeight/2-256+adjustY, 512, 512, 'img/title.png', false)
end
 
function TitleScreen.show()
    showGUIComponents('titleImage'--[['titleText1','titleText2']])
    guiMoveToBack(g_GUI['titleImage'])
    TitleScreen.startTime = getTickCount()
    TitleScreen.bringForward = 0
    addEventHandler('onClientRender', g_Root, TitleScreen.update)
end
 
function TitleScreen.update()
    local secondsLeft = TitleScreen.getTicksRemaining() / 1000
    local alpha = math.min(1,math.max( secondsLeft ,0))
    guiSetAlpha(g_GUI['titleImage'], alpha)
    if alpha == 0 then
        hideGUIComponents('titleImage')
        removeEventHandler('onClientRender', g_Root, TitleScreen.update)
    end
end
 
function TitleScreen.getTicksRemaining()
    return math.max( 0, TitleScreen.startTime - TitleScreen.bringForward + 10000 - getTickCount() )
end
 
-- Start the fadeout as soon as possible
function TitleScreen.bringForwardFadeout(maxSkip)
    local ticksLeft = TitleScreen.getTicksRemaining()
    local bringForward = ticksLeft - 1000
    outputDebug( 'MISC', 'bringForward ' .. bringForward )
    if bringForward > 0 then
        TitleScreen.bringForward = math.min(TitleScreen.bringForward + bringForward,maxSkip)
        outputDebug( 'MISC', 'TitleScreen.bringForward ' .. TitleScreen.bringForward )
    end
end
-------------------------------------------------------
 
 
-------------------------------------------------------
-- Travel screen - Message for client feedback when loading maps
-------------------------------------------------------
TravelScreen = {}
TravelScreen.startTime = 0
 
function TravelScreen.init()
    local screenWidth, screenHeight = guiGetScreenSize()
    g_GUI['travelImage']   = guiCreateStaticImage(screenWidth/2-256, screenHeight/2-90, 512, 256, 'img/travelling.png', false, nil)
    g_dxGUI['travelText1'] = dxText:create('Travelling to', screenWidth/2, screenHeight/2-130, false, 'default-bold', 1.5, 'center' )
    g_dxGUI['travelText2'] = dxText:create('', screenWidth/2, screenHeight/2-100, false, 'default-bold', 1.7, 'center' )
    g_dxGUI['travelText3'] = dxText:create('', screenWidth/2, screenHeight/2-70, false, 'default-bold', 1.9, 'center' )
    g_dxGUI['travelText1']:color(48,110,255)
    g_dxGUI['travelText2']:color(220,220,220)
    hideGUIComponents('travelImage', 'travelText1', 'travelText2', 'travelText3')
end
 
function TravelScreen.show( mapName, authorName )
    TravelScreen.startTime = getTickCount()
    g_dxGUI['travelText2']:text(mapName)
    g_dxGUI['travelText3']:text("")
    showGUIComponents('travelImage', 'travelText1', 'travelText2', 'travelText3')
    guiMoveToBack(g_GUI['travelImage'])
    showLoadingBar()
end
 
function TravelScreen.hide()
    hideGUIComponents('travelImage', 'travelText1', 'travelText2', 'travelText3')
    removeLoadingBar()
end
 
function TravelScreen.getTicksRemaining()
    return math.max( 0, TravelScreen.startTime + 3000 - getTickCount() )
end
-------------------------------------------------------
 
 
-- Called from server
function notifyLoadingMap( mapName, authorName )
    fadeCamera( false, 0.0, 0,0,0 ) -- fadeout, instant, black
    TravelScreen.show( mapName, authorName )
end
 
 
-- Called from server
function initRace(vehicle, checkpoints, objects, pickups, mapoptions, ranked, duration, gameoptions, mapinfo, playerInfo)
    outputDebug( 'MISC', 'initRace start' )
    unloadAll()
   
    g_Players = getElementsByType('player')
    g_MapOptions = mapoptions
    g_GameOptions = gameoptions
    g_MapInfo = mapinfo
    g_PlayerInfo = playerInfo
    triggerEvent('onClientMapStarting', g_Me, mapinfo )
   
    g_dxGUI.mapdisplay:text("#306EFFMap: #FFFFFF"..g_MapInfo.name)
   
    fadeCamera(true)
    showHUD(false)
   
    g_Vehicle = vehicle
    setVehicleDamageProof(g_Vehicle, true)
    OverrideClient.updateVars(g_Vehicle)
   
    --local x, y, z = getElementPosition(g_Vehicle)
    setCameraBehindVehicle(vehicle)
    --alignVehicleToGround(vehicle)
    updateVehicleWeapons()
    setCloudsEnabled(g_GameOptions.cloudsenable)
    setBlurLevel(g_GameOptions.blurlevel)
    g_dxGUI.mapdisplay:visible(g_GameOptions.showmapname)
    if engineSetAsynchronousLoading then
        engineSetAsynchronousLoading( g_GameOptions.asyncloading )
    end
 
    -- checkpoints
    g_Checkpoints = checkpoints
   
    -- pickups
    local object
    local pos
    local colshape
    for i,pickup in pairs(pickups) do
        pos = pickup.position
        object = createObject(g_ModelForPickupType[pickup.type], pos[1], pos[2], pos[3])
        setElementCollisionsEnabled(object, false)
        colshape = createColSphere(pos[1], pos[2], pos[3], 3.5)
        g_Pickups[colshape] = { object = object }
        for k,v in pairs(pickup) do
            g_Pickups[colshape][k] = v
        end
        g_Pickups[colshape].load = true
        if g_Pickups[colshape].type == 'vehiclechange' then
            g_Pickups[colshape].label = dxText:create(getVehicleNameFromModel(g_Pickups[colshape].vehicle), 0.5, 0.5)
            g_Pickups[colshape].label:color(255, 255, 255, 0)
            g_Pickups[colshape].label:type("shadow",2)
            g_Pickups[colshape].label:font("default-bold")
        end
    end
   
   
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...