TwiX! Posted August 4, 2012 Posted August 4, 2012 What black screen?!?!?!?! Where did you put that?! learn how work dxDrawText in your code - there bad arguments - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
MIKI785 Posted August 4, 2012 Posted August 4, 2012 Bad arguments can result in black screen? O_o. He just can't post debug errors... Lua Scripter Owner of mshost.cz MTA portal.
mamo Posted August 4, 2012 Author Posted August 4, 2012 Bad arguments can result in black screen? O_o. He just can't post debug errors... I use Debug Script and Nothing i just see A Black Screen
TwiX! Posted August 4, 2012 Posted August 4, 2012 show all your code - Working on [php/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
mamo Posted August 4, 2012 Author Posted August 4, 2012 local screenWidth, screenHeight = guiGetScreenSize() dxDrawColorText ('#ffa500Nextmap: #ffFFff' .. g_NextMap, 2, screenHeight - dxGetFontHeight(1.7, 'default-bold')/2, 100, 100, tocolor ( 255, 255, 255, 255 ), 0.9, 'default-bold', 0.9, 'left') if (g_MapInfo) then dxDrawColorText ('#ffa500Map: #ffFFff' .. g_MapInfo.name, 2, screenHeight - dxGetFontHeight(3.3, 'default-bold')/2, 100, 100, tocolor ( 255, 255, 255, 255 ), 0.9, 'default-bold', 0.9, 'left') else dxDrawColorText ('#ffa500Map: #ffFFff- Nothing -', 2+1, screenHeight - dxGetFontHeight(3.3, 'default-bold')/2+1, 100+1, 100+1, tocolor ( 255, 255, 255, 255 ), 0.9, 'default-bold', 0.9, 'left') end dxDrawColorText ('#ffa500Spectators: #ffFFff' .. #Spectators .. '', 3.7, screenHeight - dxGetFontHeight(5.0, 'default-blod')/2+1, 100+1, 100+1, tocolor ( 255, 255, 255, 255 ), 0.9, 'default-bold', 0.9, 'left') if getElementData(getLocalPlayer(),"fps") then dxDrawColorText ('#ffa500FPS: #ffFFff' .. getElementData(getLocalPlayer(),"fps"), 1.2, screenHeight - dxGetFontHeight(6.5, 'default-bold')/2, 100, 100, tocolor ( 255, 255, 255, 255 ), 0.9, 'default-bold', 0.9, 'left') else dxDrawColorText ('#ffa500FPS: #ffFFff??', 1.6, screenHeight - dxGetFontHeight(6.5, 'default-bold')/2, 100, 100, tocolor ( 255, 255, 255, 255 ), 0.9, 'default-bold', 0.9, 'left') end end x, y = guiGetScreenSize() --x is the width of the screen x = x - 100 --X is now 100 Pixel from the right end of the screen. addEventHandler("onClientRender", getRootElement(), function () dxDrawColorText ('#ffa500sb#ffffffgames#ffa500.com#ffffff.br', x, y - dxGetFontHeight(250, 'default-bold')/2+1, 100, 100+1, tocolor ( 255, 255, 255, 255 ), 0.9, 'default-bold', 0.60, 'right') end) end
MIKI785 Posted August 4, 2012 Posted August 4, 2012 I said MAKE YOUR OWN RESOURCE..... stop putting it into the race... Lua Scripter Owner of mshost.cz MTA portal.
Tails Posted August 4, 2012 Posted August 4, 2012 I know this happens with my script as well, regardless of using the guiGetScreenSize() command. local screenWidth,screenHeight = guiGetScreenSize() function renderDisplay ( ) dxDrawImage ( screenWidth/2 - 400, 0, 225, 17, 'ddastext.png') end function HandleTheRendering ( ) addEventHandler("onClientRender", getRootElement(), renderDisplay) end addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering) Discord: its.tails
mamo Posted August 4, 2012 Author Posted August 4, 2012 I know this happens with my script as well, regardless of using the guiGetScreenSize() command. local screenWidth,screenHeight = guiGetScreenSize() function renderDisplay ( ) dxDrawImage ( screenWidth/2 - 400, 0, 225, 17, 'ddastext.png') end function HandleTheRendering ( ) addEventHandler("onClientRender", getRootElement(), renderDisplay) end addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering) Dude i don't won't Image , I won't Text.
Jaysds1 Posted August 4, 2012 Posted August 4, 2012 (edited) Dude i don't won't Image , I won't Text. He's saying that the same thing happens to his script @Tails, Try this: local screenWidth,screenHeight = guiGetScreenSize() function renderDisplay ( ) dxDrawText("Hey", screenWidth/2 - 400/2, 0,400 , 17) dxDrawImage(screenWidth/2 - 400/2, 0, 400, 17," 'ddastext.png'") end function HandleTheRendering ( ) addEventHandler("onClientRender", getRootElement(), renderDisplay) end addEventHandler("onClientResourceStart",resourceRoot, HandleTheRendering) @mamo, Did you even defined the dxDrawColorText? Edited August 4, 2012 by Guest My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Jaysds1 Posted August 4, 2012 Posted August 4, 2012 But it's not Colored .. That one was for Tails, I was asking if you defined: dxDrawColorText My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Tails Posted August 4, 2012 Posted August 4, 2012 Thank you Jaysds1, I tested this on 800x600 and 1024x768, the text/image moved slightly to the left when I went to 1024x768. Not sure if there is anything I can do about this. Is there any way to scale the text / image size relative to the resolution or default hud (health bar, chatbox, map etc. ) Say I have an image that says Welcome, and I want it above the healthbar, on all resolutions. How do I get this? Thanks in advance. Sorry Mamo, for ''hi-jacking'' your thread, but i thought this was similar to your problem. Hope it will help you as well. Discord: its.tails
myonlake Posted August 4, 2012 Posted August 4, 2012 I don't think it's possible to make it correct for all, since if a developer uses the highest resolution, all the resolutions below will see it differently even if you minused the screen width and height. I am sorry, but I am on my phone and can't browse the codes you have, but this is an example of how it should display a welcome text near the right top on all resolutions. local screenX, screenY = guiGetScreenSize() function dx_welcome() dxDrawText("Welcome", screenX - 50, 30, 50, 30, 1.0, "bankgothic", "left", "top", false, false, false) setTimer(function() removeEventHandler("onClientRender", root, dx_welcome) end, 4 * 1000, 1) end addEventHandler("onClientRender", root, dx_welcome) Not tested, typos are possible. If I helped you, please click the like button on the right Thanks!
Jaysds1 Posted August 4, 2012 Posted August 4, 2012 I think you mean this: local screenX, screenY = guiGetScreenSize() function dx_welcome() dxDrawText("Welcome", screenX - 50, 30, 50, 30, 1.0, "bankgothic", "left", "top", false, false, false) end addEventHandler("onClientRender", root, dx_welcome) setTimer(function() removeEventHandler("onClientRender", root, dx_welcome) end, 4000, 1) anyways, try working on this in the mean while. My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
myonlake Posted August 5, 2012 Posted August 5, 2012 I think you mean this:local screenX, screenY = guiGetScreenSize() function dx_welcome() dxDrawText("Welcome", screenX - 50, 30, 50, 30, 1.0, "bankgothic", "left", "top", false, false, false) end addEventHandler("onClientRender", root, dx_welcome) setTimer(function() removeEventHandler("onClientRender", root, dx_welcome) end, 4000, 1) anyways, try working on this in the mean while. Yeah, right That should work - but I haven't tested it. At least one of my gamemodes is using that kind of method and it works. If I helped you, please click the like button on the right Thanks!
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