Jump to content

How to make command who changes your password [ROLEPLAY]


Recommended Posts

Posted

Hello Community!

I'm asking for help - idk how to make command, that changes player password, someething like chgmypass, but for roleplay server who basing on mysql database.

PLEASE, CAN ANYONE HELP ME WITH THAT?????? 

Posted
function changemypw(plr,cmd,oldpw,newpw)
local accname = getAccountName(getPlayerAccount(plr))
    if getAccount(accname,oldpw) then
        if setAccountPassword(getPlayerAccount(plr),newpw) then
        outputChatBox("Password for acc:"..accname.." successfully changed as: "..newpw,plr,20,230,20)
        else
        outputChatBox("The script needs admin access.",plr,230,20,20)
        end
    else
    outputChatBox("Invalid password!",plr,230,20,20)
    end
end
addCommandHandler("changepw",changemypw)

There you go, use  "/changepw <oldpassword> <newpassword>"

The script must be in admin ACL in order to work.

Posted

Hello @Egekan i dont think your code will work, because i dont see any exports to mysql dude. Maybe u didnt understand me, i mean i need changepw command for server who basing on MYSQL, Roleplay server.

 

Anyone else can help me with that?

Posted
2 hours ago, fortynigguh said:

Hello @Egekan i dont think your code will work, because i dont see any exports to mysql dude. Maybe u didnt understand me, i mean i need changepw command for server who basing on MYSQL, Roleplay server.

 

Anyone else can help me with that?

Then you'll have to use database functions such as DbExec to execute queries and update rows in the table where the passwords are located.

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