Jump to content

how I can save a Skin ?


iFoReX

Recommended Posts

Im doing a Dx Login Register for my server :)

but I dont know how save the skin choose for the player

here the codes

cl-side

------------------------- 
----Intro GUI------------ 
BI = {} 
  
BI[1] = guiCreateButton(0.3625,0.155,0.257,0.2817,"REGISTRARME",true) 
guiSetVisible(BI[1],false) 
guiSetAlpha(BI[1],0) 
  
BI[2] = guiCreateButton(0.3625,0.445,0.257,0.3367,"REGISTRARME",true) 
guiSetVisible(BI[2],false) 
guiSetAlpha(BI[2],0) 
  
    function iGui() 
        dxDrawText("Si Tienes una cuenta logeate aqui.",474.0,309.0,782.0,347.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,true) 
        dxDrawText("Logearme",471.0,275.0,669.0,301.0,tocolor(255,255,255,255),1.0,"bankgothic","left","top",false,false,true) 
        dxDrawRectangle(465.0,266.0,327.0,203.0,tocolor(0,0,0,180),false) 
        dxDrawText("Si no tienes Cuenta puedes registrarte aqui.",471.0,125.0,714.0,141.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,true) 
        dxDrawText("Registrarme",470.0,99.0,777.0,151.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,true) 
        dxDrawRectangle(466.0,95.0,325.0,170.0,tocolor(0,0,0,180),false) 
        dxDrawRectangle(465.0,94.0,328.0,376.0,tocolor(0,0,0,200),false) 
    end 
     
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),function()addEventHandler("onClientRender",root, iGui) showCursor(true) 
guiSetVisible(BI[1],true) guiSetVisible(BI[2],true) triggerServerEvent("CameraAirport",getLocalPlayer()) end) 
  
addEventHandler("onClientGUIClick",root, 
function() 
if source == BI[1] then 
guiSetVisible(BI[1],false) 
guiSetVisible(BI[2],false) 
removeEventHandler("onClientRender",root, iGui) 
addEventHandler("onClientRender",root, RGui) 
guiSetVisible(BR[1],true) 
guiSetVisible(BR[2],true) 
guiSetVisible(BR[3],true) 
guiSetVisible(ER.U,true) 
guiSetVisible(ER.P,true) 
guiSetVisible(ER.CP,true) 
guiSetVisible(ER.S,true) 
elseif source == BI[2] then 
guiSetVisible(BI[1],false) 
guiSetVisible(BI[2],false) 
removeEventHandler("onClientRender",root, iGui) 
addEventHandler("onClientRender",root, lGui) 
guiSetVisible(BL[1],true) 
guiSetVisible(BL[2],true) 
guiSetVisible(EL.U,true) 
guiSetVisible(EL.P,true) 
elseif source == BR[3] then 
guiSetVisible(BI[1],true) 
guiSetVisible(BI[2],true) 
addEventHandler("onClientRender",root, iGui) 
removeEventHandler("onClientRender",root, RGui) 
guiSetVisible(BR[1],false) 
guiSetVisible(BR[2],false) 
guiSetVisible(BR[3],false) 
guiSetVisible(ER.U,false) 
guiSetVisible(ER.P,false) 
guiSetVisible(ER.CP,false) 
guiSetVisible(ER.S,false) 
elseif source == BL[2] then 
guiSetVisible(BI[1],true) 
guiSetVisible(BI[2],true) 
addEventHandler("onClientRender",root, iGui) 
removeEventHandler("onClientRender",root, lGui) 
guiSetVisible(BL[1],false) 
guiSetVisible(BL[2],false) 
guiSetVisible(EL.U,false) 
guiSetVisible(EL.P,false) 
end 
end 
) 
---------------------------------------------------------- 
  
--------------------------- 
-----Register GUI---------- 
BR = {} 
ER = {} 
  
BR[1] = guiCreateButton(0.357,0.575,0.093,0.0317,"IDS",true) 
guiSetVisible(BR[1],false) 
guiSetAlpha(BR[1],0) 
  
BR[2] = guiCreateButton(0.5461,0.6367,0.1008,0.03,"Registrarme",true) 
guiSetVisible(BR[2],false) 
guiSetAlpha(BR[2],0) 
  
