rename and reset a pass
#1

Hi.

I use dini.

How can I make a cmd which can rename online users?

And resetting an offline user password?
Reply
#2

Is there a function with dini where you can rename? Like dudb
pawn Код:
udb_RenameUser(nickname[],newnick[]) {
?

And also something similar to the pass?
Reply
#3

erm.. i too wanted this but after switching to mysql things became much easier trust me.
Reply
#4

Quote:
Originally Posted by THE_KNOWN
Посмотреть сообщение
erm.. i too wanted this but after switching to mysql things became much easier trust me.
Ermm. if you have something to help this guy with then say it

otherwise shut up.
Reply
#5

You can use SetPlayerName to change the nick of the online players .


And about the password, we need to know whats is the directory and the key of the player.


Here, a example:


pawn Код:
dini_Set("FileOfPlayer.txt","PlayerPasswordKey","")//The "", is a cleaned string, with no caracters.

I hope that i have helped
Reply
#6

ok I see Rjj, I will give it a try with the SetPlayerName.. Could you show me an example how to save the new name?

a cmd with zcmd and sscanf. /setname <playerid> <new name>

EDIT: Here with the password and the new name .. #define SERVER_USER_FILE "Reg/Users/%s.ini"

EDIT 2: Oh and about the setpassword, can you help me make it like this.. /setpassword <offline username> <the new password the admin types>
Reply
#7

Quote:
Originally Posted by xir
Посмотреть сообщение
ok I see Rjj, I will give it a try with the SetPlayerName.. Could you show me an example how to save the new name?

a cmd with zcmd and sscanf. /setname <playerid> <new name>

EDIT: Here with the password and the new name .. #define SERVER_USER_FILE "Reg/Users/%s.ini"

EDIT 2: Oh and about the setpassword, can you help me make it like this.. /setpassword <offline username> <the new password the admin types>
Ok, here is a example. As i do not know what is the name of the password key in the file, please fix it if you want

pawn Код:
CMD:setname(playerid, params[])
{
    new text[80];
    new NewName[128];
    new FocusPlayerID;
    if(sscanf(params, "us", FocusPlayerID, NewName))
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "/setname <playerid> <new name>");
        return 1;
    }
    SetPlayerName(FocusPlayerID, NewName);
    format(text,80,"Reg/Users/%s.ini", NewName);
    dini_Set(text,"NameKey",NewName);
    return 1;
}


CMD:setpassword(playerid, params[])
{
    new text[80];
    new TypedName[128];
    new TypedPassword[128];
    if(sscanf(params, "ss", TypedName, TypedPassword))
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "/setpassword <offline username> <the new password the admin types>  ");
        return 1;
    }
    format(text,80,"Reg/Users/%s.ini", TypedName);
    dini_Set(text,"PasswordKey",TypedPassword);
    return 1;
}
I hope that i have helped
Reply
#8

Ok thanks, I will test later Really thank you so much.

But the setname, when a player register their account, do I need to make a line like this

pawn Код:
dini_Set(file,"Name",name);
because then it overwrite the name so they can join it with the new name?

EDIT: I use udb_hash to save password, do I need to change something in the setpassword cmd to encrypt the pass?
Reply
#9

Bump about the above.

Ok so I tested the setname cmd and it works.. but it makes a whole new file, it doesnt replace the old one, so the old account is still in use. How to fix that?
Reply
#10

Quote:
Originally Posted by xir
Посмотреть сообщение
Bump about the above.

Ok so I tested the setname cmd and it works.. but it makes a whole new file, it doesnt replace the old one, so the old account is still in use. How to fix that?
Just use frename, function that there is in YSF: https://sampforum.blast.hk/showthread.php?tid=177028

The command will be:

Код:
CMD:setname(playerid, params[])
{
	new NormalName[25];
    new text[80],another[80];
    new NewName[128];
    new FocusPlayerID;
    if(sscanf(params, "us", FocusPlayerID, NewName))
    {
        SendClientMessage(playerid, 0xFFFFFFAA, "/setname <playerid> <new name>");
        return 1;
    }
    GetPlayerName(playerid,NormalName,sizeof(NormalName));
    SetPlayerName(FocusPlayerID, NewName);
    format(text,80,"Reg/Users/%s.ini", NormalName);
    format(another,80,"Reg/Users/%s.ini", NewName);
    frename(text, another);
    dini_Set(another,"NameKey",NewName);
    return 1;
}
I hope that i have helped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)