Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2014-12-13, 09:17


BlackTen

LUA Dev.






Wiek: 28
Na forum: 4329 dni
Posty: 698

Piwa: 2080

Respekt: 157
Respekt: 157Respekt: 157

Witam mam problem , aby uruchomi? scoreboard .W??czam skrypt i mnie z serva wywala , prosz? o pomoc

[ Dodano: 2014-12-13, 09:32 ]
dxscoreboard_rl.lua :: tu jest problem :

--
-- dxscoreboard_rt.lua
--
-- Scoreboard render target support stuff
--

local rtShader
local rt
local lastUpdateTime 0


addEventHandler"onClientResourceStart"resourceRoot, 
    function ( resource )
        rtShader dxCreateShader "rt_blend.fx" )
    end
)


-- drawScoreboard
--        Do things depending on things
function drawScoreboard()
    cursorCache = {}
    if #savedRowsNext > 0 then
        savedRows savedRowsNext
        savedRowsNext = {}
    end

    if not scoreboardDrawn then
        doDrawScoreboard false--[[rtPass]], true--[[onlyAnim]], guiGetScreenSize() )
        bForceUpdate true
        return
    end

    -- Update once every 1000ms
    local bUpdate false
    if getTickCount() - lastUpdateTime 1000 or bForceUpdate then
        bUpdate true
        bForceUpdate false
        lastUpdateTime getTickCount()
    end

    -- Determine if new rt is needed
    local sXsY getRequiredRtSize()
    if rt then
        local rXrY dxGetMaterialSizert )
        if sX ~= rX or sY ~= rY then
            destroyElementrt )
            rt nil
        end
    end

    -- Try to create rt if needed
    if not rt then
        rt dxCreateRenderTargetsXsYtrue )
        bUpdate true
    end

    -- No rt then use standard drawing (hold num_9 to test)
    if not rt or getKeyState("num_9"then
        doDrawScoreboard false --[[rtPass]], false --[[onlyAnim]], guiGetScreenSize() )
        return
    end

    -- See if highlighted row will change
    local newRowIdx getCursorOverRow(true)
    if newRowIdx ~= lastRowIdx then
        -- Force rt update if highlighted row will change
        lastRowIdx newRowIdx
        bUpdate true
    end

    -- Draw background to screen
    doDrawScoreboard true --[[rtPass]], true --[[onlyAnim]], guiGetScreenSize() )

    -- Update to rt
    if bUpdate then
        dxSetRenderTarget rttrue )

        -- Save drawOverGUI settings
        local drawOverGUISaved drawOverGUI
        drawOverGUI false

        -- Draw all text to rt
        doDrawScoreboard true --[[rtPass]], false --[[onlyAnim]], getRequiredRtSize() )

        -- Restore drawOverGUI settings
        drawOverGUI drawOverGUISaved

        dxSetRenderTarget ()
    end

    -- If no text drawn then we are done
    if not scoreboardDrawn then
        return
    end

    -- Draw rt
    local xscoreboardGetTopCornerPosition()

    dxSetShaderValuertShader"sTexture0"rt );
    dxDrawImagexysXsYrtShader000tocolor(255,255,255), drawOverGUI )
end


-- Calc required render target size
--        Includes extra 15 pixels top and bottom for the scroll buttons
function getRequiredRtSize()
    local sXsY calculateWidth(), calculateHeight()
    if not sX then
        sXsY guiGetScreenSize()
    else
        sY sY 30
    end
    return math.floor(sX), math.floor(sY)
end


-- Adjust cursor position if using rt
cursorCache = {}
function getCursorScoreboardPosition(rtPass)
    if #cursorCache == 0 then
        local cXcY getCursorPosition()
        local sXsY guiGetScreenSize()
        cXcY cX*sXcY*sY
        if rtPass then
            local xscoreboardGetTopCornerPosition()
            cXcY cX-xcY-y
        end
        cursorCache = { cXcY }
    end
    return unpack(cursorCache)
end


savedRowsNext = {}
savedRows = {}
-- Return true is cursor is inside bounds
--        Also saves row data to check if highlighted row is changing between rt updates
function checkCursorOverRowrtPassxl,xh,yl,yh )
    if isCursorShowing() then
        savedRowsNext[#savedRowsNext + 1] = { xl,xh,yl,yh }
        local cXcY getCursorScoreboardPositionrtPass )
        if cX >= xl and cX <= xh and cY >= yl and cY <= yh then
            return true
        end
    end
    return false
end

