Jump to content

[HELP] Debug


Sex*

Recommended Posts

Im having this errors.

[2012-12-31 18:16:16] ERROR: NoCompiles\util_tt_client.lua:356: attempt to index global 'hud1' (a nil value) 
[2012-12-31 18:16:16] WARNING: info\News_Box.lua:24: Bad argument @ 'dxDrawText' [Expected string at argument 1, got nil] 

Edited by Guest
Link to comment
At the second you should add string " ".

Where do i add?

-- Draw all strings. 
        dxDrawText(messagesList[currentMessage + 1], screenWidth - 202, 6, screenWidth - 6, 16, tocolor(250, 50, 0, 255), 1, "font1", "center", "top", false, false, true) 
    end 
) 
  

Link to comment
At the second you should add string " ".

Where do i add?

-- Draw all strings. 
        dxDrawText(messagesList[currentMessage + 1], screenWidth - 202, 6, screenWidth - 6, 16, tocolor(250, 50, 0, 255), 1, "font1", "center", "top", false, false, true) 
    end 
) 
  

Read the arguments.

bool dxDrawText ( string text, float left, float top [, float right=left, float bottom=top, int color=white,  
                  float scale=1, mixed font="default", string alignX="left", string alignY="top", 
                  bool clip=false, bool wordBreak=false, bool postGUI=false, 
                  bool colorCoded=false, bool subPixelPositioning=false ] ) 

Link to comment
I dont get it... I know that im missing string and i have bad argument but idk what string and where should i put it. I think somewhere dxDrawText but not sure...

Do you created a table?

Idk what you meant because im not so pro in english, and there isnt scripters in my language.

Here is all of the script:

font1 = dxCreateFont("font_sr.ttf", 18) 
  
local messagesList = { 
    "You are playing in X-Proffessionals", 
"Press F9 for help!", 
    "Server Owner: Se[X]^^", 
    "Have Fun!", 
  
     
} 
local currentMessage = 0 
  
-- ******************** 
-- *  Event handlers  * 
-- ******************** 
addEventHandler("onClientPreRender", getRootElement(), 
    function() 
        local screenWidth, screenHeight = guiGetScreenSize() 
  
        -- Draw the news sticker. 
        dxDrawRectangle(screenWidth - 204, 4, 200, 20, tocolor(0, 0, 0, 192), false) 
         
        -- Draw all strings. 
    dxDrawText(messagesList[currentMessage + 1], screenWidth - 202, 6, screenWidth - 6, 16, tocolor(250, 50, 0, 255), 1, "font1", "center", "top", false, false, true) 
    end 
) 
  
function updateMessage() 
    if (currentMessage == 4) then 
        currentMessage = 0 
    else 
        currentMessage = currentMessage + 1 
    end 
end 
setTimer(updateMessage, 5000, 0) 
  

Link to comment
-- Try this 
font1 = dxCreateFont("font_sr.ttf", 18) 
  
local messagesList = { 
    [1] = "You are playing in X-Proffessionals", 
    [2] = "Press F9 for help!", 
    [3] = "Server Owner: Se[X]^^", 
    [4] = "Have Fun!",    
} 
  
local currentMessage = 0 
  
-- ******************** 
-- *  Event handlers  * 
-- ******************** 
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local screenWidth, screenHeight = guiGetScreenSize() 
        dxDrawRectangle(screenWidth - 204, 4, 200, 20, tocolor(0, 0, 0, 192), false) 
        dxDrawText( messagesList [currentMessage + 1], screenWidth - 202, 6, screenWidth - 6, 16, tocolor(250, 50, 0, 255), 1, font1, "center", "top", false, false, true) 
    end 
) 
  
function updateMessage() 
    if (currentMessage == 4) then 
        currentMessage = 0 
    else 
        currentMessage = currentMessage + 1 
    end 
end 
setTimer(updateMessage, 5000, 0) 

Link to comment
-- Try this 
font1 = dxCreateFont("font_sr.ttf", 18) 
  
local messagesList = { 
    [1] = "You are playing in X-Proffessionals", 
    [2] = "Press F9 for help!", 
    [3] = "Server Owner: Se[X]^^", 
    [4] = "Have Fun!",    
} 
  
local currentMessage = 0 
  
-- ******************** 
-- *  Event handlers  * 
-- ******************** 
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local screenWidth, screenHeight = guiGetScreenSize() 
        dxDrawRectangle(screenWidth - 204, 4, 200, 20, tocolor(0, 0, 0, 192), false) 
        dxDrawText( messagesList [currentMessage + 1], screenWidth - 202, 6, screenWidth - 6, 16, tocolor(250, 50, 0, 255), 1, font1, "center", "top", false, false, true) 
    end 
) 
  
function updateMessage() 
    if (currentMessage == 4) then 
        currentMessage = 0 
    else 
        currentMessage = currentMessage + 1 
    end 
end 
setTimer(updateMessage, 5000, 0) 

