Jump to content

Why not working this script?


Turbe$Z

Recommended Posts

Posted
local x, y = guiGetScreenSize()
local font_os = (x/1600+y/900)/2 
local font = font_os*1
local nSpaceY = dxGetFontHeight(font, "default-bold")
local nSpaceYOld = dxGetFontHeight(2, "default-bold")
local szovegek = {}
local drawCount = 5
local drawnCount = 0
local drawFrom = 0
local automaticChange = 1 
for i=0, 4, 1 do
	szovegek[i] = ""
end
function itsRenderTime()
    for i = 0, 4, 1 do
        if szovegek[i] then
            local topSpaceX = dxGetTextWidth(szovegek[i]:gsub("#%x%x%x%x%x%x",""),font,"default-bold")
            local webX=topSpaceX+font_os*10
            dxDrawRectangle ( x-webX-font_os*5, nSpaceYOld*2+font_os*8+nSpaceY*(4-i)+font_os*(4-i), webX, nSpaceY+font_os*4, tocolor ( 0, 0, 0, 155 ) )
            dxDrawEmptyRec ( x-webX-font_os*5, nSpaceYOld*2+font_os*8+nSpaceY*(4-i)+font_os*(4-i), webX, nSpaceY+font_os*4, tocolor ( 255, 255, 255, 200 ), 2 )
            dxDrawText ( szovegek[i], x-webX, nSpaceYOld*2+font_os*10+nSpaceY*(4-i)+font_os*(4-i), topSpaceX, nSpaceY, tocolor ( 255, 255, 255, 255 ), font, "default-bold", "left", "top",true,false,false,true )
        end
    end
end
addEventHandler("onClientRender", getRootElement(), itsRenderTime)

addEventHandler("onClientPlayerChangeNick", root, function(lastNick, newNick)
	table.insert(szovegek[i], "#00BAFF" .. lastNick .. " #FFffffneve mostantól #00baff" .. newNick .. "")
end)

function dxDrawEmptyRec(absX,absY,sizeX,sizeY,color,ancho)
    dxDrawRectangle ( absX,absY,sizeX,ancho,color )
    dxDrawRectangle ( absX,absY+ancho,ancho,sizeY-ancho,color )
    dxDrawRectangle ( absX+ancho,absY+sizeY-ancho,sizeX-ancho,ancho,color )
    dxDrawRectangle ( absX+sizeX-ancho,absY+ancho,ancho,sizeY-ancho*2,color )   
end

local aValto = true
function azEltunteto()
    if aValto then
        aValto = false
        removeEventHandler ( "onClientRender", root, itsRenderTime )
        
    else
        aValto = true
        addEventHandler ( "onClientRender", root, itsRenderTime )
    end
end
bindKey("delete","down",azEltunteto)

 

Posted

As what they said you should post the errors so we can find the problem anyway :

 

 

table.insert(szovegek[i], "#00BAFF" .. lastNick .. " #FFffffneve mostantól #00baff" .. newNick .. "")

 

szovegek[i] = not defined it will be nil.

 

 

PS. Next time tell us what is the problem and where is it.

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...