Jump to content

[HELP]Changepass


Best-Killer1

Recommended Posts

i tried to make script for change password what is problem here pls ?

Server-Side :

function obteneraccount(playerSource) 
    sourceAccount = getPlayerAccount ( playerSource ) 
    if isGuestAccount ( sourceAccount ) then 
        exports.SAEGMessages:sendClientMessage("[sERVER] Please log in to use this feature.", Source, 255, 255, 255, true) 
    else 
        PCuenta = getAccountName(getPlayerAccount(source)) 
        triggerClientEvent("OnDatas",source,PCuenta) 
    end 
end 
addEvent("obAccount", true) 
addEventHandler("obAccount",getRootElement(),obteneraccount) 
  
function errorp() 
    exports.SAEGMessages:sendClientMessage("[sERVER] Passwords do not match.", source, 255, 255, 255, true) 
end 
addEvent("ErrorPass", true) 
addEventHandler("ErrorPass",getRootElement(),errorp) 
  
function cambiar(newpass1) 
    local account = getPlayerAccount(source) 
    local nCuenta = getAccountName(account) 
    if (account) then 
        if (isGuestAccount(account)) then 
            exports.SAEGMessages:sendClientMessage("[sERVER]Please log in to change the password.", source, 255, 255, 255, true) 
        else 
            setAccountPassword(account, newpass1) 
            exports.SAEGMessages:sendClientMessage("[sERVER] The account password has been changed.", source, 255, 255, 255, true) 
            exports.SAEGMessages:sendClientMessage("[ACCOUNT][uSER: "..nCuenta.." ] - [NEW PASSWORD: "..newpass1.." ].", source, 255, 255, 255, true) 
        end 
    end 
end 
addEvent("Cambiar", true) 
addEventHandler("Cambiar",getRootElement(),cambiar) 

Clinet-side :

        GUI = guiCreateWindow(436, 271, 253, 246, "SAEG - Password Changer", false) 
        guiWindowSetSizable(GUI, false) 
        guiSetVisible(GUI, false) 
         
  
        Label_Account = guiCreateLabel(10, 31, 52, 15, "Account:", false, GUI) 
        Cuenta = guiCreateLabel(72, 31, 171, 15, "none", false, GUI) 
        guiLabelSetColor(Cuenta, 255, 0, 0) 
        Label_Newpass1 = guiCreateLabel(10, 56, 233, 19, "New Password:", false, GUI) 
        guiLabelSetHorizontalAlign(Label_Newpass1, "center", false) 
        Edit_pass1 = guiCreateEdit(10, 81, 233, 24, "Password", false, GUI) 
  
        Label_Newpass2 = guiCreateLabel(10, 115, 233, 19, "Repeat New Password:", false, GUI) 
        guiLabelSetHorizontalAlign(Label_Newpass2, "center", false) 
        Edit_pass2 = guiCreateEdit(10, 144, 233, 24, "Password", false, GUI) 
         
        Boton_change = guiCreateButton(45, 178, 81, 26, "Change", false, GUI) 
        guiSetProperty(Boton_change, "NormalTextColour", "FFAAAAAA") 
        Boton_cancel = guiCreateButton(126, 178, 81, 26, "Cancel", false, GUI) 
        guiSetProperty(Boton_cancel, "NormalTextColour", "FFAAAAAA") 
        Boton_help = guiCreateButton(86, 204, 81, 26, "Help", false, GUI) 
        guiSetProperty(Boton_help, "NormalTextColour", "FFAAAAAA") 
  
  
        GUI2 = guiCreateWindow(690, 271, 256, 315, "Help", false) 
        guiWindowSetSizable(GUI2, false) 
        guiSetVisible(GUI2, false) 
  
        scrollpanel = guiCreateScrollPane(10, 27, 236, 241, false, GUI2) 
  
        text_help = guiCreateLabel(0, 0, 243, 245, "/changepass = open panel\n\n*remember to log in.\n*CHANGE = change the password.\n*CANCEL = close panel.\n*HELP = open help panel.\n*CLOSE = close help panel\n\n", false, scrollpanel) 
  
        Boton_close = guiCreateButton(86, 278, 85, 25, "CLOSE", false, GUI2) 
        guiSetProperty(Boton_close, "NormalTextColour", "FFAAAAAA")    
        -- 
        showCursor(false) 
         
         
        function Abrir() 
            triggerServerEvent("obAccount", getLocalPlayer(), getLocalPlayer()) 
        end 
        addCommandHandler("changepass", Abrir) 
         
        function abrir2(PCuenta) 
            guiSetText(Cuenta, PCuenta) 
            guiSetVisible(GUI, true) 
            showCursor(true) 
        end 
        addEvent("OnDatas",true) 
        addEventHandler("OnDatas",getLocalPlayer(),abrir2) 
         
        function cerrar() 
            guiSetVisible(GUI, false) 
            guiSetVisible(GUI2, false) 
            showCursor(false) 
        end 
        addEventHandler("onClientGUIClick", Boton_cancel, cerrar, false) 
         
        function abrirhelp() 
            if (guiGetVisible(GUI2)) == false then 
                guiSetVisible(GUI2, true) 
            else 
                guiSetVisible(GUI2, false) 
            end 
        end 
        addEventHandler("onClientGUIClick", Boton_help, abrirhelp, false) 
         
        function cerrarhelp() 
            guiSetVisible(GUI2, false) 
        end 
        addEventHandler("onClientGUIClick", Boton_close, cerrarhelp, false) 
         
        function clearedit() 
            if (source == Edit_pass1) then 
                guiSetText(Edit_pass1, "") 
                guiEditSetMasked(Edit_pass1, true) 
            elseif (source == Edit_pass2) then 
                guiSetText(Edit_pass2, "") 
                guiEditSetMasked(Edit_pass2, true) 
            end 
        end 
        addEventHandler("onClientGUIClick", root, clearedit) 
         
        function cambiarpass() 
            newpass1 = guiGetText(Edit_pass1) 
            newpass2 = guiGetText(Edit_pass2) 
            if (newpass1 == newpass2) then 
                triggerServerEvent ("Cambiar", getLocalPlayer(), newpass1) 
            else 
                triggerServerEvent("ErrorPass", getLocalPlayer(), getLocalPlayer()) 
            end 
        end 
        addEventHandler("onClientGUIClick", Boton_change, cambiarpass, false) 
  
  