BR[3] = guiCreateButton(0.3547,0.63,0.0781,0.04,"Atras",true) 
guiSetVisible(BR[3],false) 
guiSetAlpha(BR[3],0) 
  
ER.U = guiCreateEdit(0.3945,0.3483,0.107,0.0417,"",true) 
guiSetVisible(ER.U,false) 
  
ER.P = guiCreateEdit(0.4422,0.4067,0.107,0.0417,"",true) 
guiSetVisible(ER.P,false) 
  
ER.CP = guiCreateEdit(0.5109,0.455,0.107,0.0417,"",true) 
guiSetVisible(ER.CP,false) 
  
ER.S = guiCreateEdit(0.3992,0.5033,0.0734,0.04,"",true) 
guiSetVisible(ER.S,false) 
  
-- Direct X Drawing 
    function RGui() 
        dxDrawText("<- Volver",455.0,382.0,581.0,405.0,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,true) 
        dxDrawRectangle(446.0,166.0,410.0,244.0,tocolor(0,0,0,200),false) 
        dxDrawText("Registracion de Datos",448.0,167.0,708.0,187.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,true) 
        dxDrawText("Nick",463.0,214.0,501.0,230.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Contraseña",463.0,248.0,563.0,264.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Confirmar Contraseña",462.0,276.0,649.0,291.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Skins",462.0,306.0,581.0,327.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Registrarme",702.0,383.0,825.0,401.0,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,true) 
    end 
---------------------------------------------------------------- 
  
----------------------------- 
---Login GUI----------------- 
BL = {} 
EL = {} 
  
BL[1] = guiCreateButton(0.4555,0.6033,0.1023,0.0433,"Logearme",true) 
guiSetVisible(BL[1],false) 
guiSetAlpha(BL[1],0) 
  
BL[2] = guiCreateButton(0.3508,0.5883,0.0742,0.0333,"ATRAS",true) 
guiSetVisible(BL[2],false) 
guiSetAlpha(BL[2],0) 
  
EL.U = guiCreateEdit(0.4375,0.405,0.1102,0.0433,"",true) 
guiSetVisible(EL.U,false) 
  
EL.P = guiCreateEdit(0.4375,0.4617,0.1102,0.0433,"",true) 
guiSetVisible(EL.P,false) 
  
