Jump to content

Need Help with LogIn and Register


Trevit

Recommended Posts

Posted

Hello,

I need help with the following script. Everytime I click on the button "Registrieren" it says "Account erstellt" [= Account created].

But it don't create any file.

  
 tabPanel = guiCreateTabPanel ( 0.4, 0.375, 0.2, 0.25, true, true )       
 tabMap = guiCreateTab( "LogIn", tabPanel )                
 tabHelp = guiCreateTab( "Registrieren", tabPanel )                        
  
 guiCreateLabel(0.3, 0.09, 0.94, 0.2, "Willkommen auf XXX-Reallife", true, tabMap) 
 guiCreateLabel(0.12, 0.275, 0.94, 0.2, "Benutzername:", true, tabMap) 
 nicklg = guiCreateEdit( 0.35, 0.25, 0.4, 0.1, "", true, tabMap ) 
 pwlg = guiCreateEdit( 0.35, 0.42, 0.4, 0.1, "", true, tabMap ) 
 guiCreateLabel( 0.14, 0.445, 0.94, 0.2, "Passwort:", true, tabMap ) 
 lgbutton = guiCreateButton( 0.35, 0.65, 0.3, 0.3, "LogIn", true, tabMap ) 
  
 guiCreateLabel(0.02, 0.04, 0.94, 0.92, "Hier kannst du dich auf XXX-Reallife registrieren.", true, tabHelp) 
 guiCreateLabel(0.02, 0.19, 0.94, 0.92, "Nickname:", true, tabHelp) 
 guiCreateLabel(0.02, 0.33, 0.94, 0.92, "Passwort:", true, tabHelp) 
 guiCreateLabel(0.02, 0.48, 0.94, 0.92, "Geschlecht:", true, tabHelp) 
 guiCreateLabel(0.02, 0.63, 0.94, 0.92, "Geburtstag:", true, tabHelp) 
 nickedit = guiCreateEdit( 0.35, 0.18, 0.4, 0.1, "", true, tabHelp ) 
 pwedit = guiCreateEdit( 0.35, 0.32, 0.4, 0.1, "", true, tabHelp ) 
 geschedit = guiCreateEdit( 0.35, 0.47, 0.4, 0.1, "", true, tabHelp ) 
 gebedit = guiCreateEdit( 0.35, 0.62, 0.4, 0.1, "", true, tabHelp ) 
 regbutton = guiCreateButton( 0.4, 0.8, 0.2, 0.15, "Registrieren", true, tabHelp ) 
  
function GuiStart () 
guiSetVisible ( tabPanel, true ) 
showCursor ( true ) 
end 
  
function ClientRegister () 
 username = guiGetText ( nickedit ) 
 password = guiGetText ( pwedit ) 
 geschlecht = guiGetText ( geschedit ) 
 geburtsdatum = guiGetText ( gebedit ) 
 xmlRootTree = xmlLoadFile ( ":RL/users/"..username..".xml" ) 
  
 if xmlRootTree then  
  outputChatBox ( "Accountname bereits vergeben" ) 
 else  
  xmlCreate = xmlCreateFile ( ":RL/users/"..username..".xml", "root" ) -- Create the xml file  
  xmlAccountinfo = xmlCreateChild ( xmlCreate, "accountinfo" ) -- Create the hud sub-node under the root node 
  xmlOthersinfo = xmlCreateChild ( xmlCreate, "others" )-- Create the binds sub-node under the root node 
  xmlNodeSetValue (xmlCreateChild ( xmlAccountinfo, "Username"), username ) --Create sub-node values under the hud sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlAccountinfo, "Passwort"), password ) --Create sub-node values under the hud sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlAccountinfo, "Geschlecht"), geschlecht ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlAccountinfo, "Geburtsdatum"), geburtsdatum ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlAccountinfo, "Spielzeit"), "0" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Geld"), "3000" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Bankguthaben"), "0" ) 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Handy"), "0" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Beruf"), "Keiner" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Kanstzeit"), "Keine" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Wanteds"), "Keine" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Drogen"), "Keine" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Drogensamen"), "Keine" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Waffenteile"), "Keine" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Fraktion"), "Zivilist" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Rang"), "Buerger" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Führerschein"), "Keinen" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Bootsschein"), "Keinen" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Flugschein"), "Keinen" ) --Create sub-node values under the binds sub-node 
  xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Adminstatus"), "Keine" ) --Create sub-node values under the binds sub-node 
  outputChatBox ( "Account erstellt" ) 
 end 
end 
  
function ClientLogin () 
  
 usernamelg = guiGetText ( nicklg ) 
 passwordlg = guiGetText ( pwlg ) 
 xmlLogTree = xmlLoadFile ( "users/"..usernamelg..".xml" ) 
   
 if xmlLogTree then  
  if ( xmlNodeGetValue( xmlFindChild ( xmlAccountinfo, "Passwort", 0 )) == passwordlg ) then 
   outputChatBox ( "Login erfolgreich" ) 
   guiSetVisible ( tabPanel, false ) 
  else 
   outputChatBox ( "Login nicht erfolgreich" ) 
  end 
 else -- If the xml does not exist then... 
  outputChatBox ( "Benutzername falsch" ) 
 end 
  
end 
  
addEventHandler("onClientResourceStart", getRootElement(), GuiStart ) 
addEventHandler("onClientGUIClick", regbutton, ClientRegister ) 
addEventHandler("onClientGUIClick", lgbutton, ClientLogin ) 
  

Posted

Thanks for the Help.

xmlLoadFile ( "users/"..usernamelg..".xml" ) says now that there is a file, but if I look in the folder, there isn't one.

Posted

tell us exact path

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

exact..

C:\Program Files\ ........

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

  • 2 years later...
Posted

There are a lot of naysayers out there who think it is a poor choice to offer fast cash to customers in the form of installment payday loans. These individuals have clearly never been in a circumstance where they needed fast cash without dealing with a credit check. The loans are there to help people in difficult situations. Get more information at: Installment Payday Loans

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