Hallo,
Ich hab das im Scripteditor getestet und es gab keinen Error, aber es funktioniert trotzdem nicht.
Code
Handy = 10000
function GuiStart ()
tabPanel = guiCreateTabPanel ( 0.4, 0.375, 0.2, 0.25, true, true )
local tabMap = guiCreateTab( "LogIn", tabPanel )
local tabHelp = guiCreateTab( "Registrieren", tabPanel )
guiCreateLabel(0.3, 0.09, 0.94, 0.2, "Willkommenstext", 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, "Text", 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 )
showCursor ( true )
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), GuiStart )
addEventHandler ( "onClientGUIClick", regbutton, ClientRegister )
addEventHandler ( "onClientGUIClick", lgbutton, ClientLogin )
function ClientRegister ()
if source ~= getResourceRootElement() then return end
username = guiGetText ( nickedit )
password = guiGetText ( pwedit )
geschlecht = guiGetText ( geschedit )
geburtsdatum = guiGetText ( gebedit )
xmlRootTree = xmlLoadFile ( "users/"..username..".xml" )
if xmlRootTree then
outputChatBox ( "Accountname bereits vergeben" )
else -- If the xml does not exist then...
xmlRootTree = xmlCreateFile ( "users/"..username..".xml", "root" ) -- Create the xml file
xmlAccountinfo = xmlCreateChild ( xmlRootTree, "accountinfo" ) -- Create the hud sub-node under the root node
xmlOthersinfo = xmlCreateChild ( xmlRootTree, "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" ) --Create sub-node values under the binds sub-node
xmlNodeSetValue (xmlCreateChild ( xmlOthersinfo, "Handy"), Handy ) --Create sub-node values under the binds sub-node
Handy = Handy + 1
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
Alles anzeigen