depato123 Posted November 14, 2013 Share Posted November 14, 2013 ¿Se puede sacar la informacion de que si alguien entro al server por primera vez o se registro? un onPLayerRegister o algo asi? Link to comment
DeletedAccount1111 Posted November 14, 2013 Share Posted November 14, 2013 Como que sacar la informacion, define eso Link to comment
depato123 Posted November 14, 2013 Author Share Posted November 14, 2013 Si existe un if o un event para obtener esa información (si la cuenta es nueva) Link to comment
DeletedAccount1111 Posted November 14, 2013 Share Posted November 14, 2013 Osea comprobar si ese jugador ya se ha metido alguna vez en tu server? Link to comment
depato123 Posted November 14, 2013 Author Share Posted November 14, 2013 Osea comprobar si ese jugador ya se ha metido alguna vez en tu server? si Link to comment
PhantomDamn Posted November 14, 2013 Share Posted November 14, 2013 descarga el server.log, abrelo con chromo y presiona f3 alli escribes el serial del jugador y bingo! ahi te das cuenta de eso... es un truco muy practico... yo acostumbro a darle stop a mi server cada 30 dias aproximadamente y descargo el server.log y los voy guardando en una memoria .. luego reemplazas el server.log por un bloc en blanco con igual nombre y doy star al server... actualmente tengo mas de 15 bloc de la consola descargado. Link to comment
depato123 Posted November 14, 2013 Author Share Posted November 14, 2013 Yo lo necesito para un resource automático que al jugador que no este registrado y se registre le aparezca un panel. Link to comment
DeletedAccount1111 Posted November 15, 2013 Share Posted November 15, 2013 Para eso habia un script de login muy simple. Lo malo es que no especifica si ya te has metido o no, sale siempre Link to comment
Bc# Posted November 15, 2013 Share Posted November 15, 2013 Por lo que sé eso no existe, pero crear un sistema no es complicado. Link to comment
DeletedAccount1111 Posted November 15, 2013 Share Posted November 15, 2013 Digo yo que si de alguna forma le añades una tabla donde la IP quede asociada a un usuario, puedes hacerlo Link to comment
depato123 Posted November 15, 2013 Author Share Posted November 15, 2013 osea que no se puede saber si el usuario acaba de registrarse? Link to comment
Castillo Posted November 15, 2013 Share Posted November 15, 2013 Si se puede, lo que tenes que hacer es ejecutar la funcion que quieras despues de que te registres. Link to comment
depato123 Posted November 15, 2013 Author Share Posted November 15, 2013 Si se puede, lo que tenes que hacer es ejecutar la funcion que quieras despues de que te registres. ¿Como? Por ejemplo yo tengo esta función y quiero hacer que el gui aparezca luego de registrarse y no al entrar al server. ¿Que debo utilizar para eso? GUIEditor = { window = {}, label = {}, memo = {} } function closeLogin ( ) GUIEditor.window[1] = guiCreateWindow(477, 572, 486, 96, "", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(14, 34, 120, 29, "Nombre de usuario:", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") GUIEditor.memo[1] = guiCreateMemo(140, 26, 336, 37, "", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(14, 73, 482, 19, "Elije tu nombre de usuario, (Nickname)", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[2], "default-bold-small") end addEvent ( "onClientPlayerLogin", true ) addEventHandler ( "onClientPlayerLogin", root, closeLogin ) Link to comment
Castillo Posted November 15, 2013 Share Posted November 15, 2013 Que sistema de registro usas? Link to comment
depato123 Posted November 15, 2013 Author Share Posted November 15, 2013 Que sistema de registro usas? Uno que encontré en la comunidad. se llama "DxloginPanel" o algo asi. Pero volviendo al tema. ¿Como le agrego esa cosa? Link to comment
depato123 Posted November 15, 2013 Author Share Posted November 15, 2013 Que sistema de registro usas? Uno que encontré en la comunidad. se llama "DxloginPanel" o algo asi. ¿Te paso los scripts que tiene? Pero volviendo al tema. ¿Como le agrego esa cosa? Link to comment
Castillo Posted November 15, 2013 Share Posted November 15, 2013 Postea el script server side del recurso ese. Link to comment
depato123 Posted November 15, 2013 Author Share Posted November 15, 2013 ------------------------------------------ -- Dx Login Panel -- ------------------------------------------ -- Developer: Braydon Davis (xXMADEXx) -- -- File: server.lua -- -- Copyright 2013 (C) Braydon Davis -- -- All rights reserved. -- ------------------------------------------ local cameras = { { 329.10980224609, -2117.2749023438, 50.161201477051, 329.65179443359, -2116.4926757813, 49.853763580322 }, { 1266.0053710938, -1965.7087402344, 114.59829711914, 1265.1549072266, -1966.1115722656, 114.25980377197 }, { 1514.0283203125, -1716.5743408203, 39.910701751709, 1514.5087890625, -1715.865234375, 39.394691467285 }, { 1338.7514648438, -875.66558837891, 99.84880065918, 1339.4935302734, -875.07824707031, 99.52579498291 }, { 1426.5421142578, -725.40289306641, 120.97090148926, 1427.3695068359, -725.00805664063, 120.571434021 }, { 1357.5914306641, -592.23327636719, 125.15190124512, 1357.1751708984, -593.02673339844, 124.70780944824 }, { 988.01123046875, -341.88409423828, 74.752601623535, 988.70251464844, -342.45135498047, 75.200187683105 }, { -224.32290649414, -153.71020507813, 35.085899353027, -223.61195373535, -153.04695129395, 34.852146148682 } } function openView( plr ) local theplr = nil if ( source and getElementType ( source ) == 'player' ) then theplr = source elseif ( plr and getElementType ( plr ) == 'player' ) then theplr = plr end setTimer ( function ( p ) local ind = math.random ( #cameras ) setCameraMatrix ( p, unpack ( cameras[ind] ) ) end, 700, 1, theplr ) end addEventHandler ( "onPlayerJoin", root, openView ) addEventHandler ( "onPlayerLogout", root, openView ) --addCommandHandler ( 'view', openView ) function attemptLogin ( user, pass ) if ( user and pass and type ( user ) == 'string' and type ( pass ) == 'string' ) then --local user = string.lower ( user ) --local pass = string.lower ( pass ) local account = getAccount ( user ) if ( account ) then if ( not logIn ( source, account, pass ) ) then message ( source, "Incorrect password." ) return false end setCameraTarget ( source, source ) triggerLogin ( source, user, pass ) else message ( source, "Unknown account." ) return false end end return false end addEvent ( "Login:onClientAttemptLogin", true ) addEventHandler ( "Login:onClientAttemptLogin", root, attemptLogin ) function attemptRegister ( user, pass ) if ( user and pass and type ( user ) == 'string' and type ( pass ) == 'string' ) then --local user = string.lower ( user ) --local pass = string.lower ( pass ) local account = getAccount ( user ) if ( not account ) then local account = addAccount ( user, pass ) if ( account ) then if ( not logIn ( source, account, pass ) ) then return message ( source, "Logging in has failed." ) end setCameraTarget ( source, source ) triggerLogin ( source, user, pass ) else message ( source, "Adding account failed.\nPlease report to an admin." ) end else message ( source, "This account already exists." ) end end return false end addEvent ( "Login:onClientAttemptRegistration", true ) addEventHandler ( "Login:onClientAttemptRegistration", root, attemptRegister ) function message ( source, msg ) triggerClientEvent ( source, "onPlayerLoginPanelError", source, msg ) end function triggerLogin ( source, user, pass ) triggerClientEvent ( source, "onClientPlayerLogin", source, user, pass ) end addEventHandler ( 'onPlayerLogout', root, function ( ) triggerClientEvent ( source, 'onClientPlayerLogout', source ) end ) Link to comment
Castillo Posted November 15, 2013 Share Posted November 15, 2013 ------------------------------------------ -- Dx Login Panel -- ------------------------------------------ -- Developer: Braydon Davis (xXMADEXx) -- -- File: server.lua -- -- Copyright 2013 (C) Braydon Davis -- -- All rights reserved. -- ------------------------------------------ local cameras = { { 329.10980224609, -2117.2749023438, 50.161201477051, 329.65179443359, -2116.4926757813, 49.853763580322 }, { 1266.0053710938, -1965.7087402344, 114.59829711914, 1265.1549072266, -1966.1115722656, 114.25980377197 }, { 1514.0283203125, -1716.5743408203, 39.910701751709, 1514.5087890625, -1715.865234375, 39.394691467285 }, { 1338.7514648438, -875.66558837891, 99.84880065918, 1339.4935302734, -875.07824707031, 99.52579498291 }, { 1426.5421142578, -725.40289306641, 120.97090148926, 1427.3695068359, -725.00805664063, 120.571434021 }, { 1357.5914306641, -592.23327636719, 125.15190124512, 1357.1751708984, -593.02673339844, 124.70780944824 }, { 988.01123046875, -341.88409423828, 74.752601623535, 988.70251464844, -342.45135498047, 75.200187683105 }, { -224.32290649414, -153.71020507813, 35.085899353027, -223.61195373535, -153.04695129395, 34.852146148682 } } function openView( plr ) local theplr = nil if ( source and getElementType ( source ) == 'player' ) then theplr = source elseif ( plr and getElementType ( plr ) == 'player' ) then theplr = plr end setTimer ( function ( p ) local ind = math.random ( #cameras ) setCameraMatrix ( p, unpack ( cameras[ind] ) ) end, 700, 1, theplr ) end addEventHandler ( "onPlayerJoin", root, openView ) addEventHandler ( "onPlayerLogout", root, openView ) --addCommandHandler ( 'view', openView ) function attemptLogin ( user, pass ) if ( user and pass and type ( user ) == 'string' and type ( pass ) == 'string' ) then --local user = string.lower ( user ) --local pass = string.lower ( pass ) local account = getAccount ( user ) if ( account ) then if ( not logIn ( source, account, pass ) ) then message ( source, "Incorrect password." ) return false end setCameraTarget ( source, source ) triggerLogin ( source, user, pass ) else message ( source, "Unknown account." ) return false end end return false end addEvent ( "Login:onClientAttemptLogin", true ) addEventHandler ( "Login:onClientAttemptLogin", root, attemptLogin ) function attemptRegister ( user, pass ) if ( user and pass and type ( user ) == 'string' and type ( pass ) == 'string' ) then --local user = string.lower ( user ) --local pass = string.lower ( pass ) local account = getAccount ( user ) if ( not account ) then local account = addAccount ( user, pass ) if ( account ) then if ( not logIn ( source, account, pass ) ) then return message ( source, "Logging in has failed." ) end triggerEvent ( "onPlayerRegister", source ) setCameraTarget ( source, source ) triggerLogin ( source, user, pass ) else message ( source, "Adding account failed.\nPlease report to an admin." ) end else message ( source, "This account already exists." ) end end return false end addEvent ( "Login:onClientAttemptRegistration", true ) addEventHandler ( "Login:onClientAttemptRegistration", root, attemptRegister ) function message ( source, msg ) triggerClientEvent ( source, "onPlayerLoginPanelError", source, msg ) end function triggerLogin ( source, user, pass ) triggerClientEvent ( source, "onClientPlayerLogin", source, user, pass ) end addEventHandler ( 'onPlayerLogout', root, function ( ) triggerClientEvent ( source, 'onClientPlayerLogout', source ) end ) Ok, con esto ahora tenes un evento llamado: "onPlayerRegister" que podes usar en otros scripts, ejemplo: addEvent ( "onPlayerRegister", true ) addEventHandler ( "onPlayerRegister", root, function ( ) outputChatBox ( getPlayerName ( source ) .." es nuevo en el servidor, bienvenido!", root, 0, 255, 0 ) end ) Link to comment
depato123 Posted November 15, 2013 Author Share Posted November 15, 2013 Gracias. Ya lo probe. Pero no funciona al registrarme no aparece el gui que especifique aqui GUIEditor = { window = {}, label = {}, memo = {} } function openGui( ) GUIEditor.window[1] = guiCreateWindow(477, 572, 486, 96, "", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.label[1] = guiCreateLabel(14, 34, 120, 29, "Nombre de usuario:", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-bold-small") GUIEditor.memo[1] = guiCreateMemo(140, 26, 336, 37, "", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(14, 73, 482, 19, "Elije tu nombre de usuario, recuerda que el formato debe ser de nombre_apellido", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[2], "default-bold-small") end addEvent ( "onPlayerRegister", true ) addEventHandler ( "onPlayerRegister", root, openGui) Link to comment
Castillo Posted November 15, 2013 Share Posted November 15, 2013 El evento es solo server side. Link to comment
depato123 Posted November 15, 2013 Author Share Posted November 15, 2013 El evento es solo server side. osea que solo agrego addEventHandler? Link to comment
Castillo Posted November 15, 2013 Share Posted November 15, 2013 No, tenes que enviar el evento al client side, podes usar esto: addEvent ( "onPlayerRegister", true ) addEventHandler ( "onPlayerRegister", root, function ( ) triggerClientEvent ( source, "onPlayerRegister", source ) end ) Link to comment
depato123 Posted November 16, 2013 Author Share Posted November 16, 2013 Ok, ya esta lo del server. ¿En el client debo poner addEventHandler ( "onClientAttemptRegistration", root, closeLogin ) ? Link to comment
Cuervo_fi Posted November 16, 2013 Share Posted November 16, 2013 yo uso uno por cuentas y AccountData getAccountData setAccountData onPlayerLogin onPlayerQuit tu podrias hacerlo de la misma forma, para que cada ves que alguien entre y esn uevo se le asigne una ID, o el mismo serial como AccoundData, y asi chequeas. Link to comment
Recommended Posts