-- Direct X Drawing 
  
    function lGui() 
        dxDrawText("<- Volver",447.0,355.0,541.0,372.0,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,true) 
        dxDrawRectangle(445.0,184.0,274.0,210.0,tocolor(0,0,0,200),false) 
        dxDrawText("Ventana de Logeo",448.0,187.0,690.0,223.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,true) 
        dxDrawText("Nick",512.0,248.0,550.0,263.0,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,true) 
        dxDrawText("Contraseña",460.0,280.0,560.0,304.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Logearme",587.0,364.0,714.0,390.0,tocolor(255,255,255,255),0.8,"bankgothic","left","top",false,false,true) 
    end 
     
function clientSubmitLoginDX ( button, state ) 
    if ( button == "left" and state == "up" ) then 
        local username = guiGetText(EL.U) 
        local password = guiGetText(EL.P) 
        if ( username and password ) then 
            triggerServerEvent("submitLoginDX", localPlayer, username, password) 
        else 
           outputChatBox("Porfavor pon tu Nick y tu Contrase?a.") 
        end 
    end 
end 
     
addEventHandler("onClientGUIClick", BL[1], clientSubmitLoginDX, false) 
  
function clientSubmitaccountDX ( button, state ) 
    if ( button == "left" and state == "up" ) then 
        local username = guiGetText(ER.U) 
        local password = guiGetText(ER.P) 
        local cpassword = guiGetText(ER.CP) 
        if ( password == cpassword ) then 
        if ( username and password ) then 
            triggerServerEvent("addAccountDX", localPlayer, username, password, cpassword) 
        elseif ( username == '' and username == nil and password == '' and password == nil and cpassword == '' and cpassword == nil ) then 
           outputChatBox("Porfavor pon tu Nick y tu Contraseña.", localPlayer) 
        elseif ( password ~= cpassword ) then 
        outputChatBox("Porfavor pon tu Nick y tu Contraseña.", localPlayer) 
        end 
        end 
    end 
end 
addEventHandler("onClientGUIClick", BR[2], clientSubmitaccountDX, false) 
---------------------------------------------------------------- 
  
addEvent ( "closeLoginDX", true ) 
addEventHandler ( "closeLoginDX", root, 
    function ( ) 
removeEventHandler("onClientRender",root, lGui) 
       showCursor ( false ) 
    guiSetVisible(BL[1],false) 
    guiSetVisible(BL[2],false) 
    guiSetVisible(EL.U,false) 
    guiSetVisible(EL.P,false) 
    end 
) 
  
addEvent ( "openLoginDX", true ) 
addEventHandler ( "openLoginDX", root, 
    function ( ) 
addEventHandler("onClientRender",root, lGui) 
guiSetVisible(BL[1],false) 
guiSetVisible(BL[2],false) 
guiSetVisible(EL.U,false) 
guiSetVisible(EL.P,false) 
removeEventHandler("onClientRender",root,RGui) 
guiSetVisible(BR[1],false) 
guiSetVisible(BR[2],false) 
guiSetVisible(BR[3],false) 
guiSetVisible(ER.U,false) 
guiSetVisible(ER.P,false) 
guiSetVisible(ER.CP,false) 
    end 
) 

sv-side

addEvent("CameraAirport",true) 
addEventHandler("CameraAirport",getRootElement(), 
function() 
fadeCamera( source, true) 
setCameraMatrix(source, -1498.1424560547, -382.80834960938, 40.345268249512, -1415.830078125, -294.80749511719, 14.1484375) 
end 
) 
  
function loginHandlerDX(username,password) 
    local acc = getAccount(username, password) 
        if (acc) then 
            logIn ( source, acc, password ) 
            fadeCamera(source, true) 
            setCameraTarget(source) 
            triggerClientEvent ( source, "closeLoginDX", source ) 
            outputChatBox("Enjoy your time!", source) 
        else 
            outputChatBox("invalid username and password. Please re-connect and try again.", source) 
        end 
end 
addEvent("submitLoginDX",true) 
addEventHandler("submitLoginDX",root, loginHandlerDX) 
  
function registerPlayerDX ( username, password, cpassword ) 
    if ( password ~= "" and password ~= nil and username ~= "" and username ~= nil and cpassword ~="" and cpassword ~= nil ) then 
        if ( not getAccount ( username ) ) then 
            local accountAdded = addAccount ( username, password ) 
            if ( accountAdded ) then 
                outputChatBox ( "Gracias " .. getPlayerName ( source ) .. ", Ya estas Registrado ahora loggeate", source ) 
                triggerClientEvent ( source, "openLoginDX", source ) 
            else 
                outputChatBox ( "Error creando la Cuenta por Favor contacta a un Admin.", source ) 
            end 
        else 
            outputChatBox ( "Esta Cuenta Ya Existe..", source ) 
        end 
    else 
        outputChatBox ( "Porfavor Pon tus datos Correctos.", source ) 
    end 
end 
addEvent("addAccountDX", true) 
addEventHandler("addAccountDX", root, registerPlayerDX) 

thank in advanced :P

Link to comment

its easy ....

this is for my teacher SoldSnake14 :D

function onPlayerQuit() 
    local playerAccount = getPlayerAccount(source) 
    if (playerAccount) and not isGuestAccount(playerAccount) then 
        local playerSkin = getElementModel(source) 
        setAccountData(playerAccount, "skin", playerSkin) 
    end 
end 
addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) 
  
function onPlayerLogin() 
    local playerAccount = getPlayerAccount(source) 
    if (playerAccount) and not isGuestAccount(playerAccount) then 
        local playerSkin = tonumber(getAccountData(playerAccount, "skin")) 
        if (playerSkin) then 
            setElementModel(source, playerSkin) 
        end 
    end 
end 
addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) 

Link to comment

thank you x-shadow work, but now I cant remove a event :/

------------------------- 
----Intro GUI------------ 
BI = {} 
  
