Hello guys !
today im trying to make dx information panel idk why its not working can anybody help me? im noob at scripting and this is test code
addEventHandler("onClientResourceStart", resourceRoot,
function()
helpmemo = guiCreateMemo(407, 209, 585, 475, "", false)
end
)
addEventHandler("onClientRender", root,
function()
dxDrawRectangle(63, 143, 967, 577, tocolor(9, 9, 9, 216), false, helpwindow)
dxDrawRectangle(85, 494, 250, 63, tocolor(9, 9, 9, 242), false)
dxDrawText("Darhal noob", 85, 493, 335, 557, tocolor(255, 255, 255, 255), 3.00, "default", "left", "top", false, false, false, false, false)
end
)
function onClick(x, y, absX, absY)
if isCursorWithin(85, 493, 335, 557) then -- width , height are width height of dx draw (text / rectangle)
function rules ()
rulestxt = fileOpen("Rules.txt", true)
rulestxt1 = fileRead(rulestxt, 50000)
guiSetText(helpmemo, rulestxt1)
end
addEventHandler("onClientGUIClick", Rules, rules)
end
end
addEventHandler("onClientClick", root, onClick)
function isCursorWithin(x, y, width, height)
if(not isCursorShowing()) then
return false;
end
local sx, sy = guiGetScreenSize();
local cx, cy = getCursorPosition();
local cx, cy = (cx*sx), (cy*sy);
if(cx >= x and cx <= x + width) and (cy >= y and cy <= y + height) then
return true;
else
return false;
end
end
function open()
if (guiGetVisible (helpwindow) == false) then
guiSetVisible(helpwindow, true)
showCursor(true)
guiSetPosition(helpwindow,x,y,false)
centerWindow(helpwindow)
elseif (guiGetVisible (helpwindow) == true) then
guiSetVisible(helpwindow, false)
showCursor(false)
end
end
bindKey ("F1", "down", open)