Sasu Posted March 26, 2013 Posted March 26, 2013 function select() addEventHandler("onClientRender", getLocalPlayer(), draw) showCursor(true) setElementFrozen(localPlayer, true) end addEventHandler("onClientPlayerJoin", getLocalPlayer(), onSelectLanguage) Why this dont work? State: Inactive
ZL|LuCaS Posted March 26, 2013 Posted March 26, 2013 (edited) function select() addEventHandler("onClientRender", getLocalPlayer(), draw) showCursor(true) setElementFrozen(localPlayer, true) end addEventHandler("onClientResourceStart", getLocalPlayer(), select) Edited March 26, 2013 by Guest MTA Scripters. ♥♥♥Beijinhos♥♥♥
Castillo Posted March 26, 2013 Posted March 26, 2013 "onClientPlayerJoin" is only triggered when a remote player joins, use "onClientResourceStart" instead. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sasu Posted March 26, 2013 Author Posted March 26, 2013 I want that create dx when a player join. State: Inactive
Castillo Posted March 26, 2013 Posted March 26, 2013 Do what I said above. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sasu Posted March 26, 2013 Author Posted March 26, 2013 Ahh yes. You are right. Well, I asked you solid about this : function clickSelect(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) local showing = isCursorShowing () if showing then local x1, y1, wx, wy, wz = getCursorPosition() if x1 == 0.18671875 and y1 == 0.401 then removeEventHandler("onClientRender", getLocalPlayer(), draw) showCursor(false) setElementFrozen(localPlayer, false) setElementData( localPlayer, "Idioma", "Español") elseif x1 == 0.551 and y1 == 0.401 then removeEventHandler("onClientRender", getLocalPlayer(), draw) showCursor(false) setElementFrozen(localPlayer, false) setElementData( localPlayer, "Idioma", "English") end end end addEventHandler("onClientClick", root, clickSelect) I tested but dont works. State: Inactive
Castillo Posted March 26, 2013 Posted March 26, 2013 Try debugging your script, add outputs after 'if''s' and so on. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sasu Posted March 26, 2013 Author Posted March 26, 2013 Nothing :_ function clickSelect(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) local showing = isCursorShowing () if showing then local x1, y1, wx, wy, wz = getCursorPosition() if x1 == x*0.18671875 and y1 == y*0.401 then removeEventHandler("onClientRender", getLocalPlayer(), draw) outputChatBox("Ha seleccionado el Idioma \"Español\" .", 0, 255, 0, false) showCursor(false) setElementFrozen(localPlayer, false) setElementData( localPlayer, "Idioma", "Español") elseif x1 == x*0.551 and y1 == y*0.401 then removeEventHandler("onClientRender", getLocalPlayer(), draw) outputChatBox("You selected the language \"English\" .", 0, 255, 0, false) showCursor(false) setElementFrozen(localPlayer, false) setElementData( localPlayer, "Idioma", "English") end end end addEventHandler("onClientClick", root, clickSelect) See the dx: function draw() dxDrawRectangle(0, 0, x*1, y*1, tocolor(0, 0, 0, 206), false) dxDrawImage(x*0.18671875, y*0.401, x*0.275, y*0.322, "images/espanol.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawImage(x*0.551, y*0.401, x*0.275, y*0.322, "images/ingles.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) dxDrawText("Elige tu idioma / Select your language", x*0.17421875, y*0.0846354166666667, x*0.83984375, y*0.1640625, tocolor(255, 255, 255, 255), 2.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("Español", x*0.2546875, y*0.2994791666666667, x*0.39296875, y*0.3645833333333333, tocolor(255, 255, 255, 255), 2.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("English", x*0.6140625, y*0.2994791666666667, x*0.740625, y*0.3671875, tocolor(255, 255, 255, 255), 2.00, "pricedown", "left", "top", false, false, true, false, false) end State: Inactive
Castillo Posted March 26, 2013 Posted March 26, 2013 if x1 == x*0.18671875 and y1 == y*0.401 then Where is "x" defined? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
xXMADEXx Posted March 26, 2013 Posted March 26, 2013 try using "root" instead of "getLocalPlayer()" like: addEventHandler("onClientRender",root,draw) removeEventHandler("onClientRender",root,draw) The Ultimate Lua Tutorial! | MTA PHP SDK
Sasu Posted March 26, 2013 Author Posted March 26, 2013 if x1 == x*0.18671875 and y1 == y*0.401 then Where is "x" defined? local x,y = guiGetScreenSize() State: Inactive
Castillo Posted March 27, 2013 Posted March 27, 2013 The problem is on your 'if' to check for clicked position. I got a question, why don't you just use GUI images? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sasu Posted March 27, 2013 Author Posted March 27, 2013 Can I create a gui image without window? State: Inactive
iPrestege Posted March 27, 2013 Posted March 27, 2013 Can I create a gui image without window? Yep , You can ;P .
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