BI[1] = guiCreateButton(0.3625,0.155,0.257,0.2817,"REGISTRARME",true) 
guiSetVisible(BI[1],false) 
guiSetAlpha(BI[1],0) 
  
BI[2] = guiCreateButton(0.3625,0.445,0.257,0.3367,"REGISTRARME",true) 
guiSetVisible(BI[2],false) 
guiSetAlpha(BI[2],0) 
  
    function iGui() 
        dxDrawText("Si Tienes una cuenta logeate aqui.",474.0,309.0,782.0,347.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,true) 
        dxDrawText("Logearme",471.0,275.0,669.0,301.0,tocolor(255,255,255,255),1.0,"bankgothic","left","top",false,false,true) 
        dxDrawRectangle(465.0,266.0,327.0,203.0,tocolor(0,0,0,180),false) 
        dxDrawText("Si no tienes Cuenta puedes registrarte aqui.",471.0,125.0,714.0,141.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,true) 
        dxDrawText("Registrarme",470.0,99.0,777.0,151.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,true) 
        dxDrawRectangle(466.0,95.0,325.0,170.0,tocolor(0,0,0,180),false) 
        dxDrawRectangle(465.0,94.0,328.0,376.0,tocolor(0,0,0,200),false) 
    end 
     
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),function()addEventHandler("onClientRender",root, iGui) showCursor(true) 
guiSetVisible(BI[1],true) guiSetVisible(BI[2],true) triggerServerEvent("CameraAirport",getLocalPlayer()) end) 
  
addEventHandler("onClientGUIClick",root, 
function() 
if source == BI[1] then 
guiSetVisible(BI[1],false) 
guiSetVisible(BI[2],false) 
removeEventHandler("onClientRender",root, iGui) 
addEventHandler("onClientRender",root, RGui) 
guiSetVisible(BR[1],true) 
guiSetVisible(BR[2],true) 
guiSetVisible(BR[3],true) 
guiSetVisible(ER.U,true) 
guiSetVisible(ER.P,true) 
guiSetVisible(ER.CP,true) 
guiSetVisible(ER.S,true) 
elseif source == BI[2] then 
guiSetVisible(BI[1],false) 
guiSetVisible(BI[2],false) 
removeEventHandler("onClientRender",root, iGui) 
addEventHandler("onClientRender",root, lGui) 
guiSetVisible(BL[1],true) 
guiSetVisible(BL[2],true) 
guiSetVisible(EL.U,true) 
guiSetVisible(EL.P,true) 
elseif source == BR[3] then 
guiSetVisible(BI[1],true) 
guiSetVisible(BI[2],true) 
addEventHandler("onClientRender",root, iGui) 
removeEventHandler("onClientRender",root, RGui) 
guiSetVisible(BR[1],false) 
guiSetVisible(BR[2],false) 
guiSetVisible(BR[3],false) 
guiSetVisible(ER.U,false) 
guiSetVisible(ER.P,false) 
guiSetVisible(ER.CP,false) 
guiSetVisible(ER.S,false) 
elseif source == BL[2] then 
guiSetVisible(BI[1],true) 
guiSetVisible(BI[2],true) 
addEventHandler("onClientRender",root, iGui) 
removeEventHandler("onClientRender",root, lGui) 
guiSetVisible(BL[1],false) 
guiSetVisible(BL[2],false) 
guiSetVisible(EL.U,false) 
guiSetVisible(EL.P,false) 
end 
end 
) 
---------------------------------------------------------- 
  
--------------------------- 
-----Register GUI---------- 
BR = {} 
ER = {} 
  
BR[1] = guiCreateButton(0.357,0.575,0.093,0.0317,"IDS",true) 
guiSetVisible(BR[1],false) 
guiSetAlpha(BR[1],0) 
  
BR[2] = guiCreateButton(0.5461,0.6367,0.1008,0.03,"Registrarme",true) 
guiSetVisible(BR[2],false) 
guiSetAlpha(BR[2],0) 
  
BR[3] = guiCreateButton(0.3547,0.63,0.0781,0.04,"Atras",true) 
guiSetVisible(BR[3],false) 
guiSetAlpha(BR[3],0) 
  
