Jump to content

help with DX and Cursor


MAB

Recommended Posts

mm.. everything works well but only the CLOSE button... when i put the mouse in it i find both of texts colors turned yellow but ACCEPT button works well.. but the close button problem proves that if the player pressed the close button .. both of the buttons effects will happen in the same time because both have the same Y... and that a problem.. so someone have solution ?

local screenW, screenH = guiGetScreenSize() 
local sW = (screenW / 1280) 
local sH = (screenH / 768) 
local tS = (screenW / 1280) 
local color = tocolor(255, 255, 255, 255) 
  
function dx_gui () 
dxDrawLine(sW*363, sH*99, sW*363, sW*632, tocolor(0, 0, 0, 255), 1, false) 
dxDrawLine(sW*880, sH*99, sW*363, sH*99, tocolor(0, 0, 0, 255), 1, false) 
dxDrawLine(sW*363, sH*632, sW*880, sH*632, tocolor(0, 0, 0, 255), 1, false) 
dxDrawLine(sW*880, sH*632, sW*880, sH*99, tocolor(0, 0, 0, 255), 1, false) 
dxDrawRectangle(sW*364, sH*100, sW*516, sH*532, tocolor(0, 0, 0, 100), false) 
dxDrawRectangle(sW*364, sH*157, sW*516, sH*6, tocolor(255, 255, 255, 255), false) 
dxDrawText("MEDIC JOB", sW*489, sH*108, sW*677, sH*147, tocolor(255, 255, 255, 255), tS*1.50, "bankgothic", "left", "top", false, false, false, false, false) 
dxDrawText("Accept", sW*381, sH*587, sW*502, sH*622, color, tS*1.00, "bankgothic", "left", "top", false, false, false, false, false) 
dxDrawText("CLOSE", sW*741, sH*587, sW*862, sH*622, color2, tS*1.00, "bankgothic", "left", "top", false, false, false, false, false) 
dxDrawRectangle(sW*364, sH*571, sW*516, sH*6, tocolor(255, 255, 255, 255), false) 
dxDrawText("This the medic job. In this job\nyou will be given an ambulance\nYou must drive injured people\nto this hospital before They\nDie. Injured People will be\nmarked in your map. Use F11 To\nToggle your map. You will be\nrewarded for every person you \nsave. You can get your vehicle\nFrom the yellow marker near\nyou.", 366, 169, 876, 567, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false) 
end 
  
function dx_move (_, _, x, y) 
    if ( x >= sW*741 and x <= (sW*741) + (sW*862) and y > (sH*587) and y < (sH*587) + (sH*622) ) then 
       color2 = tocolor (255, 255, 0, 255) 
       else 
       color2 = tocolor (255, 255, 255, 255) 
    end 
    if ( x >= sW*381 and x <= (sW*381) + (sW*502) and y > (sH*587) and y < (sH*587) + (sH*622) ) then 
       color = tocolor (255, 255, 0, 255) 
       else 
       color = tocolor (255, 255, 255, 255) 
    end 
end 
  
function dx_click (b, s, x, y) 
    if (b == 'left' and s == 'up') then 
    if ( x >= sW*741 and x <= (sW*741) + (sW*862) and y > (sH*587) and y < (sH*587) + (sH*622) ) then 
       deMenu () 
    end 
    if ( x >= sW*381 and x <= (sW*381) + (sW*502) and y > (sH*587) and y < (sH*587) + (sH*622) ) then 
       deMenu () 
    end 
    end 
end 
  
function Menu () 
    showCursor(true) 
    addEventHandler('onClientRender', root, dx_gui) 
    addEventHandler('onClientCursorMove', root, dx_move) 
    addEventHandler('onClientClick', root, dx_click) 
end 
  
function deMenu () 
    showCursor(false) 
    removeEventHandler('onClientRender', root, dx_gui) 
    removeEventHandler('onClientCursorMove', root, dx_move) 
    removeEventHandler('onClientClick', root, dx_click) 
end 
  
marker = createMarker ( -270.28204, 1020.90601, 19.58599, "cylinder", 2, 255, 255, 0, 255 ) 
addEventHandler ( "onClientMarkerHit", marker, Menu ) 

Link to comment
function dx_move(_, _, x, y) 
    if ( x >= sW*741 and x <= (sW*741) + (sW*162) and y > (sH*587) and y < (sH*587) + (sH*622) ) then 
        color2 = tocolor (255, 255, 0, 255) 
    else 
        color2 = tocolor (255, 255, 255, 255) 
    end 
    if ( x >= sW*381 and x <= (sW*381) + (sW*202) and y > (sH*587) and y < (sH*587) + (sH*622) ) then 
        color = tocolor (255, 255, 0, 255) 
    else 
        color = tocolor (255, 255, 255, 255) 
    end 
end 

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