Link to comment
function passwordHandler(thePlayer, newpassword) 
    local account = getPlayerAccount(thePlayer) 
    local nCuenta = getAccountName(account) 
    if (account) then 
        if (isGuestAccount(account)) then 
            exports.SAEGMessages:sendClientMessage("[sERVER] Please log in to change the password.", source, 255, 255, 255, true) 
        else 
        setAccountPassword(account, newpassword) 
        exports.SAEGMessages:sendClientMessage("[sERVER] The account password has been change.", source, 255, 255, 255, true) 
        exports.SAEGMessages:sendClientMessage["[ACCOUNT][uSER:"..nCuenta.."] - [NEW PASSWORD:"..newpassword.."].", 255, 255, 255, true) 
       end 
    end 
end 
addEvent("Cambiar", true) 
addEventHandler("Cambiar", getRootElement(), passwordHandler) 

Link to comment

Try this (Not tested).

GUI = guiCreateWindow(436, 271, 253, 246, "SAEG - Password Changer", false) 
guiWindowSetSizable(GUI, false) 
guiSetVisible(GUI, false) 
showCursor(false) 
  
Label_Account = guiCreateLabel(10, 31, 52, 15, "Account:", false, GUI) 
Cuenta = guiCreateLabel(72, 31, 171, 15, "none", false, GUI) 
guiLabelSetColor(Cuenta, 255, 0, 0) 
Label_Newpass1 = guiCreateLabel(10, 56, 233, 19, "New Password:", false, GUI) 
guiLabelSetHorizontalAlign(Label_Newpass1, "center", false) 
Edit_pass1 = guiCreateEdit(10, 81, 233, 24, "Password", false, GUI) 
  
Label_Newpass2 = guiCreateLabel(10, 115, 233, 19, "Repeat New Password:", false, GUI) 
guiLabelSetHorizontalAlign(Label_Newpass2, "center", false) 
Edit_pass2 = guiCreateEdit(10, 144, 233, 24, "Password", false, GUI) 
        
