Jump to content

[HELP] Debug


Sex*

Recommended Posts

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.

Then avoid it -.-

Link to comment
what is your resource name and how many scripts are inside ? (i think that error is not from that code, maybe from another resource or script)

All the resources are separately. In the error it says that "expected string..." so i think i got to add a string but where and what string?

Link to comment
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] 

What is the error?

In the first post. But okey:

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

Maybe, you Did'nt did second debug because the warning date and time are same in first and second code.

go to server and write again /debugscript 3 in chat box

Link to comment

just try this code:

  
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 ) 

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

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

Love you, script is working now with no errors, ty.

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