ER.U = guiCreateEdit(0.3945,0.3483,0.107,0.0417,"",true) 
guiSetVisible(ER.U,false) 
  
ER.P = guiCreateEdit(0.4422,0.4067,0.107,0.0417,"",true) 
guiSetVisible(ER.P,false) 
  
ER.CP = guiCreateEdit(0.5109,0.455,0.107,0.0417,"",true) 
guiSetVisible(ER.CP,false) 
  
ER.S = guiCreateEdit(0.3992,0.5033,0.0734,0.04,"",true) 
guiSetVisible(ER.S,false) 
  
-- Direct X Drawing 
    function RGui() 
        dxDrawText("<- Volver",455.0,382.0,581.0,405.0,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,true) 
        dxDrawRectangle(446.0,166.0,410.0,244.0,tocolor(0,0,0,200),false) 
        dxDrawText("Registracion de Datos",448.0,167.0,708.0,187.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,true) 
        dxDrawText("Nick",463.0,214.0,501.0,230.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Contraseña",463.0,248.0,563.0,264.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Confirmar Contraseña",462.0,276.0,649.0,291.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Skins",462.0,306.0,581.0,327.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Registrarme",702.0,383.0,825.0,401.0,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,true) 
    end 
---------------------------------------------------------------- 
  
----------------------------- 
---Login GUI----------------- 
BL = {} 
EL = {} 
  
BL[1] = guiCreateButton(0.4555,0.6033,0.1023,0.0433,"Logearme",true) 
guiSetVisible(BL[1],false) 
guiSetAlpha(BL[1],0) 
  
BL[2] = guiCreateButton(0.3508,0.5883,0.0742,0.0333,"ATRAS",true) 
guiSetVisible(BL[2],false) 
guiSetAlpha(BL[2],0) 
  
EL.U = guiCreateEdit(0.4375,0.405,0.1102,0.0433,"",true) 
guiSetVisible(EL.U,false) 
  
EL.P = guiCreateEdit(0.4375,0.4617,0.1102,0.0433,"",true) 
guiSetVisible(EL.P,false) 
  