Boton_change = guiCreateButton(45, 178, 81, 26, "Change", false, GUI) 
guiSetProperty(Boton_change, "NormalTextColour", "FFAAAAAA") 
Boton_cancel = guiCreateButton(126, 178, 81, 26, "Cancel", false, GUI) 
guiSetProperty(Boton_cancel, "NormalTextColour", "FFAAAAAA") 
Boton_help = guiCreateButton(86, 204, 81, 26, "Help", false, GUI) 
guiSetProperty(Boton_help, "NormalTextColour", "FFAAAAAA") 
  
GUI2 = guiCreateWindow(690, 271, 256, 315, "Help", false) 
guiWindowSetSizable(GUI2, false) 
guiSetVisible(GUI2, false) 
  
scrollpanel = guiCreateScrollPane(10, 27, 236, 241, false, GUI2) 
text_help = guiCreateLabel(0, 0, 243, 245, "/changepass = open panel\n\n*remember to log in.\n*CHANGE = change the password.\n*CANCEL = close panel.\n*HELP = open help panel.\n*CLOSE = close help panel\n\n", false, scrollpanel) 
  
Boton_close = guiCreateButton(86, 278, 85, 25, "CLOSE", false, GUI2) 
guiSetProperty(Boton_close, "NormalTextColour", "FFAAAAAA")   
  
addEvent("OnDatas",true) 
addEventHandler("OnDatas", root, 
function(PCuenta) 
    guiSetText(Cuenta, PCuenta) 
    guiSetVisible(GUI, true) 
    showCursor(true) 
end) 
  
addEventHandler("onClientGUIClick", guiRoot, 
function() 
    if (source == Edit_pass1) then 
        guiSetText(Edit_pass1, "") 
        guiEditSetMasked(Edit_pass1, true) 
    elseif source == Edit_pass2 then 
        guiSetText(Edit_pass2, "") 
        guiEditSetMasked(Edit_pass2, true) 
    elseif source == Boton_change then 
        local newpass1 = guiGetText(Edit_pass1) 
        local newpass2 = guiGetText(Edit_pass2) 
        if (newpass1 == newpass2) then 
            triggerServerEvent("Cambiar", localPlayer, newpass1) 
        else 
            triggerServerEvent("ErrorPass", localPlayer) 
        end 
    elseif source == Boton_close then 
        guiSetVisible(GUI2, false) 
    elseif source == Boton_cancel then 
        guiSetVisible(GUI, false) 
        guiSetVisible(GUI2, false) 
        showCursor(false) 
    elseif source == Boton_help then 
        guiSetVisible(GUI2, not guiGetVisible(GUI2)) 
    end 
end) 

addCommandHandler("changepass", 
function(player) 
    local account = getPlayerAccount(player) 
    if account and not isGuestAccount(account) then 
        triggerClientEvent(player, "OnDatas", player, getAccountName(account)) 
    else 
        exports.SAEGMessages:sendClientMessage("[sERVER] Please log in to use this feature.", player, 255, 255, 255, true) 
    end 
end) 
  
addEvent("ErrorPass", true) 
addEventHandler("ErrorPass", root, 
function() 
    exports.SAEGMessages:sendClientMessage("[sERVER] Passwords do not match.", client, 255, 255, 255, true) 
end) 
  
addEvent("Cambiar", true) 
addEventHandler("Cambiar", root, 
function(newpass1) 
    local account = getPlayerAccount(client) 
    if account and not isGuestAccount(account) then 
        setAccountPassword(account, newpass1) 
        exports.SAEGMessages:sendClientMessage("[sERVER] The account password has been changed.", client, 255, 255, 255, true) 
        exports.SAEGMessages:sendClientMessage("[ACCOUNT][uSER: "..getAccountName(account).." ] - [NEW PASSWORD: "..newpass1.." ].", client, 255, 255, 255, true) 
    else 
        exports.SAEGMessages:sendClientMessage("[sERVER]Please log in to change the password.", client, 255, 255, 255, true) 
    end 
end) 

Link to comment
i tried to make script for change password what is problem here pls ?

Check the Errors to let us know which error this script have?

access denied @ 'setaccountpassword'

Try this (Not tested).
GUI = guiCreateWindow(436, 271, 253, 246, "SAEG - Password Changer", false) 
guiWindowSetSizable(GUI, false) 
guiSetVisible(GUI, false) 
showCursor(false) 
  
