Jump to content

Dx


TheSmart

Recommended Posts

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

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

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

so i made this but it doesn't work :o

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
so i made this but it doesn't work :o
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 by Guest
Link to comment

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

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

wait wait one thing left :P 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

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

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

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