-- Direct X Drawing 
  
    function lGui() 
        dxDrawText("<- Volver",447.0,355.0,541.0,372.0,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,true) 
        dxDrawRectangle(445.0,184.0,274.0,210.0,tocolor(0,0,0,200),false) 
        dxDrawText("Ventana de Logeo",448.0,187.0,690.0,223.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,true) 
        dxDrawText("Nick",512.0,248.0,550.0,263.0,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,true) 
        dxDrawText("Contraseña",460.0,280.0,560.0,304.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Logearme",587.0,364.0,714.0,390.0,tocolor(255,255,255,255),0.8,"bankgothic","left","top",false,false,true) 
    end 
     
function clientSubmitLoginDX ( button, state ) 
    if ( button == "left" and state == "up" ) then 
        local username = guiGetText(EL.U) 
        local password = guiGetText(EL.P) 
        if ( username and password ) then 
            triggerServerEvent("submitLoginDX", localPlayer, username, password) 
        else 
           outputChatBox("Porfavor pon tu Nick y tu Contrase?a.") 
        end 
    end 
end 
     
addEventHandler("onClientGUIClick", BL[1], clientSubmitLoginDX, false) 
  
function clientSubmitaccountDX ( button, state ) 
    if ( button == "left" and state == "up" ) then 
        local username = guiGetText(ER.U) 
        local password = guiGetText(ER.P) 
        local cpassword = guiGetText(ER.CP) 
        if ( password == cpassword ) then 
        if ( username and password ) then 
            triggerServerEvent("addAccountDX", localPlayer, username, password, cpassword) 
        elseif ( username == '' and username == nil and password == '' and password == nil and cpassword == '' and cpassword == nil ) then 
           outputChatBox("Porfavor pon tu Nick y tu Contraseña.", localPlayer) 
        elseif ( password ~= cpassword ) then 
        outputChatBox("Porfavor pon tu Nick y tu Contraseña.", localPlayer) 
        end 
        end 
    end 
end 
addEventHandler("onClientGUIClick", BR[2], clientSubmitaccountDX, false) 
---------------------------------------------------------------- 
  
addEvent ( "closeLoginDX", true ) 
addEventHandler ( "closeLoginDX", root, 
    function ( ) 
removeEventHandler("onClientRender",root, lGui) 
       showCursor ( false ) 
    guiSetVisible(BL[1],false) 
    guiSetVisible(BL[2],false) 
    guiSetVisible(EL.U,false) 
    guiSetVisible(EL.P,false) 
    addEventHandler("onClientRender",root,DXI) 
    end 
) 
  
    function DXI() 
        dxDrawText("Bienvenido!, Bueno te hare una pequeña introduccion al server, hay trabajos, dinero, fiestas, y mucho mas !",272.0,522.0,1176.0,551.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
        dxDrawText("Hola "..getPlayerName( localPlayer ).." yo sere tu Guia por esta larga travesia",272.0,495.0,1232.0,521.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,false) 
    end 
  
setTimer( 
function() 
removeEventHandler("onClientRender",root,DXI) 
end,6000, 1) 
  
addEvent ( "openLoginDX", true ) 
addEventHandler ( "openLoginDX", root, 
    function ( ) 
addEventHandler("onClientRender",root, lGui) 
guiSetVisible(BL[1],true) 
guiSetVisible(BL[2],true) 
guiSetVisible(EL.U,true) 
guiSetVisible(EL.P,true) 
removeEventHandler("onClientRender",root,RGui) 
guiSetVisible(BR[1],false) 
guiSetVisible(BR[2],false) 
guiSetVisible(BR[3],false) 
guiSetVisible(ER.U,false) 
guiSetVisible(ER.P,false) 
guiSetVisible(ER.CP,false) 
guiSetVisible(ER.S,false) 
setElementModel(localPlayer, (tonumber(guiGetText(ER.S)))) 
    end 
) 

Link to comment

You have iGui while it's IGui. Lua is case sensitive.

------------------------- 
----Intro GUI------------ 
BI = {} 
  
BI[1] = guiCreateButton(0.3625,0.155,0.257,0.2817,"REGISTRARME",true) 
guiSetVisible(BI[1],false) 
guiSetAlpha(BI[1],0) 
  
BI[2] = guiCreateButton(0.3625,0.445,0.257,0.3367,"REGISTRARME",true) 
guiSetVisible(BI[2],false) 
guiSetAlpha(BI[2],0) 
  
    function IGui() 
        dxDrawText("Si Tienes una cuenta logeate aqui.",474.0,309.0,782.0,347.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,true) 
        dxDrawText("Logearme",471.0,275.0,669.0,301.0,tocolor(255,255,255,255),1.0,"bankgothic","left","top",false,false,true) 
        dxDrawRectangle(465.0,266.0,327.0,203.0,tocolor(0,0,0,180),false) 
        dxDrawText("Si no tienes Cuenta puedes registrarte aqui.",471.0,125.0,714.0,141.0,tocolor(255,255,255,255),1.0,"default","left","top",false,false,true) 
        dxDrawText("Registrarme",470.0,99.0,777.0,151.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,true) 
        dxDrawRectangle(466.0,95.0,325.0,170.0,tocolor(0,0,0,180),false) 
        dxDrawRectangle(465.0,94.0,328.0,376.0,tocolor(0,0,0,200),false) 
    end 
    
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),function()addEventHandler("onClientRender",root, IGui) showCursor(true) 
guiSetVisible(BI[1],true) guiSetVisible(BI[2],true) triggerServerEvent("CameraAirport",getLocalPlayer()) end) 
  
