TheSmart Posted July 21, 2015 Share Posted July 21, 2015 Hey guys! today im trying to make dxbutton but i don't know why its not working function dxPanel() ourButton = guiCreateButton(499, 451, 290, 37, "", false) guiSetAlpha(ourButton, 0.00) guiSetProperty(ourButton, "NormalTextColour", "AA000000") dxDrawRectangle(369, 289, 525, 397, tocolor(0, 0, 0, 170), false) dxDrawText("Click The Button", 502, 450, 789, 488, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false) showCursor(true) end addEventHandler ( "onClientGUIClick", ourButton, openOurMemo ) function bindTheKeys () bindKey ( "F1", "down", dxPanel ) end function Memo() ourMemo = guiCreateMemo(336, 332, 632, 382, "is Awesome", false) end function openOurMemo() if ( guiGetVisible ( ourMemo ) == false ) then guiSetVisible ( ourMemo, true ) local currentState = isCursorShowing () local oppositeState = not currentState showCursor ( oppositeState ) end end that error i got http://prntscr.com/7vdsea Link to comment
xXMADEXx Posted July 21, 2015 Share Posted July 21, 2015 You're trying to add the event before the button is created. function dxPanel() ourButton = guiCreateButton(499, 451, 290, 37, "", false) guiSetAlpha(ourButton, 0.00) guiSetProperty(ourButton, "NormalTextColour", "AA000000") dxDrawRectangle(369, 289, 525, 397, tocolor(0, 0, 0, 170), false) dxDrawText("Click The Button", 502, 450, 789, 488, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false) showCursor(true) addEventHandler ( "onClientGUIClick", ourButton, openOurMemo ) end function bindTheKeys () bindKey ( "F1", "down", dxPanel ) end function Memo() ourMemo = guiCreateMemo(336, 332, 632, 382, "is Awesome", false) end function openOurMemo() if ( guiGetVisible ( ourMemo ) == false ) then guiSetVisible ( ourMemo, true ) local currentState = isCursorShowing () local oppositeState = not currentState showCursor ( oppositeState ) end end Link to comment
xeon17 Posted July 21, 2015 Share Posted July 21, 2015 First you're creating a button whenever a player clicks on this button, but the button isn't created then and the result is this error. You have to create the buttons and other GUI stuff when the client enters in the server on the event onClientResourceStart. Dx functions only work when they are inside a render, so use the event onClientRender to make the rectangle and text visible. Link to comment
TheSmart Posted July 21, 2015 Author Share Posted July 21, 2015 that would be better if u give me example to do that Link to comment
xeon17 Posted July 21, 2015 Share Posted July 21, 2015 Here is a example: addEventHandler("onClientResourceStart", resourceRoot, function () Button = guiCreateButton (363,350,152,44, "", false) -- Creation of the button, whenever the player enter in server- guiSetAlpha (Button, 0.00) -- Set alpha of the button to 0.00 addEventHandler('onClientRender', root, Render) -- Render of the Rectangle end) addEventHandler ( "onClientGUIClick", resourceRoot, function () if (source == Button) then outputChatBox('Click') end end) function Render () dxDrawRectangle (363,350,152,44,tocolor(255,0,0,255)) end Link to comment
TheSmart Posted July 23, 2015 Author Share Posted July 23, 2015 so i made this but it doesn't work addEventHandler("onClientResourceStart", resourceRoot, function (panel) label = guiCreateLabel(278, 325, 247, 49, "Test", false) memo = guiCreateMemo(606, 277, 466, 381, "", false) dxDrawRectangle(262, 243, 846, 464, tocolor(13, 13, 13, 227), false) dxDrawRectangle(279, 323, 246, 55, tocolor(14, 11, 11, 227), false) addEventHandler("onClientGUIClick", root, panel) end ) function onClickBtnTest(button,state) if(button == "left" and state == "up") then testtxt = fileOpen("test.txt", true) test1 = fileRead(rulestxt, 50000) guiSetText(memo, test1) end addEventHandler("onClientGUIClick", label, onClickBtnTest) end end function () bindKey ("F1", "down", panel) end that error http://prntscr.com/7w6964 Link to comment
xeon17 Posted July 23, 2015 Share Posted July 23, 2015 This error means that you have to remove one end Link to comment
TheSmart Posted July 23, 2015 Author Share Posted July 23, 2015 now getting that error http://prntscr.com/7w6ohv and dxDrawRectangle won't show why? Link to comment
HUNGRY:3 Posted July 23, 2015 Share Posted July 23, 2015 (edited) so i made this but it doesn't work addEventHandler("onClientResourceStart", resourceRoot, function (panel) label = guiCreateLabel(278, 325, 247, 49, "Test", false) memo = guiCreateMemo(606, 277, 466, 381, "", false) dxDrawRectangle(262, 243, 846, 464, tocolor(13, 13, 13, 227), false) dxDrawRectangle(279, 323, 246, 55, tocolor(14, 11, 11, 227), false) addEventHandler("onClientGUIClick", root, panel) end ) function onClickBtnTest(button,state) if(button == "left" and state == "up") then testtxt = fileOpen("test.txt", true) test1 = fileRead(testtxt, 50000) guiSetText(memo, test1) end addEventHandler("onClientGUIClick", label, onClickBtnTest) end end function () bindKey ("F1", "down", panel) end that error http://prntscr.com/7w6964 lp = getLocalPlayer() addEventHandler("onClientRender", resourceRoot, function () if getElementData(lp,"panel") == true then label = guiCreateLabel(278, 325, 247, 49, "Test", false) memo = guiCreateMemo(606, 277, 466, 381, "", false) dx1 = dxDrawRectangle(262, 243, 846, 464, tocolor(13, 13, 13, 227), false) dx2 = dxDrawRectangle(279, 323, 246, 55, tocolor(14, 11, 11, 227),false) end end ) function onClickBtnTest() if source == label then testtxt = fileOpen("test.txt", true) test1 = fileRead(testtxt, 50000) guiSetText(memo, test1) end end addEventHandler("onClientGUIClick", root, onClickBtnTest) function noob() setElementData(lp,"panel",true) showCursor(true) end bindKey("F1","down",noob) this is my way idk if it will work :3 Edited July 24, 2015 by Guest Link to comment
xeon17 Posted July 23, 2015 Share Posted July 23, 2015 now getting that error http://prntscr.com/7w6ohv and dxDrawRectangle won't show why? Dx functions only work when they are inside a render, so use the event onClientRender to make the rectangle and text visible. Link to comment
TheSmart Posted July 28, 2015 Author Share Posted July 28, 2015 well i complete it now idk how i did that when player click on close button dx and defualt gui button will remove function dx () dxDrawRectangle(405, 301, 408, 304, tocolor(17, 16, 16, 220), false) dxDrawText("Barman", 433, 291, 775, 392, tocolor(255, 255, 255, 255), 4.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawLine(404, 394, 810, 394, tocolor(255, 255, 255, 255), 2, false) dxDrawLine(404, 398, 812, 398, tocolor(255, 255, 255, 255), 1, false) dxDrawText("Do you want to buy Beer?", 405, 421, 799, 452, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Price : 1000", 406, 459, 677, 499, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawRectangle(407, 537, 151, 58, tocolor(16, 16, 16, 220), false) dxDrawRectangle(638, 537, 151, 58, tocolor(16, 16, 16, 220), false) dxDrawText("Buy", 404, 538, 558, 595, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Close", 638, 538, 789, 595, tocolor(255, 255, 255, 255), 1.50, "bankgothic", "left", "top", false, false, false, false, false) end addEventHandler("onClientRender", root, dx) function button() acceptbtn = guiCreateButton(404, 539, 154, 56, "", false) guiSetAlpha(accept, 0.00) closebtn = guiCreateButton(638, 540, 151, 55, "", false) guiSetAlpha(close, 0.00) end addEventHandler("onClientResourceStart", resourceRoot, button) marker = createMarker( -836.33, 2734.87, 45.68, "cylinder", 2, 255, 255, 255, 150 ) function close(button,state) if (button == "left" and state == "up") then if (source == closebtn) then ---what to do nexT? Link to comment
xeon17 Posted July 28, 2015 Share Posted July 28, 2015 removeEventHandler("onClientRender", root, dx) Link to comment
TheSmart Posted July 28, 2015 Author Share Posted July 28, 2015 doesn't work function close(button,state) if (button == "left" and state == "up") then if (source == closebtn) then removeEventHandler("onClientRender", root, dx) removeEventHandler("onClientResourceStart", root, button) end end addEventHandler("onClientGUIClick", getRootElement(), close) Link to comment
xeon17 Posted July 28, 2015 Share Posted July 28, 2015 Yes it doesn't work, check /debugscript 3 how to fix it. Link to comment
TheSmart Posted July 28, 2015 Author Share Posted July 28, 2015 no error in debugscript 3 D: Link to comment
xeon17 Posted July 28, 2015 Share Posted July 28, 2015 no error in debugscript 3 D: Show how the code currently looks. Link to comment
TheSmart Posted July 28, 2015 Author Share Posted July 28, 2015 local maxDistance = 12 -- the distance showing 3dtext local ped = createPed (2,-836.33, 2734.16, 45.67) addEventHandler ( "onClientRender", root, function ( ) local pX, pY, pZ = getElementPosition ( localPlayer ) local pedX, pedY, pedZ = getElementPosition ( ped ) local distance = getDistanceBetweenPoints3D ( pX, pY, pZ, pedX, pedY, pedZ ) if ( distance <= 12 ) then local x, y = getScreenFromWorldPosition ( pedX, pedY, pedZ ) if ( x and y ) then dxDrawText("Barman", x, y+1, _, _, tocolor(248, 251, 3, 255), 2.00, "pricedown", "left", "top", false, false, false, false, false) -- dxDrawText( "Barman", x, y+1.5, _, _, tocolor( 255, 0, 0, 255 ), 1, "center", "center" ) end end end ) function dx () dxDrawRectangle(405, 301, 408, 304, tocolor(17, 16, 16, 220), false) dxDrawText("Barman", 433, 291, 775, 392, tocolor(255, 255, 255, 255), 4.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawLine(404, 394, 810, 394, tocolor(255, 255, 255, 255), 2, false) dxDrawLine(404, 398, 812, 398, tocolor(255, 255, 255, 255), 1, false) dxDrawText("Do you want to buy Beer?", 405, 421, 799, 452, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Price : 1000", 406, 459, 677, 499, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawRectangle(407, 537, 151, 58, tocolor(16, 16, 16, 220), false) dxDrawRectangle(638, 537, 151, 58, tocolor(16, 16, 16, 220), false) dxDrawText("Buy", 404, 538, 558, 595, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Close", 638, 538, 789, 595, tocolor(255, 255, 255, 255), 1.50, "bankgothic", "left", "top", false, false, false, false, false) end addEventHandler("onClientRender", root, dx) function button() acceptbtn = guiCreateButton(404, 539, 154, 56, "", false) guiSetAlpha(acceptbtn, 0.00) closebtn = guiCreateButton(638, 540, 151, 55, "", false) guiSetAlpha(closebtn, 0.00) end addEventHandler("onClientResourceStart", resourceRoot, button) marker = createMarker( -836.33, 2734.87, 45.68, "cylinder", 2, 255, 255, 255, 150 ) function close(button,state) if (button == "left" and state == "up") then if (source == closebtn) then removeEventHandler("onClientRender", root, dx) removeEventHandler("onClientResourceStart",resourceRoot, button) end end addEventHandler("onClientGUIClick", getRootElement(), close) end Link to comment
xeon17 Posted July 28, 2015 Share Posted July 28, 2015 local maxDistance = 12 -- the distance showing 3dtext local ped = createPed (2,-836.33, 2734.16, 45.67) addEventHandler ( "onClientRender", root, function ( ) local pX, pY, pZ = getElementPosition ( localPlayer ) local pedX, pedY, pedZ = getElementPosition ( ped ) local distance = getDistanceBetweenPoints3D ( pX, pY, pZ, pedX, pedY, pedZ ) if ( distance <= 12 ) then local x, y = getScreenFromWorldPosition ( pedX, pedY, pedZ ) if ( x and y ) then dxDrawText("Barman", x, y+1, _, _, tocolor(248, 251, 3, 255), 2.00, "pricedown", "left", "top", false, false, false, false, false) -- dxDrawText( "Barman", x, y+1.5, _, _, tocolor( 255, 0, 0, 255 ), 1, "center", "center" ) end end end ) function dx () dxDrawRectangle(405, 301, 408, 304, tocolor(17, 16, 16, 220), false) dxDrawText("Barman", 433, 291, 775, 392, tocolor(255, 255, 255, 255), 4.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawLine(404, 394, 810, 394, tocolor(255, 255, 255, 255), 2, false) dxDrawLine(404, 398, 812, 398, tocolor(255, 255, 255, 255), 1, false) dxDrawText("Do you want to buy Beer?", 405, 421, 799, 452, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Price : 1000", 406, 459, 677, 499, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawRectangle(407, 537, 151, 58, tocolor(16, 16, 16, 220), false) dxDrawRectangle(638, 537, 151, 58, tocolor(16, 16, 16, 220), false) dxDrawText("Buy", 404, 538, 558, 595, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Close", 638, 538, 789, 595, tocolor(255, 255, 255, 255), 1.50, "bankgothic", "left", "top", false, false, false, false, false) end addEventHandler("onClientRender", root, dx) function button() acceptbtn = guiCreateButton(404, 539, 154, 56, "", false) guiSetAlpha(acceptbtn, 0.00) closebtn = guiCreateButton(638, 540, 151, 55, "", false) guiSetAlpha(closebtn, 0.00) end addEventHandler("onClientResourceStart", resourceRoot, button) marker = createMarker( -836.33, 2734.87, 45.68, "cylinder", 2, 255, 255, 255, 150 ) function close(button,state) if (button == "left" and state == "up") then if (source == closebtn) then removeEventHandler("onClientRender", root, dx) end end end addEventHandler("onClientGUIClick", getRootElement(), close) Link to comment
TheSmart Posted July 28, 2015 Author Share Posted July 28, 2015 thank you now its working Link to comment
TheSmart Posted July 28, 2015 Author Share Posted July 28, 2015 wait wait one thing left now how i can make it when player hit the marker dx and button will show? function showgui (hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then -----what now? showCursor(true) end end end addEventHandler("onClientMarkerHit", marker, showgui) Link to comment
xeon17 Posted July 28, 2015 Share Posted July 28, 2015 addEventHandler("onClientRender", root, Link to comment
TheSmart Posted July 28, 2015 Author Share Posted July 28, 2015 ok i have 3 problems 1) when i restart script dx panel open automatic. 2) when i click on buy button it will set animation but it doesn't work. 3) when i went to marker again panel doesn't show just cursor show local maxDistance = 12 -- the distance showing 3dtext local ped = createPed (2,-836.33, 2734.16, 45.67) addEventHandler ( "onClientRender", root, function ( ) local pX, pY, pZ = getElementPosition ( localPlayer ) local pedX, pedY, pedZ = getElementPosition ( ped ) local distance = getDistanceBetweenPoints3D ( pX, pY, pZ, pedX, pedY, pedZ ) if ( distance <= 12 ) then local x, y = getScreenFromWorldPosition ( pedX, pedY, pedZ ) if ( x and y ) then dxDrawText("Barman", x, y+1, _, _, tocolor(248, 251, 3, 255), 2.00, "pricedown", "left", "top", false, false, false, false, false) -- dxDrawText( "Barman", x, y+1.5, _, _, tocolor( 255, 0, 0, 255 ), 1, "center", "center" ) end end end ) function dx () dxDrawRectangle(405, 301, 408, 304, tocolor(17, 16, 16, 220), false) dxDrawText("Barman", 433, 291, 775, 392, tocolor(255, 255, 255, 255), 4.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawLine(404, 394, 810, 394, tocolor(255, 255, 255, 255), 2, false) dxDrawLine(404, 398, 812, 398, tocolor(255, 255, 255, 255), 1, false) dxDrawText("Do you want to buy Beer?", 405, 421, 799, 452, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Price : 1000", 406, 459, 677, 499, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawRectangle(407, 537, 151, 58, tocolor(16, 16, 16, 220), false) dxDrawRectangle(638, 537, 151, 58, tocolor(16, 16, 16, 220), false) dxDrawText("Buy", 404, 538, 558, 595, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Close", 638, 538, 789, 595, tocolor(255, 255, 255, 255), 1.50, "bankgothic", "left", "top", false, false, false, false, false) end addEventHandler("onClientRender", root, dx) function button() buybtn = guiCreateButton(404, 539, 154, 56, "", false) guiSetAlpha(buybtn, 0.00) closebtn = guiCreateButton(638, 540, 151, 55, "", false) guiSetAlpha(closebtn, 0.00) end addEventHandler("onClientResourceStart", resourceRoot, button) marker = createMarker( -836.33, 2734.87, 45.68, "cylinder", 2, 255, 255, 255, 150 ) function close(button,state) if (button == "left" and state == "up") then if (source == closebtn) then removeEventHandler("onClientRender", root, dx) showCursor(false) end end end addEventHandler("onClientGUIClick", getRootElement(), close) function buy(button,state) if (button == "left" and state == "up") then if (source == buybtn) then takePlayerMoney ( 1000 ) setPedAnimation( source, "BAR", "Barserve_glass") showCursor(true) end end end addEventHandler("onClientGUIClick", getRootElement(), buy) function showgui (hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then addEventHandler("onClientRender", resourceRoot, dx) addEventHandler("onResourceStart", root, button) showCursor(true) end end addEventHandler("onClientMarkerHit", marker, showgui) function showguil (leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then removeEventHandler("onClientRender", resourceRoot, dx) removeEventHandler("onClientResourceStart", resourceRoot, button) showCursor(false) end end addEventHandler("onClientMarkerLeave", marker, showguil) tell me where is problem? Link to comment
xeon17 Posted July 28, 2015 Share Posted July 28, 2015 1. Remove line 32 2. The source of this event is button which got clicked, so simply remove source and it should work. 3. Line's 79 and 70 doesn't make sense,remove them. Link to comment
TheSmart Posted July 28, 2015 Author Share Posted July 28, 2015 ahh now panel won't showing when i hit marker local maxDistance = 12 -- the distance showing 3dtext local ped = createPed (2,-836.33, 2734.16, 45.67) addEventHandler ( "onClientRender", root, function ( ) local pX, pY, pZ = getElementPosition ( localPlayer ) local pedX, pedY, pedZ = getElementPosition ( ped ) local distance = getDistanceBetweenPoints3D ( pX, pY, pZ, pedX, pedY, pedZ ) if ( distance <= 12 ) then local x, y = getScreenFromWorldPosition ( pedX, pedY, pedZ ) if ( x and y ) then dxDrawText("Barman", x, y+1, _, _, tocolor(248, 251, 3, 255), 2.00, "pricedown", "left", "top", false, false, false, false, false) no error -- dxDrawText( "Barman", x, y+1.5, _, _, tocolor( 255, 0, 0, 255 ), 1, "center", "center" ) end end end ) function dx() dxDrawRectangle(405, 301, 408, 304, tocolor(17, 16, 16, 220), false) dxDrawText("Barman", 433, 291, 775, 392, tocolor(255, 255, 255, 255), 4.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawLine(404, 394, 810, 394, tocolor(255, 255, 255, 255), 2, false) dxDrawLine(404, 398, 812, 398, tocolor(255, 255, 255, 255), 1, false) dxDrawText("Do you want to buy Beer?", 405, 421, 799, 452, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Price : 1000", 406, 459, 677, 499, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawRectangle(407, 537, 151, 58, tocolor(16, 16, 16, 220), false) dxDrawRectangle(638, 537, 151, 58, tocolor(16, 16, 16, 220), false) dxDrawText("Buy", 404, 538, 558, 595, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Close", 638, 538, 789, 595, tocolor(255, 255, 255, 255), 1.50, "bankgothic", "left", "top", false, false, false, false, false) end function button() buybtn = guiCreateButton(404, 539, 154, 56, "", false) guiSetAlpha(buybtn, 0.00) closebtn = guiCreateButton(638, 540, 151, 55, "", false) guiSetAlpha(closebtn, 0.00) end addEventHandler("onClientResourceStart", resourceRoot, button) marker = createMarker( -836.33, 2734.87, 45.68, "cylinder", 2, 255, 255, 255, 150 ) function close(button,state) if (button == "left" and state == "up") then if (source == closebtn) then removeEventHandler("onClientRender", root, dx) showCursor(false) end end end addEventHandler("onClientGUIClick", getRootElement(), close) function buy(button,state) if (button == "left" and state == "up") then if (source == buybtn) then takePlayerMoney ( 1000 ) setPedAnimation("BAR", "Barserve_glass") showCursor(true) end end end addEventHandler("onClientGUIClick", getRootElement(), buy) function showgui (hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then addEventHandler("onClientRender", resourceRoot, dx) addEventHandler("onResourceStart", root, button) end end addEventHandler("onClientMarkerHit", marker, showgui) function showguil (leaveElement) if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then removeEventHandler("onClientRender", resourceRoot, dx) removeEventHandler("onClientResourceStart", resourceRoot, button) end end addEventHandler("onClientMarkerLeave", marker, showguil) Link to comment
xeon17 Posted July 28, 2015 Share Posted July 28, 2015 local maxDistance = 12 -- the distance showing 3dtext local ped = createPed (2,-836.33, 2734.16, 45.67) addEventHandler ( "onClientRender", root, function ( ) local pX, pY, pZ = getElementPosition ( localPlayer ) local pedX, pedY, pedZ = getElementPosition ( ped ) local distance = getDistanceBetweenPoints3D ( pX, pY, pZ, pedX, pedY, pedZ ) if ( distance <= 12 ) then local x, y = getScreenFromWorldPosition ( pedX, pedY, pedZ ) if ( x and y ) then dxDrawText("Barman", x, y+1, _, _, tocolor(248, 251, 3, 255), 2.00, "pricedown", "left", "top", false, false, false, false, false) no error -- dxDrawText( "Barman", x, y+1.5, _, _, tocolor( 255, 0, 0, 255 ), 1, "center", "center" ) end end end ) function dx() dxDrawRectangle(405, 301, 408, 304, tocolor(17, 16, 16, 220), false) dxDrawText("Barman", 433, 291, 775, 392, tocolor(255, 255, 255, 255), 4.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawLine(404, 394, 810, 394, tocolor(255, 255, 255, 255), 2, false) dxDrawLine(404, 398, 812, 398, tocolor(255, 255, 255, 255), 1, false) dxDrawText("Do you want to buy Beer?", 405, 421, 799, 452, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Price : 1000", 406, 459, 677, 499, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawRectangle(407, 537, 151, 58, tocolor(16, 16, 16, 220), false) dxDrawRectangle(638, 537, 151, 58, tocolor(16, 16, 16, 220), false) dxDrawText("Buy", 404, 538, 558, 595, tocolor(255, 255, 255, 255), 2.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Close", 638, 538, 789, 595, tocolor(255, 255, 255, 255), 1.50, "bankgothic", "left", "top", false, false, false, false, false) end function button() buybtn = guiCreateButton(404, 539, 154, 56, "", false) guiSetAlpha(buybtn, 0.00) closebtn = guiCreateButton(638, 540, 151, 55, "", false) guiSetAlpha(closebtn, 0.00) end addEventHandler("onClientResourceStart", resourceRoot, button) marker = createMarker( -836.33, 2734.87, 45.68, "cylinder", 2, 255, 255, 255, 150 ) function close(button,state) if (button == "left" and state == "up") then if (source == closebtn) then removeEventHandler("onClientRender", root, dx) showCursor(false) end end end addEventHandler("onClientGUIClick", getRootElement(), close) function buy(button,state) if (button == "left" and state == "up") then if (source == buybtn) then takePlayerMoney ( 1000 ) setPedAnimation("BAR", "Barserve_glass") showCursor(true) end end end addEventHandler("onClientGUIClick", getRootElement(), buy) function showgui (hitElement) if (hitElement == localPlayer) then addEventHandler("onClientRender",root, dx) end end addEventHandler("onClientMarkerHit", marker, showgui) function showguil (leaveElement) if (leaveElement == localPlayer) then removeEventHandler("onClientRender", root, dx) end end addEventHandler("onClientMarkerLeave", marker, showguil) Link to comment
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