Label_Account = guiCreateLabel(10, 31, 52, 15, "Account:", false, GUI) 
Cuenta = guiCreateLabel(72, 31, 171, 15, "none", false, GUI) 
guiLabelSetColor(Cuenta, 255, 0, 0) 
Label_Newpass1 = guiCreateLabel(10, 56, 233, 19, "New Password:", false, GUI) 
guiLabelSetHorizontalAlign(Label_Newpass1, "center", false) 
Edit_pass1 = guiCreateEdit(10, 81, 233, 24, "Password", false, GUI) 
  
Label_Newpass2 = guiCreateLabel(10, 115, 233, 19, "Repeat New Password:", false, GUI) 
guiLabelSetHorizontalAlign(Label_Newpass2, "center", false) 
Edit_pass2 = guiCreateEdit(10, 144, 233, 24, "Password", false, GUI) 
        
Boton_change = guiCreateButton(45, 178, 81, 26, "Change", false, GUI) 
guiSetProperty(Boton_change, "NormalTextColour", "FFAAAAAA") 
Boton_cancel = guiCreateButton(126, 178, 81, 26, "Cancel", false, GUI) 
guiSetProperty(Boton_cancel, "NormalTextColour", "FFAAAAAA") 
Boton_help = guiCreateButton(86, 204, 81, 26, "Help", false, GUI) 
guiSetProperty(Boton_help, "NormalTextColour", "FFAAAAAA") 
  
GUI2 = guiCreateWindow(690, 271, 256, 315, "Help", false) 
guiWindowSetSizable(GUI2, false) 
guiSetVisible(GUI2, false) 
  
scrollpanel = guiCreateScrollPane(10, 27, 236, 241, false, GUI2) 
text_help = guiCreateLabel(0, 0, 243, 245, "/changepass = open panel\n\n*remember to log in.\n*CHANGE = change the password.\n*CANCEL = close panel.\n*HELP = open help panel.\n*CLOSE = close help panel\n\n", false, scrollpanel) 
  
Boton_close = guiCreateButton(86, 278, 85, 25, "CLOSE", false, GUI2) 
guiSetProperty(Boton_close, "NormalTextColour", "FFAAAAAA")   
  
addEvent("OnDatas",true) 
addEventHandler("OnDatas", root, 
function(PCuenta) 
    guiSetText(Cuenta, PCuenta) 
    guiSetVisible(GUI, true) 
    showCursor(true) 
end) 
  
addEventHandler("onClientGUIClick", guiRoot, 
function() 
    if (source == Edit_pass1) then 
        guiSetText(Edit_pass1, "") 
        guiEditSetMasked(Edit_pass1, true) 
    elseif source == Edit_pass2 then 
        guiSetText(Edit_pass2, "") 
        guiEditSetMasked(Edit_pass2, true) 
    elseif source == Boton_change then 
        local newpass1 = guiGetText(Edit_pass1) 
        local newpass2 = guiGetText(Edit_pass2) 
        if (newpass1 == newpass2) then 
            triggerServerEvent("Cambiar", localPlayer, newpass1) 
        else 
            triggerServerEvent("ErrorPass", localPlayer) 
        end 
    elseif source == Boton_close then 
        guiSetVisible(GUI2, false) 
    elseif source == Boton_cancel then 
        guiSetVisible(GUI, false) 
        guiSetVisible(GUI2, false) 
        showCursor(false) 
    elseif source == Boton_help then 
        guiSetVisible(GUI2, not guiGetVisible(GUI2)) 
    end 
end) 

addCommandHandler("changepass", 
function(player) 
    local account = getPlayerAccount(player) 
    if account and not isGuestAccount(account) then 
        triggerClientEvent(player, "OnDatas", player, getAccountName(account)) 
    else 
        exports.SAEGMessages:sendClientMessage("[sERVER] Please log in to use this feature.", player, 255, 255, 255, true) 
    end 
end) 
  
addEvent("ErrorPass", true) 
addEventHandler("ErrorPass", root, 
function() 
    exports.SAEGMessages:sendClientMessage("[sERVER] Passwords do not match.", client, 255, 255, 255, true) 
end) 
  
