Piorun Posted April 1, 2011 Share Posted April 1, 2011 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
Castillo Posted April 1, 2011 Share Posted April 1, 2011 Sorry, i don't understand what do you want to do, could you explain it a bit more? Link to comment
Piorun Posted April 1, 2011 Author Share Posted April 1, 2011 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
proracer Posted April 1, 2011 Share Posted April 1, 2011 Why are you using serverside code? All the codes is also available in clientside. Link to comment
Castillo Posted April 1, 2011 Share Posted April 1, 2011 Because, he wants the pickup to be shown for everyone Link to comment
Piorun Posted April 2, 2011 Author Share Posted April 2, 2011 I found a problem. I have too many times state=="up". I change once to state=="down" and it works 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