SoundWave Posted March 24, 2011 Share Posted March 24, 2011 Ok so i use a login panel when player registers his account saves in preferences.xml this file will be created in mods so only the player who logged in can see his account and password is there a way that i can see those logins also? Link to comment
Kenix Posted March 24, 2011 Share Posted March 24, 2011 you want to encrypt stored data? Link to comment
SoundWave Posted March 24, 2011 Author Share Posted March 24, 2011 yes i think, i want to be able to read there logins so when player becomes a member of our team i know his login. Link to comment
Moderators Citizen Posted March 24, 2011 Moderators Share Posted March 24, 2011 How and when that player "becomes a member of your team" ? We need the register code if you want some help Link to comment
Castillo Posted March 24, 2011 Share Posted March 24, 2011 (edited) You want to his their passwords also? o,o that would be really bad. Edited March 26, 2011 by Guest Link to comment
SoundWave Posted March 25, 2011 Author Share Posted March 25, 2011 @ Solidsnake14: No i don't want to see there passwords i only want to see their nicknames. @ Citizen: Well we have a site when a player when one of the leaders sends a private message to him that he can write an application then the leaders will decide if he can join or not so when we say YES you can join then i can see his login and so i can make him admin then here is the register code: client: function build_loginWin() confFile = xmlLoadFile("preferences.xml") if (confFile) then infoTable["account"] = xmlNodeGetAttribute(confFile,"username") infoTable["pass"] = xmlNodeGetAttribute(confFile,"pass") infoTable["save"] = xmlNodeGetAttribute(confFile,"save") else confFile = xmlCreateFile("preferences.xml","user") xmlNodeSetAttribute(confFile,"username","") xmlNodeSetAttribute(confFile,"pass","") xmlNodeSetAttribute(confFile,"save","false") infoTable["account"] = getPlayerName(localPlayer) infoTable["pass"] = "" infoTable["save"] = "false" end xmlSaveFile(confFile) ---- THIS IS NOT THE WHOLE CODE THE OTHER PART YOU DON'T NEED THAT IS THE GUI BUT IT IS SCRIPTED IN HERE ------ --REGISTER THE PLAYER function attemptToRegister(button, state) local username = guiGetText(Login_Edit[3]) local pass1 = guiGetText(Login_Edit[4]) local pass2 = guiGetText(Login_Edit[5]) if (guiCheckBoxGetSelected(Login_Check[1])) then if not (tostring(username) == "") then if not (tostring(pass1) == "") or not (tostring(pass1) == "") then if (pass1 == pass2) then showCursor(false,false) guiSetInputEnabled(false) triggerServerEvent("onClientSendRegisterDataToServer", getRootElement(), localPlayer, username, pass1) else reason = "The passwords do not match!" build_Warning(localPlayer, reason) end else reason = "No password was entered!" build_Warning(localPlayer, reason) end else reason = "No username was entered!" build_Warning(localPlayer, reason) end else reason = "You did not accept the rules!" build_Warning(localPlayer, reason) end end server: --REGISTER THE PLAYER function tryToRegsiterPlayer(player, username, pass) if not getAccount(username, pass) then theAccount = addAccount(username, pass) if (theAccount) then logIn(player, theAccount, pass) outputChatBox("* You successfully registered account '" ..username.. "' for player '" ..getPlayerName(player).. "' with password '" ..pass.."'!", player, 0, 255, 0, false) triggerClientEvent("onRegisterPlayWelcomeSound", player) triggerClientEvent("onPlayerFirstTimeSeen", player) triggerClientEvent("onPlayerDoneLogin", player) setTimer(triggerClientEvent, 3000, 1, "onPlayerPlayUEFASound", player, false) else reason = "The Account already exists!" triggerClientEvent("onServerWrongLoginRebuildLogin", root, player, reason) end else reason = "The Account already exists!" triggerClientEvent("onServerWrongLoginRebuildLogin", root, player, reason) end end addEvent("onClientSendRegisterDataToServer", true) addEventHandler("onClientSendRegisterDataToServer", getRootElement(), tryToRegsiterPlayer) Link to comment
Moderators Citizen Posted March 25, 2011 Moderators Share Posted March 25, 2011 Try this ( replace SoundWave by your name In-Game ): Server: --REGISTER THE PLAYER function tryToRegsiterPlayer(player, username, pass) if not getAccount(username, pass) then theAccount = addAccount(username, pass) if (theAccount) then logIn(player, theAccount, pass) outputChatBox("* You successfully registered account '" ..username.. "' for player '" ..getPlayerName(player).. "' with password '" ..pass.."'!", player, 0, 255, 0, false) local you = getPlayerFromName( "SoundWave" ) outputChatBox(" The player "..getPlayerName(player).." have been registered with the login "..username, you ) triggerClientEvent("onRegisterPlayWelcomeSound", player) triggerClientEvent("onPlayerFirstTimeSeen", player) triggerClientEvent("onPlayerDoneLogin", player) setTimer(triggerClientEvent, 3000, 1, "onPlayerPlayUEFASound", player, false) else reason = "The Account already exists!" triggerClientEvent("onServerWrongLoginRebuildLogin", root, player, reason) end else reason = "The Account already exists!" triggerClientEvent("onServerWrongLoginRebuildLogin", root, player, reason) end end addEvent("onClientSendRegisterDataToServer", true) addEventHandler("onClientSendRegisterDataToServer", getRootElement(), tryToRegsiterPlayer) Link to comment
SoundWave Posted March 26, 2011 Author Share Posted March 26, 2011 Well now it shows when a player registers but when i am not online and someone registers i won't see their register nickname well is it possible to save there logins somewhere where i can see them Link to comment
Moderators Citizen Posted March 26, 2011 Moderators Share Posted March 26, 2011 Well now it shows when a player registers but when i am not online and someone registers i won't see their register nicknamewell is it possible to save there logins somewhere where i can see them Server: --REGISTER THE PLAYER function tryToRegsiterPlayer(player, username, pass) if not getAccount(username, pass) then theAccount = addAccount(username, pass) if (theAccount) then logIn(player, theAccount, pass) outputChatBox("* You successfully registered account '" ..username.. "' for player '" ..getPlayerName(player).. "' with password '" ..pass.."'!", player, 0, 255, 0, false) local you = getPlayerFromName( "SoundWave" ) outputChatBox(" The player "..getPlayerName(player).." have been registered with the login "..username, you ) saveTheLogins( getPlayerName(player), tostring( username ) ) triggerClientEvent("onRegisterPlayWelcomeSound", player) triggerClientEvent("onPlayerFirstTimeSeen", player) triggerClientEvent("onPlayerDoneLogin", player) setTimer(triggerClientEvent, 3000, 1, "onPlayerPlayUEFASound", player, false) else reason = "The Account already exists!" triggerClientEvent("onServerWrongLoginRebuildLogin", root, player, reason) end else reason = "The Account already exists!" triggerClientEvent("onServerWrongLoginRebuildLogin", root, player, reason) end end addEvent("onClientSendRegisterDataToServer", true) addEventHandler("onClientSendRegisterDataToServer", getRootElement(), tryToRegsiterPlayer) function saveTheLogins( thePlayerName, theLogin ) if ( fileExists( "logins.txt" ) ) then local file = fileCreate( "logins.txt" ) if( file )then fileWrite( file, " The player "..thePlayerName.." have been registered with the login "..theLogin.."\r\n") fileClose( file ) end else local file = fileOpen( "logins.txt" ) if ( file ) then fileSetPos( file, fileGetSize( file ) ) fileWrite( file, " The player "..thePlayerName.." have been registered with the login "..theLogin.."\r\n" ) end end end Link to comment
SoundWave Posted March 26, 2011 Author Share Posted March 26, 2011 Well i get this error login_server.lua:83: fileOpen; unable to load file THAT IS THE FUNCTION WHERE I GET THE ERROR Line 83 ==> local file = fileOpen( "logins.txt" ) function saveTheLogins( thePlayerName, theLogin ) if ( fileExists( "logins.txt" ) ) then local file = fileCreate( "logins.txt" ) if( file )then fileWrite( file, " The player "..thePlayerName.." have been registered with the login "..theLogin.."\r\n") fileClose( file ) end else local file = fileOpen( "logins.txt" ) if ( file ) then fileSetPos( file, fileGetSize( file ) ) fileWrite( file, " The player "..thePlayerName.." have been registered with the login "..theLogin.."\r\n" ) end end end Link to comment
Moderators Citizen Posted March 26, 2011 Moderators Share Posted March 26, 2011 Yeah sorry, my bad: function saveTheLogins( thePlayerName, theLogin ) if ( not fileExists( "logins.txt" ) ) then local file = fileCreate( "logins.txt" ) if( file )then fileWrite( file, " The player "..thePlayerName.." have been registered with the login "..theLogin.."\r\n") fileClose( file ) end else local file = fileOpen( "logins.txt" ) if ( file ) then fileSetPos( file, fileGetSize( file ) ) fileWrite( file, " The player "..thePlayerName.." have been registered with the login "..theLogin.."\r\n" ) end end end Link to comment
SoundWave Posted March 26, 2011 Author Share Posted March 26, 2011 Thanks man it works rly apreciate it Link to comment
Moderators Citizen Posted March 26, 2011 Moderators Share Posted March 26, 2011 No 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