Script Fehler / Script Bug

  • Hey leute ich habe mir ein login script gescriptet und habe jetzt ein kleines proble....
    ich bekomme immer eine fehlermeldung wen ich connecten will...
    Hier der Fehlercode aus meiner Ingame Console:

    Download error: HTTP response code said error.

    (Die PHP funktion geht bei mir gerade i-wie nicht)
    und hier der script code ...


    function createLoginWindow()
    local X = 0.3
    local Y = 0.3
    local Width = 0.4
    local Height = 0.4
    wdwLogin = guiCreateWindow(X, Y, Width, Height, "Bitte Einloggen", true)

    -- define new X and Y positions for the first label
    X = 0.0825
    Y = 0.2
    -- define new Width and Height values for the first label
    Width = 0.3
    Height = 0.25
    -- create the first label, note the final argument passed is 'wdwLogin' meaning the window
    -- we created above is the parent of this label (so all the position and size values are now relative to the position of that window)
    guiCreateLabel(X, Y, Width, Height, "Benutzername:", true, wdwLogin)
    -- alter the Y value, so the second label is slightly below the first
    Y = 0.5
    guiCreateLabel(X, Y, Width, Height, "Passwort:", true, wdwLogin)


    X = 0.415
    Y = 0.2
    Width = 0.5
    Height = 0.15
    username = getPlayerName(getLocalPlayer())
    guiCreateLabel(X, Y, Width, Height, username, true, wdwLogin)
    Y = 0.5
    edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin)


    guiEditSetMaxLength(edtPass, 50)

    X = 0.15
    Y = 0.7
    Width = 0.25
    Height = 0.2
    btnLogin = guiCreateButton(X, Y, Width, Height, "Einloggen", true, wdwLogin)

    X = 0.6
    Y = 0.7
    Width = 0.25
    Height = 0.2
    btnRegister = guiCreateButton(X, Y, Width, Height, "Registrieren", true, wdwLogin)

    -- make the window invisible
    guiSetVisible(wdwLogin, false)
    addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false)
    addEventHandler("onClientGUIClick", btnRegister, clientSubmitRegister, false)
    end


    function beginning ()
    client = source
    createLoginWindow()

    -- output a brief welcome message to the player
    outputChatBox("Welcome to My MTA:SA Server, please log in.")

    -- if the GUI was successfully created, then show the GUI to the player
    if (wdwLogin ~= nil) then
    guiSetVisible(wdwLogin, true)
    else
    -- if the GUI hasnt been properly created, tell the player
    outputChatBox("An unexpected error has occurred and the log in GUI has not been created.")
    end

    -- enable the players cursor (so they can select and click on the components)
    showCursor(true)
    -- set the input focus onto the GUI, allowing players (for example) to press 'T' without the chatbox opening
    guiSetInputEnabled(true)

    end
    addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), beginning)

    addEvent ("WrongPW", true)
    addEventHandler("WrongPW", getRootElement(), beginning)

    function clientSubmitLogin(button,state)

    if button == "left" and state == "up" then
    -- get the text entered in the 'username' field

    -- get the text entered in the 'password' field
    local password = guiGetText(edtPass)

    -- if the username and password both exist
    if password then
    -- trigger the server event 'submitLogin' and pass the username and password to it
    triggerServerEvent("submitLogin", getRootElement(), username, password)

    -- hide the gui, hide the cursor and return control to the player
    guiSetInputEnabled(false)
    guiSetVisible(wdwLogin, false)
    showCursor(false)
    else
    -- otherwise, output a message to the player, do not trigger the server
    -- and do not hide the gui
    outputChatBox("Please enter a password.")
    end
    end
    end

    function clientSubmitRegister(button,state)

    if button == "left" and state == "up" then
    -- get the text entered in the 'username' field

    -- get the text entered in the 'password' field
    local password = guiGetText(edtPass)

    -- if the username and password both exist
    if password then
    -- trigger the server event 'submitLogin' and pass the username and password to it
    triggerServerEvent("submitRegister", getRootElement(), username, password)

    -- hide the gui, hide the cursor and return control to the player
    guiSetInputEnabled(false)
    guiSetVisible(wdwLogin, false)
    showCursor(false)
    else
    -- otherwise, output a message to the player, do not trigger the server
    -- and do not hide the gui
    outputChatBox("Please enter a username and password.")
    end
    end
    end


    function createRezeptionWindow()
    local X = 0.2
    local Y = 0.2
    local Width = 0.6
    local Height = 0.6
    RezeptionWindow = guiCreateWindow(X, Y, Width, Height, "Herzlich Willkommen in der LS Stadthalle", true)


    X = 0.1
    Y = 0.1

    Width = 0.4
    Height = 0.25


    guiCreateLabel(X, Y, Width, Height, "Personalausweis: 300$", true, RezeptionWindow)
    -- alter the Y value, so the second label is slightly below the first
    Y = 0.3
    guiCreateLabel(X, Y, Width, Height, "Fuehrerschein: 1000$", true, RezeptionWindow)


    X = 0.5
    Y = 0.1
    Width = 0.3
    Height = 0.1
    btnPersonalausweis = guiCreateButton(X, Y, Width, Height, "Kaufen", true, RezeptionWindow)

    X = 0.5
    Y = 0.3
    Width = 0.3
    Height = 0.1
    btnFuehrerschein = guiCreateButton(X, Y, Width, Height, "Kaufen", true, RezeptionWindow)


    guiSetVisible(RezeptionWindow, false)
    addEventHandler("onClientGUIClick", btnPersonalausweis, Personalausweis, false)
    addEventHandler("onClientGUIClick", btnFuehrerschein, Fuehrerschein, false)
    end

    function Rezeption ()

    createRezeptionWindow()
    outputChatBox("Willkommen in der Stadthalle")
    if (RezeptionWindow ~= nil) then
    guiSetVisible(RezeptionWindow, true)
    else

    outputChatBox("Da ist wohl etwas schiefgegangen, bitte melde es einem Admin.")
    end


    showCursor(true)

    guiSetInputEnabled(true)

    end
    addEvent ("RezeptionGUI", true)
    addEventHandler("RezeptionGUI", getResourceRootElement(getThisResource()), Rezeption)

    function Personalausweis(button,state)

    if button == "left" and state == "up" then
    triggerServerEvent("BuyPersonalausweis", getRootElement(), username)
    guiSetInputEnabled(false)
    guiSetVisible(RezeptionWindow, false)
    showCursor(false)
    end
    end

    function Fuehrerschein(button,state)

    if button == "left" and state == "up" then
    triggerServerEvent("BuyFuehrerschein", getRootElement(), username)
    guiSetInputEnabled(false)
    guiSetVisible(RezeptionWindow, false)
    showCursor(false)
    end
    end


    function createATMWindow()
    local X = 0.25
    local Y = 0.25
    local Width = 0.5
    local Height = 0.5
    ATMWindow = guiCreateWindow(X, Y, Width, Height, "BankAutomat", true)


    X = 0.1
    Y = 0.1
    Width = 0.3
    Height = 0.1


    guiCreateLabel(X, Y, Width, Height, "Betrag", true, ATMWindow)
    Y = 0.2
    guiCreateLabel(X, Y, Width, Height, "Name", true, ATMWindow)


    X = 0.5
    Y = 0.1
    Betrag = guiCreateEdit(X, Y, Width, Height, "", true, ATMWindow)
    Y = 0.2
    Nameedit = guiCreateEdit(X, Y, Width, Height, "", true, ATMWindow)


    X = 0.1
    Y = 0.6
    Width = 0.25
    Height = 0.1
    btnueberweisen = guiCreateButton(X, Y, Width, Height, "Überweisen", true, ATMWindow)

    X = 0.4
    Y = 0.6
    Width = 0.25
    Height = 0.1
    btnabheben = guiCreateButton(X, Y, Width, Height, "Abheben", true, ATMWindow)

    X = 0.7
    Y = 0.6
    Width = 0.25
    Height = 0.1
    btneinzahlen = guiCreateButton(X, Y, Width, Height, "Einzahlen", true, ATMWindow)


    guiSetVisible(ATMWindow, false)
    addEventHandler("onClientGUIClick", btnueberweisen, Ueberweisung, false)
    addEventHandler("onClientGUIClick", btnabheben, Abheben, false)
    addEventHandler("onClientGUIClick", btneinzahlen, Einzahlen, false)
    end


    function ATM ()

    createATMWindow()
    if (ATMWindow ~= nil) then
    guiSetVisible(ATMWindow, true)

    else
    outputChatBox("Da ist wohl etwas schiefgegangen, bitte melde es einem Admin.")
    end
    showCursor(true)
    guiSetInputEnabled(true)

    end

    addEvent ("ATMGUI", true)
    addEventHandler("ATMGUI", getResourceRootElement(getThisResource()), ATM)


    function Ueberweisung(button,state)

    if button == "left" and state == "up" then
    username = getPlayerName(getLocalPlayer())
    BetragNummer = guiGetText(Betrag)
    Name = guiGetText(Nameedit)
    if BetragNummer and Name then

    triggerServerEvent("Ueberweisung", getRootElement(), username, BetragNummer, Name)

    else
    outputChatBox ("Bitte gebe einen Betrag und einen Namen ein.")
    end
    guiSetInputEnabled(false)
    guiSetVisible(ATMWindow, false)
    showCursor(false)
    BetragNummer = nil
    Name = nil

    else
    end
    end

    function Abheben(button,state)
    if button == "left" and state == "up" then
    BetragNummer = guiGetText(Betrag)
    username = getPlayerName(getLocalPlayer())

    if BetragNummer then

    triggerServerEvent("AbhebenEvent", getRootElement(), username, BetragNummer)

    else
    outputChatBox ("Bitte gebe einen Betrag ein")
    end

    guiSetInputEnabled(false)
    guiSetVisible(ATMWindow, false)
    showCursor(false)
    BetragNummer = nil
    else
    end
    end


    function Einzahlen(button,state)
    if button == "left" and state == "up" then
    BetragNummer = guiGetText(Betrag)
    username = getPlayerName(getLocalPlayer())

    if BetragNummer then

    triggerServerEvent("EinzahlenEvent", getRootElement(), username, BetragNummer)

    else
    outputChatBox ("Bitte gebe einen Betrag ein")
    end

    guiSetInputEnabled(false)
    guiSetVisible(ATMWindow, false)
    showCursor(false)
    BetragNummer = nil
    else
    end
    end


    Wen ich das script auf einem anderen server verändert wieder finde gibt es stress...

    und ich habe noch eine kleine frage nämlich wie ich mache das das passwort in ******* angezeigt wird.....

    Ich danke im voraus

    MFG Ramon

  • Dieses Thema enthält 3 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind, bitte registrieren Sie sich oder melden Sie sich an um diese lesen zu können.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!