-- Return index of the row the cursor is hovering over
function getCursorOverRow(rtPass)
    if isCursorShowing() then
        local cXcY getCursorScoreboardPositionrtPass )
        for idx,row in ipairs(savedRows) do
            if cX >= row[1] and cX <= row[2] and cY >= row[3] and cY <= row[4then
                return idx
            end
        end
    end
    return false
end


--------------------------------------------------------------------
--
-- Fake player data for debugging scoreboard
--        Set bAddFakePlayers to true to create some test data
--
--------------------------------------------------------------------
local bAddFakePlayers false

if bAddFakePlayers then

    local numberOfTeams 4
    local numberOfPlayersPerTeam 6

    _getElementsByType getElementsByType
    function getElementsByType(type)
        local results _getElementsByTypetype )
        if ( type == "player" then
            results = {}
            for t=1,numberOfTeams do
                for p=1,numberOfPlayersPerTeam do
                    results[#results + 1] = string.format( "player %d %d", t, p )
                end
            end
        elseif ( type == "team" then
            results = {}
            for t=1,numberOfTeams do
                results[#results + 1] = string.format( "team %d", t )
            end
        end
        return results
    end

    _getLocalPlayer getLocalPlayer
    function getLocalPlayer(type)
        return nil
    end

    _getPlayerTeam getPlayerTeam
    function getPlayerTeam(player)
        return nil
    end

    _getPlayerName getPlayerName
    function getPlayerName(player)
        return tostring(player)
    end

    _getPlayerPing getPlayerPing
    function getPlayerPing(player)
        return math.random(10,100)
    end

    _getElementData getElementData
    function getElementData(playername)
        return _getElementData(localPlayername)
    end

    _isElement isElement
    function isElement(elem)
        return _isElement(elem) or type(elem) == "string"
    end

    _getElementType getElementType
    function getElementType(elem)
        if ( type(elem) == "string" then
            local parts splitelemstring.byte(' ') )
            if parts[1] == "player" then
                return "player"
            elseif parts[1] == "team" then
                return "team"
            end
        end
        return _getElementType(elem)
    end

    _getPlayerNametagColor getPlayerNametagColor
    function getPlayerNametagColor(plr)
        if ( type(plr) == "string" then
            local parts splitplrstring.byte(' ') )
            if parts[2] == "1" then
                return 255,0,0,255
            elseif parts[2] == "2" then
                return 0,255,0,255
            elseif parts[2] == "3" then
                return 0,0,255,255
            else
                return 255,0,255,255
            end
        end
        return _getPlayerNametagColor(plr)
    end

    _getTeamColor getTeamColor
    function getTeamColor(team)
        if ( type(team) == "string" then
            local parts splitteamstring.byte(' ') )
            if parts[2] == "1" then
                return 255,90,90,255
            elseif parts[2] == "2" then
                return 90,255,90,255
            elseif parts[2] == "3" then
                return 90,90,255,255
            else
                return 255,90,255,255
            end
        end
        return _getTeamColor(team)
    end

    _getTeamName getTeamName
    function getTeamName(team)
        return tostring(team)
    end

    _getPlayersInTeam getPlayersInTeam
    function getPlayersInTeam(team)
        if ( type(team) == "string" then
            local parts splitteamstring.byte(' ') )
            results = {}
            local t=tonumber(parts[2])
                for p=1,numberOfPlayersPerTeam do
                    results[#results + 1] = string.format( "player %d %d", t, p )
                end
            return results
        end
        return _getPlayersInTeam(team)
    end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-14, 00:48


Maximerr

Programmer PHP, LUA






Wiek: 25
Na forum: 4427 dni
Posty: 548

Piwa: 1051

Respekt: 365,3
Respekt: 365,3Respekt: 365,3Respekt: 365,3Respekt: 365,3

A mo?e je?niej? Sk?d to wiesz? Debugscript? To mo?e go podaj...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-15, 22:37


markob0







Wiek: 27
Na forum: 4247 dni
Posty: 151
Nick w MP: Markob

Piwa: 939

Respekt: 98,2

Maximerr, jak ma zobaczy? db jak w??cza go, i od_razu wywala...



//Uwa?aj na b??dy.

Podpis
Ostatnio zmieniony przez MeeShuffle 2014-12-16, 07:53, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-16, 07:47


Maximerr

Programmer PHP, LUA






Wiek: 25
Na forum: 4427 dni
Posty: 548

Piwa: 1051

Respekt: 365,3
Respekt: 365,3Respekt: 365,3Respekt: 365,3Respekt: 365,3

markob0, to sk?d wie gdzie jest b??d?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-16, 10:41


markob0







Wiek: 27
Na forum: 4247 dni
Posty: 151
Nick w MP: Markob

Piwa: 939

Respekt: 98,2

No chyba o to chodzi, ?e nie wie...

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-16, 19:58


Maximerr

Programmer PHP, LUA






Wiek: 25
Na forum: 4427 dni
Posty: 548

Piwa: 1051

Respekt: 365,3
Respekt: 365,3Respekt: 365,3Respekt: 365,3Respekt: 365,3

markob0, To czemu poda? akurat ten plik? :)

Postaw piwo autorowi tego posta
 

 
Tagi: scoreboard
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » ScoreBoard Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku