JoZeFSvK Posted November 2, 2013 Share Posted November 2, 2013 Hey i have problem with login panel when i edit positions for me screen its good but when i edit for other its bad . Problem you can see in video Client.lua lol = 0 createPed(40, 173.35345, -1320.99438, 79.13128) function drawBackround() lol = lol + 1 if getPedOccupiedVehicle(localPlayer) then local x, y, z = getElementPosition(getPedOccupiedVehicle(localPlayer)) setElementPosition(getPedOccupiedVehicle(localPlayer), x, y, z) end if lol > 3350 then setCameraMatrix(-437.14282226563 + lol, -1320 + lol - 3350, 80, 2580, -1628.5712890625, -300, 0, 70) else setCameraMatrix(-437.14282226563 + lol, -1320, 80, 2580, -1628.5712890625, -300, 0, 70) end end addEventHandler("onClientRender", getRootElement(), drawBackround) Xg,Yg =625,299 local scrX,scrY = guiGetScreenSize() local x = scrX/2-Xg/2 local y = scrY/2-Yg/2 local x2 = x+388 image1=0-389 image2=Xg+237 local infoTable = {} function onresourceStart () if image1 < x then image1 = image1+10 guiSetPosition ( left, image1, y, false ) guiSetPosition ( name, image1+162, y+96, false ) guiSetPosition ( pass, image1+162, y+140, false ) guiSetPosition ( login, image1+235, y+175, false ) --guiSetPosition ( label, image1+220, y+214, false ) end if image1 > x+1 then image1 = 299 --outputChatBox(""..image1) end if image2 >= x2 then guiSetPosition ( right, image2, y, false ) guiSetPosition ( register, image2+130, y+220, false ) image2 = image2-5 end if image2 < x2-1 then image2 = image2+1 end end xmlFileName = tostring("login.xml") function HandleTheRendering ( ) confFile = xmlLoadFile("preferences.xml") if (confFile) then infoTable["account"] = xmlNodeGetAttribute(confFile,"username") infoTable["pass"] = xmlNodeGetAttribute(confFile,"pass") else confFile = xmlCreateFile("preferences.xml","user") xmlNodeSetAttribute(confFile,"username","") xmlNodeSetAttribute(confFile,"pass","") infoTable["account"] = getPlayerName(localPlayer) infoTable["pass"] = "" end xmlSaveFile(confFile) guiSetInputEnabled(true) showCursor(true) showChat(false) showPlayerHudComponent("all", false) left = guiCreateStaticImage( image1 , y, 389, Yg, 'img/LLeft.png', false) right = guiCreateStaticImage( image2, y, 237, Yg, 'img/Right.png', false) XxX = guiCreateButton(210,10,20,20,'X',false,right) addEventHandler("onClientGUIClick",XxX,hideLoginWindow2) guiSetAlpha(XxX,0) if (infoTable["account"]) then name = guiCreateEdit( image1, y, 150, 25, infoTable["account"], false) else name = guiCreateEdit( image1, y, 150, 25, '', false) end if (infoTable["pass"]) then pass = guiCreateEdit( image1, y, 150, 25, infoTable["pass"], false) else pass = guiCreateEdit( image1, y, 150, 25, '', false) end login = guiCreateStaticImage( image1, y, 79, 32, 'img/login.png', false) register = guiCreateStaticImage( image1, y, 75, 26, 'img/SignUp.png', false) registerWindow = guiCreateStaticImage( scrX/2-545/2, scrY/2-425/2, 545, 425, 'img/win.png', false) guiSetVisible(registerWindow, false) nameReG = guiCreateEdit( 200, 150, 200, 50, '', false,registerWindow) passReG = guiCreateEdit( 200, 220, 200, 50, '', false,registerWindow) btnConfirmRegistration = guiCreateStaticImage( 200, 300, 168, 71, 'img/sin.png', false,registerWindow) addEventHandler ( "onClientRender", root, onresourceStart ) -- keep the text visible with onClientRender. addEventHandler("onClientGUIClick",login,onClickLogin) addEventHandler("onClientGUIClick",register,onClickRegisterToggle) addEventHandler("onClientGUIClick",btnConfirmRegistration,onClickRegisterConfirm) for i,k in ipairs(getElementsByType("gui-staticimage")) do if k ~= registerWindow then guiSetProperty(k,'RiseOnClick','False') else end end end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering ) function hideLoginWindow2(button,state) playSound("sounds/hover.mp3", false) if(button == "left" and state == "up") then if (source == XxX) then guiSetVisible(registerWindow, false) guiSetInputEnabled(false) guiSetVisible(left, false) guiSetVisible(name, false) guiSetVisible(right, false) guiSetVisible(pass, false) guiSetVisible(login, false) guiSetVisible(register, false) showCursor(false) showChat(true) showPlayerHudComponent("all", true) removeEventHandler ( "onClientRender", root, onresourceStart ) -- keep the text visible with onClientRender. removeEventHandler("onClientRender", getRootElement(), drawBackround) removeEventHandler("onClientRender", getRootElement(), kokotnosti) end end end function hideRegisterWindow() showChat(true) showPlayerHudComponent("all", true) guiSetInputEnabled(true) guiSetVisible(registerWindow, false) showCursor(true) end addEvent("hideRegisterWindow", true) addEventHandler("hideRegisterWindow", getRootElement(), hideRegisterWindow) function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible(left, false) guiSetVisible(name, false) guiSetVisible(right, false) guiSetVisible(pass, false) guiSetVisible(login, false) guiSetVisible(register, false) showCursor(false) showChat(true) showPlayerHudComponent("all", true) removeEventHandler ( "onClientRender", root, onresourceStart ) -- keep the text visible with onClientRender. removeEventHandler("onClientRender", getRootElement(), drawBackround) end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow) function onClickRegisterConfirm(button,state) playSound("sounds/hover.mp3", false) if(button == "left" and state == "up") then if (source == btnConfirmRegistration) then username = guiGetText(nameReG) password = guiGetText(passReG) passwordConfirm = guiGetText(passReG) triggerServerEvent("onRequestRegister",getLocalPlayer(),username,password,passwordConfirm) end end end function onClickLogin(button,state) if(button == "left" and state == "up") then if (source == login) then username = guiGetText(name) password = guiGetText(pass) triggerServerEvent("onRequestLogin",getLocalPlayer(),username,password) toggleSavePassword(true, username, password) end end end function toggleSavePassword(save, name, pass) confFile = xmlLoadFile("preferences.xml") xmlNodeSetAttribute(confFile, "username", name) xmlNodeSetAttribute(confFile, "pass", pass) xmlSaveFile(confFile) end function onClickRegisterToggle(button,state) if(button == "left" and state == "up") then if (source == register) then guiSetVisible(registerWindow, true) guiBringToFront(registerWindow) guiSetInputEnabled(true) showCursor(true) showChat(false) showPlayerHudComponent("all", false) end end end addEventHandler( "onClientMouseEnter", getRootElement(), function () if (source == login) then guiStaticImageLoadImage ( login, "img/login2.png" ) playSound("sounds/hover.mp3", false) elseif (source == register) then guiStaticImageLoadImage ( register, "img/SignUp2.png" ) playSound("sounds/hover.mp3", false) end end ) addEventHandler("onClientMouseLeave", getRootElement(),function () if (source == login ) then guiStaticImageLoadImage ( source, "img/login.png" ) elseif (source == register ) then guiStaticImageLoadImage ( source, "img/SignUp.png" ) end end ) Link to comment
JoZeFSvK Posted November 3, 2013 Author Share Posted November 3, 2013 nobody dont know help with this problem ? 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