Jump to content

Another problem with clicking ...


Piorun

Recommended Posts

Hi, i create some script:

Client:

  
function clickExample(button, state) 
if button == "left" and state == "up" then 
    
   biznescreation = 1 
   guiSetVisible(GUIEditor_Window[1], false) 
   GUIEditor_Window[2] = guiCreateWindow(312,284,400,200,"Tworzenie biznesu cz.1",false) 
   guiWindowSetSizable(GUIEditor_Window[2],false) 
   GUIEditor_Edit[1] = guiCreateEdit(9,59,381,26,"",false,GUIEditor_Window[2]) 
   GUIEditor_Label[4] = guiCreateLabel(14,37,133,18,"Nazwa",false,GUIEditor_Window[2]) 
   guiLabelSetColor(GUIEditor_Label[4],255,255,255) 
   guiLabelSetVerticalAlign(GUIEditor_Label[4],"top") 
   guiLabelSetHorizontalAlign(GUIEditor_Label[4],"left",false) 
   GUIEditor_Button[1] = guiCreateButton(297,165,93,24,"Dalej",false,GUIEditor_Window[2]) 
   guiSetFont(GUIEditor_Button[1],"default-bold-small") 
   addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], secBiznes, false ) 
    
end 
end 
  
function secBiznes() 
   biznesname = guiGetText(GUIEditor_Edit[1]) 
   guiSetVisible(GUIEditor_Window[2], false) 
   biznescreation = 2 
end 
  
addEventHandler("onClientClick", getRootElement(), 
function (button, state, ax, ay, wx, wy, wz) 
   if state=="up" and button=="left" and biznescreation==2 then 
      triggerServerEvent("onPickupBiznesCreate",getLocalPlayer(), wx, wy, wz) 
      biznescreation = 0 
      showCursor(false) 
   end 
end) 
  
function endBiznesCreation() 
    for i,v in pairs(getElementsByType("pickup")) do 
    if getElementData(v,"text") then 
    local px, py, pz = getElementPosition (getLocalPlayer()) 
    local wx, wy, wz = getElementPosition(v) 
    dist = getDistanceBetweenPoints3D ( px, py, pz, wx, wy, wz ) 
    if dist < 20.0 then 
       local x, y = getScreenFromWorldPosition ( wx, wy, wz+0.5 ) 
       if x then 
          dxDrawText(biznesname,x,y+2,x+2,y,tocolor(0,0,0),1,"default-bold","center","center") 
          dxDrawText(biznesname,x,y,x,y,tocolor(49,140,231),1,"default-bold","center","center") 
             end 
          end 
       end 
    end 
end 
addEventHandler("onClientRender",getRootElement(),endBiznesCreation) 
  

Server

  
function pickupBiznes(wx, wy, wz) 
  pickup = createPickup(wx,wy,wz+1,3,1272,0) 
  setElementData(pickup,"text",true) 
end 
addEvent("onPickupBiznesCreate", true) 
addEventHandler("onPickupBiznesCreate", getRootElement(), pickupBiznes) 
  

Everything is cool - when i'm clicking on image function works, and when i'm clicking on button ("Dalej"), then window are not visible and pickup is creating. I want to click on the button, and after that (and after disable window), and after click on the world create a pickup, not at once.

Link to comment

I want to:

1. Create a Window with a Edit

2. After click on button called "Dalej" and after click on world create a pickup with the dxText

Everything is working (with my code), but when i'm clicking on button pickup is creating too. This is my problem.

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