addEventHandler("onClientGUIClick",root, 
function() 
if source == BI[1] then 
guiSetVisible(BI[1],false) 
guiSetVisible(BI[2],false) 
removeEventHandler("onClientRender",root, IGui) 
addEventHandler("onClientRender",root, RGui) 
guiSetVisible(BR[1],true) 
guiSetVisible(BR[2],true) 
guiSetVisible(BR[3],true) 
guiSetVisible(ER.U,true) 
guiSetVisible(ER.P,true) 
guiSetVisible(ER.CP,true) 
guiSetVisible(ER.S,true) 
elseif source == BI[2] then 
guiSetVisible(BI[1],false) 
guiSetVisible(BI[2],false) 
removeEventHandler("onClientRender",root, IGui) 
addEventHandler("onClientRender",root, lGui) 
guiSetVisible(BL[1],true) 
guiSetVisible(BL[2],true) 
guiSetVisible(EL.U,true) 
guiSetVisible(EL.P,true) 
elseif source == BR[3] then 
guiSetVisible(BI[1],true) 
guiSetVisible(BI[2],true) 
addEventHandler("onClientRender",root, IGui) 
removeEventHandler("onClientRender",root, RGui) 
guiSetVisible(BR[1],false) 
guiSetVisible(BR[2],false) 
guiSetVisible(BR[3],false) 
guiSetVisible(ER.U,false) 
guiSetVisible(ER.P,false) 
guiSetVisible(ER.CP,false) 
guiSetVisible(ER.S,false) 
elseif source == BL[2] then 
guiSetVisible(BI[1],true) 
guiSetVisible(BI[2],true) 
addEventHandler("onClientRender",root, IGui) 
removeEventHandler("onClientRender",root, lGui) 
guiSetVisible(BL[1],false) 
guiSetVisible(BL[2],false) 
guiSetVisible(EL.U,false) 
guiSetVisible(EL.P,false) 
end 
end 
) 
---------------------------------------------------------- 
  
--------------------------- 
-----Register GUI---------- 
BR = {} 
ER = {} 
  
BR[1] = guiCreateButton(0.357,0.575,0.093,0.0317,"IDS",true) 
guiSetVisible(BR[1],false) 
guiSetAlpha(BR[1],0) 
  
BR[2] = guiCreateButton(0.5461,0.6367,0.1008,0.03,"Registrarme",true) 
guiSetVisible(BR[2],false) 
guiSetAlpha(BR[2],0) 
  
BR[3] = guiCreateButton(0.3547,0.63,0.0781,0.04,"Atras",true) 
guiSetVisible(BR[3],false) 
guiSetAlpha(BR[3],0) 
  
ER.U = guiCreateEdit(0.3945,0.3483,0.107,0.0417,"",true) 
guiSetVisible(ER.U,false) 
  
ER.P = guiCreateEdit(0.4422,0.4067,0.107,0.0417,"",true) 
guiSetVisible(ER.P,false) 
  
ER.CP = guiCreateEdit(0.5109,0.455,0.107,0.0417,"",true) 
guiSetVisible(ER.CP,false) 
  
ER.S = guiCreateEdit(0.3992,0.5033,0.0734,0.04,"",true) 
guiSetVisible(ER.S,false) 
  
-- Direct X Drawing 
    function RGui() 
        dxDrawText("<- Volver",455.0,382.0,581.0,405.0,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,true) 
        dxDrawRectangle(446.0,166.0,410.0,244.0,tocolor(0,0,0,200),false) 
        dxDrawText("Registracion de Datos",448.0,167.0,708.0,187.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,true) 
        dxDrawText("Nick",463.0,214.0,501.0,230.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Contrase?a",463.0,248.0,563.0,264.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Confirmar Contrase?a",462.0,276.0,649.0,291.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Skins",462.0,306.0,581.0,327.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Registrarme",702.0,383.0,825.0,401.0,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,true) 
    end 
---------------------------------------------------------------- 
  
----------------------------- 
---Login GUI----------------- 
BL = {} 
EL = {} 
  
BL[1] = guiCreateButton(0.4555,0.6033,0.1023,0.0433,"Logearme",true) 
guiSetVisible(BL[1],false) 
guiSetAlpha(BL[1],0) 
  
BL[2] = guiCreateButton(0.3508,0.5883,0.0742,0.0333,"ATRAS",true) 
guiSetVisible(BL[2],false) 
guiSetAlpha(BL[2],0) 
  
EL.U = guiCreateEdit(0.4375,0.405,0.1102,0.0433,"",true) 
guiSetVisible(EL.U,false) 
  
EL.P = guiCreateEdit(0.4375,0.4617,0.1102,0.0433,"",true) 
guiSetVisible(EL.P,false) 
  
