AhmadQTR Posted January 1, 2013 Share Posted January 1, 2013 Idk, but thats my script 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
Sex* Posted January 1, 2013 Author Share Posted January 1, 2013 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
Perfect Posted January 1, 2013 Share Posted January 1, 2013 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
Sex* Posted January 1, 2013 Author Share Posted January 1, 2013 No, i did, but same problem... Link to comment
Perfect Posted January 1, 2013 Share Posted January 1, 2013 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 Sarrum Posted January 2, 2013 Scripting Moderators Share Posted January 2, 2013 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
Sex* Posted January 2, 2013 Author Share Posted January 2, 2013 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
Scripting Moderators Sarrum Posted January 3, 2013 Scripting Moderators Share Posted January 3, 2013 My pleasure. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now