addEvent("Cambiar", true) 
addEventHandler("Cambiar", root, 
function(newpass1) 
    local account = getPlayerAccount(client) 
    if account and not isGuestAccount(account) then 
        setAccountPassword(account, newpass1) 
        exports.SAEGMessages:sendClientMessage("[sERVER] The account password has been changed.", client, 255, 255, 255, true) 
        exports.SAEGMessages:sendClientMessage("[ACCOUNT][uSER: "..getAccountName(account).." ] - [NEW PASSWORD: "..newpass1.." ].", client, 255, 255, 255, true) 
    else 
        exports.SAEGMessages:sendClientMessage("[sERVER]Please log in to change the password.", client, 255, 255, 255, true) 
    end 
end) 

not work
Link to comment
If you don"r know how, Open your ACL.xml file and add the line under the admin section:
"resource.resourceName"> 

same

i'm sure you did a copy & paste to

"resource.resourceName"> 

:lol:

It was just an example to know what you need to do, Change the 'resourceName' to your resouce name easy?

omg kariim -.- i know how i need just add in the acl admin section -.-

Link to comment
    "Owner"> 
        "Level_1">
        "Level_2">
        "Level_3">
        "Level_4">
        "Level_5">
        "Level_6">
        "Level_7">
        "Level_8">
        "Level_9">
        "resource.*"> 
        "user.oussama"> 
        "resource.SAEGChangpass"> 
    

Link to comment
function passwordHandler(thePlayer, newpassword) 
    local account = getPlayerAccount(thePlayer) 
    local nCuenta = getAccountName(account) 
    if (account) then 
        if (isGuestAccount(account)) then 
            exports.SAEGMessages:sendClientMessage("[sERVER] Please log in to change the password.", thePlayer, 255, 255, 255, true) 
        else 
        setAccountPassword(account, newpassword) 
        exports.SAEGMessages:sendClientMessage("[sERVER] The account password has been change.", thePlayer, 255, 255, 255, true) 
        exports.SAEGMessages:sendClientMessage["[ACCOUNT][uSER:"..nCuenta.."] - [NEW PASSWORD:"..newpassword.."].", thePlayer, 255, 255, 255, true) 
       end 
    end 
end 
addEvent("Cambiar", true) 
addEventHandler("Cambiar", getRootElement(), passwordHandler) 

Link to comment
function passwordHandler(thePlayer, newpassword) 
    local account = getPlayerAccount(thePlayer) 
    local nCuenta = getAccountName(account) 
    if (account) then 
        if (isGuestAccount(account)) then 
            exports.SAEGMessages:sendClientMessage("[sERVER] Please log in to change the password.", thePlayer, 255, 255, 255, true) 
        else 
        setAccountPassword(account, newpassword) 
        exports.SAEGMessages:sendClientMessage("[sERVER] The account password has been change.", thePlayer, 255, 255, 255, true) 
        exports.SAEGMessages:sendClientMessage["[ACCOUNT][uSER:"..nCuenta.."] - [NEW PASSWORD:"..newpassword.."].", thePlayer, 255, 255, 255, true) 
       end 
    end 
end 
addEvent("Cambiar", true) 
addEventHandler("Cambiar", getRootElement(), passwordHandler) 

Same Problem :P :P

Link to comment

The problem from your ACL, even your code will work, i just optimize the code.

Try this (Not tested).
GUI = guiCreateWindow(436, 271, 253, 246, "SAEG - Password Changer", false) 
guiWindowSetSizable(GUI, false) 
guiSetVisible(GUI, false) 
showCursor(false) 
  
Label_Account = guiCreateLabel(10, 31, 52, 15, "Account:", false, GUI) 
Cuenta = guiCreateLabel(72, 31, 171, 15, "none", false, GUI) 
guiLabelSetColor(Cuenta, 255, 0, 0) 
Label_Newpass1 = guiCreateLabel(10, 56, 233, 19, "New Password:", false, GUI) 
guiLabelSetHorizontalAlign(Label_Newpass1, "center", false) 
Edit_pass1 = guiCreateEdit(10, 81, 233, 24, "Password", false, GUI) 
  