-- Direct X Drawing 
  
    function lGui() 
        dxDrawText("<- Volver",447.0,355.0,541.0,372.0,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,true) 
        dxDrawRectangle(445.0,184.0,274.0,210.0,tocolor(0,0,0,200),false) 
        dxDrawText("Ventana de Logeo",448.0,187.0,690.0,223.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,true) 
        dxDrawText("Nick",512.0,248.0,550.0,263.0,tocolor(255,255,255,255),0.6,"bankgothic","left","top",false,false,true) 
        dxDrawText("Contrase?a",460.0,280.0,560.0,304.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,true) 
        dxDrawText("Logearme",587.0,364.0,714.0,390.0,tocolor(255,255,255,255),0.8,"bankgothic","left","top",false,false,true) 
    end 
    
function clientSubmitLoginDX ( button, state ) 
    if ( button == "left" and state == "up" ) then 
        local username = guiGetText(EL.U) 
        local password = guiGetText(EL.P) 
        if ( username and password ) then 
            triggerServerEvent("submitLoginDX", localPlayer, username, password) 
        else 
           outputChatBox("Porfavor pon tu Nick y tu Contrase?a.") 
        end 
    end 
end 
    
addEventHandler("onClientGUIClick", BL[1], clientSubmitLoginDX, false) 
  
function clientSubmitaccountDX ( button, state ) 
    if ( button == "left" and state == "up" ) then 
        local username = guiGetText(ER.U) 
        local password = guiGetText(ER.P) 
        local cpassword = guiGetText(ER.CP) 
        if ( password == cpassword ) then 
        if ( username and password ) then 
            triggerServerEvent("addAccountDX", localPlayer, username, password, cpassword) 
        elseif ( username == '' and username == nil and password == '' and password == nil and cpassword == '' and cpassword == nil ) then 
           outputChatBox("Porfavor pon tu Nick y tu Contrase?a.", localPlayer) 
        elseif ( password ~= cpassword ) then 
        outputChatBox("Porfavor pon tu Nick y tu Contrase?a.", localPlayer) 
        end 
        end 
    end 
end 
addEventHandler("onClientGUIClick", BR[2], clientSubmitaccountDX, false) 
---------------------------------------------------------------- 
  
addEvent ( "closeLoginDX", true ) 
addEventHandler ( "closeLoginDX", root, 
    function ( ) 
removeEventHandler("onClientRender",root, lGui) 
       showCursor ( false ) 
    guiSetVisible(BL[1],false) 
    guiSetVisible(BL[2],false) 
    guiSetVisible(EL.U,false) 
    guiSetVisible(EL.P,false) 
    addEventHandler("onClientRender",root,DXI) 
    end 
) 
  
    function DXI() 
        dxDrawText("Bienvenido!, Bueno te hare una peque?a introduccion al server, hay trabajos, dinero, fiestas, y mucho mas !",272.0,522.0,1176.0,551.0,tocolor(255,255,255,255),0.5,"bankgothic","left","top",false,false,false) 
        dxDrawText("Hola "..getPlayerName( localPlayer ).." yo sere tu Guia por esta larga travesia",272.0,495.0,1232.0,521.0,tocolor(255,255,255,255),0.7,"bankgothic","left","top",false,false,false) 
    end 
  
setTimer( 
function() 
removeEventHandler("onClientRender",root,DXI) 
end,6000, 1) 
  
addEvent ( "openLoginDX", true ) 
addEventHandler ( "openLoginDX", root, 
    function ( ) 
addEventHandler("onClientRender",root, lGui) 
guiSetVisible(BL[1],true) 
guiSetVisible(BL[2],true) 
guiSetVisible(EL.U,true) 
guiSetVisible(EL.P,true) 
removeEventHandler("onClientRender",root,RGui) 
guiSetVisible(BR[1],false) 
guiSetVisible(BR[2],false) 
guiSetVisible(BR[3],false) 
guiSetVisible(ER.U,false) 
guiSetVisible(ER.P,false) 
guiSetVisible(ER.CP,false) 
guiSetVisible(ER.S,false) 
setElementModel(localPlayer, (tonumber(guiGetText(ER.S)))) 
    end 
) 

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