Jump to content

Dx and resolution problems


MKH

Recommended Posts

Yoo guys, i'm making DX Scripts but i found a problem with them when my friend joined my server and saw the DX windows

Well this is a screenshot how i see them

Spoiler

gAe58E6.png

And this is a screenshot how my friend saw them

Spoiler

BJTBhsb.jpg

 

Well i use these functions

local screenW, screenH = guiGetScreenSize()
function dxGui ()
dxDrawRectangle((screenW - 447) / 2, (screenH - 63) / 5, 447, 63, tocolor(252, 120, 2, 255), false)
        dxDrawRectangle((screenW - 438) / 2, (screenH - 363) / 1.99, 438, 363, tocolor(0, 0, 0, 255), false)
        dxDrawRectangle((screenW - 427) / 2, (screenH - 18) / 3.6, 427, 18, tocolor(0, 0, 0, 255), true)
        dxDrawRectangle((screenW - 27) / 1.53, (screenH - 192) / 2.6, 27, 192, tocolor(0, 0, 0, 255), true)
        dxDrawRectangle((screenW - 20) / 2.9, (screenH - 187) / 2.6, 20, 187, tocolor(0, 0, 0, 255), true)
        dxDrawRectangle((screenW - 438) / 2, (screenH - 24) / 1.9, 438, 24, tocolor(0, 0, 0, 255), true)
        dxDrawText("Vehciles", (screenW - 179) / 2, (screenH - 37) / 4.9, ((screenW - 179) / 2) + 179, ( (screenH - 37) / 4.9) + 37, tocolor(255, 255, 255, 255), 1.30, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawRectangle((screenW - 405) / 2, (screenH - 53) / 1.67, 405, 53, tocolor(252, 120, 2, 255), true)
        dxDrawRectangle((screenW - 405) / 2, (screenH - 53) / 1.44, 405, 53, tocolor(252, 120, 2, 255), true)
        dxDrawText("Spawn", (screenW - 64) / 2, (screenH - 29) / 1.67, ((screenW - 64) / 2) + 64, ( (screenH - 29) / 1.67) + 29, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "top", false, false, true, false, false)
        dxDrawText("Cancel", (screenW - 64) / 2, (screenH - 29) / 1.44, ((screenW - 64) / 2) + 64, ( (screenH - 29) / 1.44) + 29, tocolor(255, 255, 255, 255), 1.50, "default-bold", "left", "top", false, false, true, false, false)
		end
function createVehicleChooserGUI()
	if (isElement(wndVehicle)) then
		if (guiGetVisible(wndVehicle)) then return end
		guiSetAlpha(gridVehicle, 0)
	end
	windowWidth, windowHeight = 321, 338
	windowX, windowY = (screenWidth / 2) - (windowWidth / 2), (screenHeight / 2) - (windowHeight / 2)
	wndVehicle = guiCreateWindow(windowX, windowY, windowWidth, windowHeight, "Select Vehicle",false)
	guiSetAlpha(wndVehicle, 0)
	gridVehicle = guiCreateGridList((screenW - 415) / 2, (screenH - 187) / 2.7, 415, 187, false)
	vehicleColumn = guiGridListAddColumn(gridVehicle,"Vehicle",0.8)
	vehicleSpawn = guiCreateButton((screenW - 405) / 2, (screenH - 50) / 1.67, 405, 50, "Spawn", false, wndVehicle)
	vehicleClose = guiCreateButton((screenW - 405) / 2, (screenH - 50) / 1.44, 405, 50, "close", false, wndVehicle)
	-- guiSetAlpha(vehicleClose, 1)
	addEventHandler("onClientGUIClick", vehicleSpawn, onPlayerSelectVehicle)
	addEventHandler("onClientGUIClick", vehicleClose, onPlayerExitVehicleGUI)
end

 

guiGetVisible(gridVehicle, true)
	addEventHandler("onClientPreRender", getRootElement(), dxGui);

 

Any solution please ! :)

Link to comment
4 hours ago, ViRuZGamiing said:

 


addEventHandler("onClientPreRender", getRootElement(), dxGui);

You are rendering it for root a.k.a everyone, rendering it only for the one who has to see it, being localPlayer since it's clientside

 

49 minutes ago, Dimos7 said:

for dx i think is 


addEventHandler("onClientRender", root, dxgui)

 

 

Yeah but this is not my problem, my problem is the places of ' Rectangles '
its fine for my resolution but not fine for others,

note i'm using 1366x768 and my friend using 1600x900 resolution

Link to comment

You didn't change the 

windowWidth, windowHeight = 321, 338

to work on different resolutions, for every resolution you use these values in width and height.

 

What you need to do is, (value / yourscreenx) * hisscreenx

what in your own case become (321 / 1366) * 1366 = 321

but for your friend it'll be (321 / 1366) * 1600 = 376

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