You got the font working but the error is still the same :P:cry:

Link to comment
<meta> 
    <info author="#Se[X]" name="NewsScript" version="2.0" description="NewsScript" type="script"/> 
  
    <script src="News_Box.lua" type="client" /> 
</meta> 
  

You must add Font in meta.

Oh yea forgot:D But the weird thing is that the font works. I even didnt have it in folder wtf. Still having errors...

New meta:

<meta> 
    <info author="#Se[X]" name="NewsScript" version="2.0" description="NewsScript" type="script"/> 
  
    <script src="News_Box.lua" type="client" /> 
<file src="font_sr.ttf"/> 
</meta> 

Link to comment
where is your code !

Ah you :o dumbass, the 1st page, read you :o idiot!

are you f*** kidding with me !!

--News_Box.lua.lua:

-- Try this 
font1 = dxCreateFont("font_sr.ttf", 18) 
  
local messagesList = { 
    [1] = "You are playing in X-Proffessionals", 
    [2] = "Press F9 for help!", 
    [3] = "Server Owner: Se[X]^^", 
    [4] = "Have Fun!",   
} 
  
local currentMessage = 0 
  
-- ******************** 
-- *  Event handlers  * 
-- ******************** 
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local screenWidth, screenHeight = guiGetScreenSize( ) 
        dxDrawRectangle(screenWidth - 204, 4, 200, 20, tocolor(0, 0, 0, 192), false) 
        dxDrawText( messagesList[ currentMessage + 1 ], screenWidth - 202, 6, screenWidth - 6, 16, tocolor(250, 50, 0, 255), 1, font1, "center", "top", false, false, true) 
    end 
) 
  
function updateMessage() 
    if (currentMessage == 4) then 
        currentMessage = 0 
    else 
        currentMessage = currentMessage + 1 
    end 
end 
setTimer( updateMessage, 5000, 0 ) 

--meta.xml:

    "#Se[X]" name="NewsScript" version="2.0" description="NewsScript" type="script"/> 
  
    

your error :

[2012-12-31 18:16:16] WARNING: info\News_Box.lua:24: Bad argument @ 'dxDrawText' [Expected string at argument 1, got nil] 

and the line 24 not the 'dxDrawText'

Link to comment
Idk, but thats my script :lol:

will try this one

* News_Box.lua

local messagesList = { 
    [1] = "#FFFF00You are playing in X-Proffessionals", 
    [2] = "Press #FF0000F9 #FFFFFFfor help!", 
    [3] = "Server Owner: Se[X]^^", 
    [4] = "Have Fun!",   
} 
  
local currentMessage = 0 
  
-- ******************** 
-- *  Event handlers  * 
-- ******************** 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local screenWidth, screenHeight = guiGetScreenSize( ) 
        dxDrawRectangle(screenWidth - 204, 4, 200, 20, tocolor(0, 0, 0, 192), false) 
        dxDrawText( messagesList[ currentMessage + 1 ], screenWidth - 202, 6, screenWidth - 6, 16, tocolor( 250, 255, 255, 255 ), 1, dxCreateFont( 'font_sr.ttf', 18 ), 'center', 'top', false, false, true, true ) 
    end 
) 
  
function updateMessage( ) 
    if ( currentMessage == 4 ) then 
        currentMessage = 0 
    else 
        currentMessage = currentMessage + 1 
    end 
end 
setTimer( updateMessage, 5000, 0 ) 

* meta.xml

    "#Se[X]" name="NewsScript" version="2.0" description="NewsScript" type="script"/> 
  
    

And make sure the font are there.

Link to comment
Idk, but thats my script :lol:

will try this one

* News_Box.lua

local messagesList = { 
    [1] = "#FFFF00You are playing in X-Proffessionals", 
    [2] = "Press #FF0000F9 #FFFFFFfor help!", 
    [3] = "Server Owner: Se[X]^^", 
    [4] = "Have Fun!",   
} 
  
local currentMessage = 0 
  
-- ******************** 
-- *  Event handlers  * 
-- ******************** 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local screenWidth, screenHeight = guiGetScreenSize( ) 
        dxDrawRectangle(screenWidth - 204, 4, 200, 20, tocolor(0, 0, 0, 192), false) 
        dxDrawText( messagesList[ currentMessage + 1 ], screenWidth - 202, 6, screenWidth - 6, 16, tocolor( 250, 255, 255, 255 ), 1, dxCreateFont( 'font_sr.ttf', 18 ), 'center', 'top', false, false, true, true ) 
    end 
) 
  
function updateMessage( ) 
    if ( currentMessage == 4 ) then 
        currentMessage = 0 
    else 
        currentMessage = currentMessage + 1 
    end 
end 
setTimer( updateMessage, 5000, 0 ) 

* meta.xml

    "#Se[X]" name="NewsScript" version="2.0" description="NewsScript" type="script"/> 
  
    

And make sure the font are there.

Not working, everything works(font and stuff also), only that errors come.

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