Sex* Posted December 31, 2012 Share Posted December 31, 2012 (edited) 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 January 1, 2013 by Guest Link to comment
AhmadQTR Posted December 31, 2012 Share Posted December 31, 2012 At the second you should add string " ". Link to comment
TAPL Posted December 31, 2012 Share Posted December 31, 2012 viewtopic.php?f=91&t=47897 Link to comment
Sex* Posted December 31, 2012 Author Share Posted December 31, 2012 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
AhmadQTR Posted December 31, 2012 Share Posted December 31, 2012 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
Sex* Posted December 31, 2012 Author Share Posted December 31, 2012 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... Link to comment
AhmadQTR Posted December 31, 2012 Share Posted December 31, 2012 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? Link to comment
Sex* Posted December 31, 2012 Author Share Posted December 31, 2012 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
3NAD Posted December 31, 2012 Share Posted December 31, 2012 -- 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
Sex* Posted December 31, 2012 Author Share Posted December 31, 2012 -- 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 Link to comment
Sex* Posted January 1, 2013 Author Share Posted January 1, 2013 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] Link to comment
Sex* Posted January 1, 2013 Author Share Posted January 1, 2013 <meta> <info author="#Se[X]" name="NewsScript" version="2.0" description="NewsScript" type="script"/> <script src="News_Box.lua" type="client" /> </meta> Link to comment
abu5lf Posted January 1, 2013 Share Posted January 1, 2013 <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. Link to comment
Sex* Posted January 1, 2013 Author Share Posted January 1, 2013 <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
Blaawee Posted January 1, 2013 Share Posted January 1, 2013 you didn't say what is the error :~O Link to comment
Sex* Posted January 1, 2013 Author Share Posted January 1, 2013 you didn't say what is the error :~O Cant you read first post!?! [2012-12-31 18:16:16] WARNING: info\News_Box.lua:24: Bad argument @ 'dxDrawText' [Expected string at argument 1, got nil] Link to comment
Sex* Posted January 1, 2013 Author Share Posted January 1, 2013 where is your code ! Ah you fucking dumbass, the 1st page, read you fucking idiot! Link to comment
Blaawee Posted January 1, 2013 Share Posted January 1, 2013 where is your code ! Ah you dumbass, the 1st page, read you 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
Sex* Posted January 1, 2013 Author Share Posted January 1, 2013 Idk, but thats my script Link to comment
Blaawee 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. Link to comment
Sex* Posted January 1, 2013 Author 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. Link to comment
Perfect Posted January 1, 2013 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) 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