Label_Newpass2 = guiCreateLabel(10, 115, 233, 19, "Repeat New Password:", false, GUI) 
guiLabelSetHorizontalAlign(Label_Newpass2, "center", false) 
Edit_pass2 = guiCreateEdit(10, 144, 233, 24, "Password", false, GUI) 
        
Boton_change = guiCreateButton(45, 178, 81, 26, "Change", false, GUI) 
guiSetProperty(Boton_change, "NormalTextColour", "FFAAAAAA") 
Boton_cancel = guiCreateButton(126, 178, 81, 26, "Cancel", false, GUI) 
guiSetProperty(Boton_cancel, "NormalTextColour", "FFAAAAAA") 
Boton_help = guiCreateButton(86, 204, 81, 26, "Help", false, GUI) 
guiSetProperty(Boton_help, "NormalTextColour", "FFAAAAAA") 
  
GUI2 = guiCreateWindow(690, 271, 256, 315, "Help", false) 
guiWindowSetSizable(GUI2, false) 
guiSetVisible(GUI2, false) 
  
scrollpanel = guiCreateScrollPane(10, 27, 236, 241, false, GUI2) 
text_help = guiCreateLabel(0, 0, 243, 245, "/changepass = open panel\n\n*remember to log in.\n*CHANGE = change the password.\n*CANCEL = close panel.\n*HELP = open help panel.\n*CLOSE = close help panel\n\n", false, scrollpanel) 
  
Boton_close = guiCreateButton(86, 278, 85, 25, "CLOSE", false, GUI2) 
guiSetProperty(Boton_close, "NormalTextColour", "FFAAAAAA")   
  
addEvent("OnDatas",true) 
addEventHandler("OnDatas", root, 
function(PCuenta) 
    guiSetText(Cuenta, PCuenta) 
    guiSetVisible(GUI, true) 
    showCursor(true) 
end) 
  
addEventHandler("onClientGUIClick", guiRoot, 
function() 
    if (source == Edit_pass1) then 
        guiSetText(Edit_pass1, "") 
        guiEditSetMasked(Edit_pass1, true) 
    elseif source == Edit_pass2 then 
        guiSetText(Edit_pass2, "") 
        guiEditSetMasked(Edit_pass2, true) 
    elseif source == Boton_change then 
        local newpass1 = guiGetText(Edit_pass1) 
        local newpass2 = guiGetText(Edit_pass2) 
        if (newpass1 == newpass2) then 
            triggerServerEvent("Cambiar", localPlayer, newpass1) 
        else 
            triggerServerEvent("ErrorPass", localPlayer) 
        end 
    elseif source == Boton_close then 
        guiSetVisible(GUI2, false) 
    elseif source == Boton_cancel then 
        guiSetVisible(GUI, false) 
        guiSetVisible(GUI2, false) 
        showCursor(false) 
    elseif source == Boton_help then 
        guiSetVisible(GUI2, not guiGetVisible(GUI2)) 
    end 
end) 

addCommandHandler("changepass", 
function(player) 
    local account = getPlayerAccount(player) 
    if account and not isGuestAccount(account) then 
        triggerClientEvent(player, "OnDatas", player, getAccountName(account)) 
    else 
        exports.SAEGMessages:sendClientMessage("[sERVER] Please log in to use this feature.", player, 255, 255, 255, true) 
    end 
end) 
  
addEvent("ErrorPass", true) 
addEventHandler("ErrorPass", root, 
function() 
    exports.SAEGMessages:sendClientMessage("[sERVER] Passwords do not match.", client, 255, 255, 255, true) 
end) 
  
addEvent("Cambiar", true) 
addEventHandler("Cambiar", root, 
function(newpass1) 
    local account = getPlayerAccount(client) 
    if account and not isGuestAccount(account) then 
        setAccountPassword(account, newpass1) 
        exports.SAEGMessages:sendClientMessage("[sERVER] The account password has been changed.", client, 255, 255, 255, true) 
        exports.SAEGMessages:sendClientMessage("[ACCOUNT][uSER: "..getAccountName(account).." ] - [NEW PASSWORD: "..newpass1.." ].", client, 255, 255, 255, true) 
    else 
        exports.SAEGMessages:sendClientMessage("[sERVER]Please log in to change the password.", client, 255, 255, 255, true) 
    end 
end) 

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