TheSmart Posted July 3, 2015 Posted July 3, 2015 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)
LabiVila Posted July 3, 2015 Posted July 3, 2015 dxDrawRectangle doesn't have parents or so... instead of: dxDrawRectangle(63, 143, 967, 577, tocolor(9, 9, 9, 216), false, helpwindow) use: dxDrawRectangle(63, 143, 967, 577, tocolor(9, 9, 9, 216))
TheSmart Posted July 4, 2015 Author Posted July 4, 2015 anyone? i know code is wrong because i'm newbie at scripting help me so i can understand. :V
darhal Posted July 5, 2015 Posted July 5, 2015 addEventHandler("onClientResourceStart", resourceRoot, function() helpmemo = guiCreateMemo(407, 209, 585, 475, "", false) end ) function drawDx() dxDrawRectangle(63, 143, 967, 577, tocolor(9, 9, 9, 216), false) dxDrawRectangle(85, 494, 250, 63, tocolor(9, 9, 9, 242), false) dxDrawText("Darhal Pro <3", 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 (helpmemo) == false) then guiSetVisible(helpmemo, true) showCursor(true) --guiSetPosition(helpmemo,x,y,false) centerWindow(helpmemo) addEventHandler("onClientRender", root,drawDx) elseif (guiGetVisible (helpmemo) == true) then guiSetVisible(helpmemo, false) showCursor(false) removeEventHandler("onClientRender", root,drawDx) end end bindKey ("F1", "down", open) #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
darhal Posted July 5, 2015 Posted July 5, 2015 what u need exactly I didnt understand the problem ? #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
TheSmart Posted July 6, 2015 Author Posted July 6, 2015 i just want to make when player click on button memo will show and read rules.txt That's it
Dealman Posted July 10, 2015 Posted July 10, 2015 function rules () rulestxt = fileOpen("Rules.txt", true) rulestxt1 = fileRead(rulestxt, 50000) guiSetText(helpmemo, rulestxt1) end addEventHandler("onClientGUIClick", Rules, rules) And what exactly is Rules supposed to be? From what I can tell it's not defined. Also use debugscript. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
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