Jump to content

Help plzzz


mamo

Recommended Posts

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 

Link to comment

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) 

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

Link to comment
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 by Guest
Link to comment

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.

Link to comment

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.

Link to comment

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.

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

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