Jump to content

مشكلة ب addAccount


Recommended Posts

--client
function clientSubmitRegister(button, state)
    if button == "left" and state == "up" then
    local arg1 = guiGetText(editUsername)
    local arg2 = guiGetText(editPassword)
    if arg1 and arg2 then
            triggerServerEvent("submitRegister", getRootElement(), localPlayer, username, password)
        else
            guiSetText(labelInfo, "Enter username and password.")
        end
    end
end
addEventHandler("onClientGUIClick", buttonRegister, clientSubmitRegister, false)


function weakPW()
guiSetText(labelInfo, "Password should be at least 4 characters long")
end

function unknownError()
    guiSetText(labelInfo, "An unknown error occured.")
end

function RegisterSuccess()
    guiSetText(labelInfo, "you've successfully registered,Press Login")
end

function registerTaken()
    guiSetText(labelInfo, "This username is already taken.")
end

addEvent("unknownError", true)
addEvent("registerTaken", true)
addEvent("RegisterSuccess", true)
addEvent("weakPW", true)
addEventHandler("unknownError", getRootElement(), unknownError)
addEventHandler("registerTaken", getRootElement(), registerTaken)
addEventHandler("RegisterSuccess", getRootElement(), RegisterSuccess)
addEventHandler("weakPW", getRootElement(), weakPW)





--server
function register( player, arg1, arg2 )
    local username = getPlayerName ( player )
    local password = arg1
    if ( arg2 ) then
        username = arg1
        password = arg2
    end
    if ( password ~= nil ) then
        if ( string.len ( password ) < 4 ) then
            outputChatBox ( "register: - Password should be at least 4 characters long", player, 255, 100, 70 )
        elseif ( addAccount ( username, password ) ) then
            outputChatBox ( "You have successfully registered! Username: '"..username.."', Password: '"..password.."'(Remember it)", player, 255, 100, 70 )
            outputServerLog ( "ADMIN: "..getPlayerName ( player ).." registered account '"..username.."' (IP: "..getPlayerIP(player).."  Serial: "..getPlayerSerial(player)..")" )
        elseif ( getAccount ( username ) ) then
            outputChatBox ( "register: - Account with this name already exists.", player, 255, 100, 70 )
        else
            triggerClientEvent (player, "unknownError", getRootElement())
        end
    end
end 
addEvent("submitRegister", true)
addEventHandler("submitRegister", root, register)

السلام عليكم انا عندي مشكلة بالكود واللي هو المفروض انه لوحة تسجيل  بس انا لما اضغط علي الزر ما بيحصلي شي 

Labelوبيكتبلي ب ال

"An unknown error occured." وبس 

Link to comment
function clientSubmitRegister(button, state)
    if button == "left" and state == "up" then
    local arg1 = guiGetText(editUsername)
    local arg2 = guiGetText(editPassword)
    if arg1 and arg2 then
            triggerServerEvent("submitRegister", getRootElement(), localPlayer, arg1, arg2)
        else
            guiSetText(labelInfo, "Enter username and password.")
        end
    end
end
addEventHandler("onClientGUIClick", buttonRegister, clientSubmitRegister, false)


function weakPW()
guiSetText(labelInfo, "Password should be at least 4 characters long")
end

function unknownError()
    guiSetText(labelInfo, "An unknown error occured.")
end

function RegisterSuccess()
    guiSetText(labelInfo, "you've successfully registered,Press Login")
end

function registerTaken()
    guiSetText(labelInfo, "This username is already taken.")
end

addEvent("unknownError", true)
addEvent("registerTaken", true)
addEvent("RegisterSuccess", true)
addEvent("weakPW", true)
addEventHandler("unknownError", getRootElement(), unknownError)
addEventHandler("registerTaken", getRootElement(), registerTaken)
addEventHandler("RegisterSuccess", getRootElement(), RegisterSuccess)
addEventHandler("weakPW", getRootElement(), weakPW)





--server
function register( player, arg1, arg2 )
    local username = getPlayerName ( player )
    local password = arg1
    if ( arg2 ) then
        username = arg1
        password = arg2
    end
    if ( password ~= nil ) then
        if ( string.len ( password ) < 4 ) then
            outputChatBox ( "register: - Password should be at least 4 characters long", player, 255, 100, 70 )
        elseif ( addAccount ( username, password ) ) then
            outputChatBox ( "You have successfully registered! Username: '"..username.."', Password: '"..password.."'(Remember it)", player, 255, 100, 70 )
            outputServerLog ( "ADMIN: "..getPlayerName ( player ).." registered account '"..username.."' (IP: "..getPlayerIP(player).."  Serial: "..getPlayerSerial(player)..")" )
        elseif ( getAccount ( username ) ) then
            outputChatBox ( "register: - Account with this name already exists.", player, 255, 100, 70 )
        else
            triggerClientEvent (player, "unknownError", getRootElement())
        end
    end
end 
addEvent("submitRegister", true)
addEventHandler("submitRegister", root, register)

 

Link to comment
10 hours ago, #BrosS said:

ضيف المود لقروب ادمن

دي كانت اول شي عملته 

12 hours ago, Talis said:

function clientSubmitRegister(button, state)
    if button == "left" and state == "up" then
    local arg1 = guiGetText(editUsername)
    local arg2 = guiGetText(editPassword)
    if arg1 and arg2 then
            triggerServerEvent("submitRegister", getRootElement(), localPlayer, arg1, arg2)
        else
            guiSetText(labelInfo, "Enter username and password.")
        end
    end
end
addEventHandler("onClientGUIClick", buttonRegister, clientSubmitRegister, false)


function weakPW()
guiSetText(labelInfo, "Password should be at least 4 characters long")
end

function unknownError()
    guiSetText(labelInfo, "An unknown error occured.")
end

function RegisterSuccess()
    guiSetText(labelInfo, "you've successfully registered,Press Login")
end

function registerTaken()
    guiSetText(labelInfo, "This username is already taken.")
end

addEvent("unknownError", true)
addEvent("registerTaken", true)
addEvent("RegisterSuccess", true)
addEvent("weakPW", true)
addEventHandler("unknownError", getRootElement(), unknownError)
addEventHandler("registerTaken", getRootElement(), registerTaken)
addEventHandler("RegisterSuccess", getRootElement(), RegisterSuccess)
addEventHandler("weakPW", getRootElement(), weakPW)





--server
function register( player, arg1, arg2 )
    local username = getPlayerName ( player )
    local password = arg1
    if ( arg2 ) then
        username = arg1
        password = arg2
    end
    if ( password ~= nil ) then
        if ( string.len ( password ) < 4 ) then
            outputChatBox ( "register: - Password should be at least 4 characters long", player, 255, 100, 70 )
        elseif ( addAccount ( username, password ) ) then
            outputChatBox ( "You have successfully registered! Username: '"..username.."', Password: '"..password.."'(Remember it)", player, 255, 100, 70 )
            outputServerLog ( "ADMIN: "..getPlayerName ( player ).." registered account '"..username.."' (IP: "..getPlayerIP(player).."  Serial: "..getPlayerSerial(player)..")" )
        elseif ( getAccount ( username ) ) then
            outputChatBox ( "register: - Account with this name already exists.", player, 255, 100, 70 )
        else
            triggerClientEvent (player, "unknownError", getRootElement())
        end
    end
end 
addEvent("submitRegister", true)
addEventHandler("submitRegister", root, register)

 

تصدق وتامن بالله ماخدت بالي ض1 xD تسلم اخي 

  • Like 1
Link to comment

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