Lucario Posted May 26, 2013 Share Posted May 26, 2013 I have added to my login panel a skin selector, but the problem is, when i click on the gui, on the another part of the gui, the skin selector appear, i want the skin selector appear when i click register, how can i change it? Client: GUIEditor = { checkbox = {}, staticimage = {}, edit = {}, button = {}, window = {}, label = {}, memo = {} } ventanalogin = guiCreateWindow(278, 47, 701, 666, "Panel de Login Juramento", false) guiWindowSetSizable(ventanalogin, false) guiWindowSetMovable(ventanalogin, true) xml = xmlLoadFile( "server.xml" ) contents = xmlNodeGetValue( xml ) memo = guiCreateMemo(9, 466, 682, 190, contents, false, ventanalogin) guiMemoSetReadOnly(memo,true) usuario = guiCreateLabel(299, 26, 147, 41, "Usuario:", false, ventanalogin) guiSetFont(usuario, "sa-header") clave = guiCreateLabel(482, 26, 192, 40, "Contraseña:", false, ventanalogin) guiSetFont(clave, "sa-header") Edit_Login = guiCreateEdit(299, 77, 147, 39, "", false, ventanalogin) Edit_Password = guiCreateEdit(482, 76, 159, 40, "", false, ventanalogin) lgnBtn = guiCreateButton(367, 126, 193, 91, "Entrar", false, ventanalogin) guiSetFont(lgnBtn, "sa-header") guiSetProperty(lgnBtn, "NormalTextColour", "FF0000FF") guardar1 = guiCreateCheckBox(645, 91, 15, 16, "", false, false, ventanalogin) guardar2 = guiCreateCheckBox(451, 91, 15, 15, "", false, false, ventanalogin) usuario2 = guiCreateLabel(299, 257, 143, 41, "Usuario:", false, ventanalogin) guiSetFont(usuario2, "sa-header") clave2 = guiCreateLabel(479, 257, 192, 41, "Contraseña:", false, ventanalogin) guiSetFont(clave2, "sa-header") Edit_Login2 = guiCreateEdit(299, 308, 143, 41, "", false, ventanalogin) Edit_Password2 = guiCreateEdit(479, 308, 192, 41, "", false, ventanalogin) RgsBtn = guiCreateButton(362, 355, 193, 101, "Registrarse", false, ventanalogin) guiSetFont(RgsBtn, "sa-header") guiSetProperty(RgsBtn, "NormalTextColour", "FF00FF00") info = guiCreateLabel(14, 257, 285, 209, "Info Importante:\n\nPara Recordar Contraseña, Deja las Casillas\nAl Entrar al Servidor, Automaticamente Se\nMuestra la Pass.\nLean la Info de Abajo (Importante)\nNo Recomendable Hacer Videos o Imagenes\nTeniendo Abierto el Panel.\nTodavia No Existe la Opcion Cambiar Pass, Si\nQuieren Hacer un Video, Creense Otra Cuenta al \nEntrar.\no Desmarcan las Casillas de Verificacion\nDisfruten del Servidor Sigan las Reglas y Apreten\n.F4 Para Abrir el Panel de Ayuda", false, ventanalogin) guiSetFont(info, "default-bold-small") guiLabelSetColor(info, 0, 255, 0) juralogo = guiCreateStaticImage(18, 20, 275, 237, ":login_panel/logo.png", false, ventanalogin) showCursor(true) addEventHandler("onClientGUIClick",lgnBtn, function ( ) local User = guiGetText ( Edit_Login ) local Password = guiGetText ( Edit_Password ) if User and Password then triggerServerEvent("onPlayerTryingToLogin",localPlayer,User,Password) end end,false ) addEventHandler("onClientGUIClick",RgsBtn, function ( ) local User = guiGetText ( Edit_Login2 ) local Password = guiGetText ( Edit_Password2 ) if User and Password then triggerServerEvent("onPlayerTryingToRegister",localPlayer,User,Password) end end,false ) addEvent("PlayerLogedOnClient",true) addEventHandler("PlayerLogedOnClient",getRootElement(), function ( ) xmlFileHandler(guiCheckBoxGetSelected(guardar1)) xmlFileHandler(guiCheckBoxGetSelected(guardar2)) guiSetVisible(ventanalogin,false) end ) function xmlFileHandler(gReturn) if gReturn == true then setElementData(localPlayer, "LoginAuto", true) else setElementData(localPlayer, "LoginAuto", false) end sName = "Login" xmlFileName = tostring("login_" .. sName .. ".xml") local xmlFile = xmlLoadFile(xmlFileName) if not xmlFile then xmlFile = xmlCreateFile(xmlFileName, "settings") xmlNodeSetAttribute(xmlFile, "autologin", tostring(getElementData(localPlayer, "LoginAuto"))) end xmlNodeSetAttribute(xmlFile, "autologin", tostring(getElementData(localPlayer, "LoginAuto"))) xmlNodeSetAttribute(xmlFile, "username", tostring(guiGetText(Edit_Login))) xmlNodeSetAttribute(xmlFile, "password", tostring(guiGetText(Edit_Password,password))) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end function XML() sName = "Login" xmlFileName = tostring("login_" .. sName .. ".xml") local xmlFile = xmlLoadFile(xmlFileName) if xmlFile then status = xmlNodeGetAttribute(xmlFile, "autologin") end if status == "true" then local username = tostring(xmlNodeGetAttribute(xmlFile, "username")) local password = tostring(xmlNodeGetAttribute(xmlFile, "password")) if username ~= "" and password ~= "" then guiCheckBoxSetSelected(guardar1,true) guiCheckBoxSetSelected(guardar2,true) guiSetText(Edit_Login,username) guiSetText(Edit_Password,password) end end end setTimer( XML,50, 1) local x, y = guiGetScreenSize() SkinMusic = "data/music/SkinSelectMusic.mp3" SkinAnims = {"dnce_M_b","DAN_Left_A","DAN_Down_A","DAN_Loop_A"} StartSkin = 0 NewSkin = false function SelectSkin () setElementInterior ( getLocalPlayer(), 0, 0,0,0 ) setCameraMatrix( 1997.3852539063, -2329.8051757813, 14.718949317932, 1996.6430664063, -2423.5083007813, -20.197387695313) skin = createPed ( StartSkin, 1997.4000244141,-2332.8999023438,13.5 ) setPedAnimation( skin, "DANCING", SkinAnims[math.random(1,4)]) fadeCamera( true, 10) setTime(0,0) SkinSelectMusic = playSound(SkinMusic,true) addEventHandler("onClientRender",getRootElement(),dxDrawInfo) bindKey("arrow_r","down",NextSkin) bindKey("arrow_l","down",LastSkin) bindKey(".","down",SpawnPlayer) showChat(false) showPlayerHudComponent ( "radar", false ) end addEventHandler("onClientGUIClick", RgsBtn, SelectSkin) function dxDrawInfo () dxDrawText("Elige Bien tu Skin, No Podras Cambiartelo Hasta Que Tengas Ciertos Requisitos", 183, 204, 1052, 254, tocolor(239, 255, 0, 255), 1.00, "pricedown", "center", "center", false, false, true, false, false) end addEventHandler( "onClientGUIClick", RgsBtn, function() SelectSkin() FreezeBots() end) function SpawnPlayer() local r,g,b = math.random(0,255),math.random(0,255),math.random(0,255) triggerServerEvent ( "onClientWantsToSpawn", getLocalPlayer(), getLocalPlayer(),StartSkin,r,g,b ) unbindKey("arrow_r","down",NextSkin) unbindKey("arrow_l","down",LastSkin) unbindKey("lshift","down",SpawnPlayer) setTime(12,0) stopSound(SkinSelectMusic) removeEventHandler("onClientRender",getRootElement(),dxDrawInfo) showCursor(false) showChat(true) showPlayerHudComponent ( "radar", true ) guiSetVisible(lnextskin,false) guiSetVisible(rnextskin,false) guiSetVisible(spawnskin,false) setElementData(getLocalPlayer(),"red",r) setElementData(getLocalPlayer(),"green",g) setElementData(getLocalPlayer(),"blue",b) end function NextSkin() if StartSkin == 312 then StartSkin = -1 elseif StartSkin == 2 then StartSkin = 8 end StartSkin = StartSkin + 1 setElementModel(skin,StartSkin) setPedAnimation( skin, "DANCING", SkinAnims[math.random(1,4)]) SkinJobTextColor() end function LastSkin() if StartSkin == 0 then StartSkin = 313 elseif StartSkin == 9 then StartSkin = 3 end StartSkin = StartSkin - 1 setElementModel(skin,StartSkin) setPedAnimation( skin, "DANCING", SkinAnims[math.random(1,4)]) SkinJobTextColor() end function loadButtons () lnextskin = guiCreateButton(x-x/1.30,y/1.22,x/5,y/20,"<--",false) guiSetProperty(lnextskin,"PushedTextColour","FFFFFF00") guiSetFont(lnextskin,"sa-header") rnextskin = guiCreateButton(x-x/2.90,y/1.22,x/5,y/20,"-->",false) guiSetProperty(rnextskin,"PushedTextColour","FFFFFF00") guiSetFont(rnextskin,"sa-header") spawnskin = guiCreateButton(x-x/1.80,y/1.22,x/5,y/20,"Elegir",false) guiSetProperty(spawnskin,"PushedTextColour","FFFFFF00") guiSetFont(spawnskin,"sa-header") end addEventHandler ("onClientGUIClick", RgsBtn, loadButtons) addEventHandler( "onClientGUIClick", getRootElement(), function() if source == lnextskin then LastSkin() elseif source == rnextskin then NextSkin() elseif source == spawnskin then SpawnPlayer() end end) ------PEDS function FreezeBots() local Bots = getElementsByType("ped") for k,v in ipairs(Bots) do setElementFrozen(v,true) end end Server: addEvent("onPlayerTryingToLogin",true) addEventHandler("onPlayerTryingToLogin",getRootElement(), function ( User,Password ) if User ~= " " or User ~= " " then if Password ~= " " or Password ~= " " then if ( account ~= false ) then if not (username == "") then if not (password == "") then local account = getAccount ( User,Password ) if ( account ) then logIn ( source,account,Password ) triggerClientEvent(source,"PlayerLogedOnClient",source) showCursor(source,false) outputChatBox("* Has Entrado con Exito",source,0,255,0) else outputChatBox("* Usuario y/o Contraseña Incorrectos",source,255,0,0) end else outputChatBox ("Escribe Tu Contraseña!",source,255,0,0,true) end else outputChatBox ("Escribe Tu Nombre de Usuario",source,255,0,0) end end end end end ) addEvent("onPlayerTryingToRegister",true) addEventHandler("onPlayerTryingToRegister",getRootElement(), function ( User,Password ) if User ~= " " or User ~= " " then if Password ~= " " or Password ~= " " then if not (username == "") then if not (password == "") then if ( account ~= true ) then local account = getAccount ( User,Password ) addAccount ( User,Password ) triggerClientEvent(source,"PlayerLogedOnClient",source) outputChatBox("* Te Has Registrado Con Exito Con Tu Nueva Cuenta!",source,0,255,0) outputChatBox("* Usuario : "..User.." Contraseña : "..Password.." ",source,0,255,0) else outputChatBox("* Esta Cuenta Ya Existe",source,255,0,0) end else outputChatBox ("Escribe Tu Usuario",source,255,0,0) end else outputChatBox ("Escribe Tu Contraseña",source,255,0,0) end end end end ) playerSkin = {} Garages = {0,1,2,3,4,5,6,7,8,9,10, 11,12,13,14,15,16,17,18,19,20, 21,22,23,24,25,26,27,28,29,30, 31,32,33,34,35,36,37,38,39,40, 41,42,43,44,45,46,47,48,49} spawnTeam = createTeam ("Civiles", 255, 255, 255) function SpawnPlayer(thePlayer,skin,r,g,b) spawnPlayer ( thePlayer, 213.76528930664,1865.5185546875,13.140625, 180.0, skin, 0, 0, spawnTeam ) setCameraTarget (source, source) playerSkin[thePlayer] = {skin,r,g,b} setElementData(thePlayer,"Score",0) setPlayerNametagShowing ( thePlayer, false) end addEvent( "onClientWantsToSpawn", true ) addEventHandler( "onClientWantsToSpawn", getRootElement(), SpawnPlayer ) And i want to add this messages to the login panel, how can i make it? client: function dxLoginMessage() dxDrawText("Recordatorio: Apreta F4 Para Abrir/Cerrar el Panel de Ayuda", 240, 337, 1139, 376, tocolor(0, 0, 0, 255), 0.85, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Recordatorio: Apreta F4 Para Abrir/Cerrar el Panel de Ayuda", 240, 335, 1139, 374, tocolor(0, 0, 0, 255), 0.85, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Recordatorio: Apreta F4 Para Abrir/Cerrar el Panel de Ayuda", 238, 337, 1137, 376, tocolor(0, 0, 0, 255), 0.85, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Recordatorio: Apreta F4 Para Abrir/Cerrar el Panel de Ayuda", 238, 335, 1137, 374, tocolor(0, 0, 0, 255), 0.85, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Recordatorio: Apreta F4 Para Abrir/Cerrar el Panel de Ayuda", 239, 336, 1138, 375, tocolor(0, 255, 0, 255), 0.85, "bankgothic", "left", "top", false, false, true, false, false) end function dxJoinMessage() dxDrawText("Espera Mientras Cargue el Servidor, \nNo Tardara Mucho, y Te Sumergiras al Mejor Servidor \nde Mta San Andreas. \nEn Total Tenemos 2 Servidores, Juramento Freeroam \ny Juramento Zombie Roleplay", 248, 316, 1012, 456, tocolor(0, 0, 0, 255), 0.85, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Espera Mientras Cargue el Servidor, \nNo Tardara Mucho, y Te Sumergiras al Mejor Servidor \nde Mta San Andreas. \nEn Total Tenemos 2 Servidores, Juramento Freeroam \ny Juramento Zombie Roleplay", 248, 314, 1012, 454, tocolor(0, 0, 0, 255), 0.85, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Espera Mientras Cargue el Servidor, \nNo Tardara Mucho, y Te Sumergiras al Mejor Servidor \nde Mta San Andreas. \nEn Total Tenemos 2 Servidores, Juramento Freeroam \ny Juramento Zombie Roleplay", 246, 316, 1010, 456, tocolor(0, 0, 0, 255), 0.85, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Espera Mientras Cargue el Servidor, \nNo Tardara Mucho, y Te Sumergiras al Mejor Servidor \nde Mta San Andreas. \nEn Total Tenemos 2 Servidores, Juramento Freeroam \ny Juramento Zombie Roleplay", 246, 314, 1010, 454, tocolor(0, 0, 0, 255), 0.85, "bankgothic", "left", "top", false, false, true, false, false) dxDrawText("Espera Mientras Cargue el Servidor, \nNo Tardara Mucho, y Te Sumergiras al Mejor Servidor \nde Mta San Andreas. \nEn Total Tenemos 2 Servidores, Juramento Freeroam \ny Juramento Zombie Roleplay", 247, 315, 1011, 455, tocolor(0, 0, 255, 255), 0.85, "bankgothic", "left", "top", false, false, true, false, false) end addEvent("JoinDx",true) addEventHandler("JoinDx",root, function ( ) addEventHandler("onClientRender",root,dxJoinMessage) end ) addEvent("LoginDx",true) addEventHandler("LoginDx",root, function ( ) removeEventHandler("onClientRender",root,dxJoinMessage) addEventHandler("onClientRender",root,dxLoginMessage) setTimer ( function ( ) removeEventHandler("onClientRender",root,dxLoginMessage) end,6000,1 ) end ) server: function dxJoinFunction ( ) triggerClientEvent(source,"JoinDx",source) end addEventHandler("onPlayerJoin", root, dxJoinFunction) function dxLoginFunction ( ) triggerClientEvent(source,"LoginDx",source) end addEventHandler("onPlayerLogin", root, dxLoginFunction) i want the messages appears when a player enter, the second message, and when a player login/register, the first dx message, but when the download bar finish, and appear the login panel, hide the second message for prevent estorb the login panel Link to comment
iPrestege Posted May 26, 2013 Share Posted May 26, 2013 function SelectSkin () setElementInterior ( getLocalPlayer(), 0, 0,0,0 ) setCameraMatrix( 1997.3852539063, -2329.8051757813, 14.718949317932, 1996.6430664063, -2423.5083007813, -20.197387695313) skin = createPed ( StartSkin, 1997.4000244141,-2332.8999023438,13.5 ) setPedAnimation( skin, "DANCING", SkinAnims[math.random(1,4)]) fadeCamera( true, 10) setTime(0,0) SkinSelectMusic = playSound(SkinMusic,true) addEventHandler("onClientRender",getRootElement(),dxDrawInfo) bindKey("arrow_r","down",NextSkin) bindKey("arrow_l","down",LastSkin) bindKey(".","down",SpawnPlayer) showChat(false) showPlayerHudComponent ( "radar", false ) end addEventHandler("onClientGUIClick", RgsBtn,SelectSkin,false) Link to comment
Lucario Posted May 26, 2013 Author Share Posted May 26, 2013 Dont work , When i click on the gui, the skin selector output, and i need if they click on register Link to comment
fmj02 Posted May 26, 2013 Share Posted May 26, 2013 Just add statement for showing skin selector in addEventHandler("onClientGUIClick",RgsBtn,function() here end Your code is ugly anyways, what is the function or event for showing skin selector? I don't want to dive so deep into it.. You should better make a one function for showing all skin selector elements. I see it's in parts. Link to comment
Lucario Posted May 26, 2013 Author Share Posted May 26, 2013 It doesnt have function for open the skin selector, only when a player press the button register of my login panel, output the skin selector Link to comment
fmj02 Posted May 26, 2013 Share Posted May 26, 2013 (edited) Show the line which causes when i click on the gui, on the another part of the gui, the skin selector appear Edit: show the lines corresponding for showing the skin selector then. Edited May 26, 2013 by Guest Link to comment
Lucario Posted May 26, 2013 Author Share Posted May 26, 2013 I cant find the line, if i was founded, i was fixed it 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