/changepass command
#1

Hi , i want to creat /changepass [OldPass] [NewPass] , but i don't have Any Idea , Betwen , i'm using Zcmd+sscanf2+dini , example for a /register command:

PHP код:
COMMAND:register(playerid,params[])
{
    new 
file[256],PlayerName[MAX_PLAYER_NAME],buf[129];
    
WP_Hash(bufsizeof(buf), params);
    
GetPlayerName(playerid,PlayerName,MAX_PLAYER_NAME);
     
format(file,sizeof(file),"users/%s.txt",PlayerName);
      if(
dini_Exists(file)) return SendClientMessage(playerid,Red,"You are already registered.");
      if(
Account[playerid][Registered] == 1) return SendClientMessage(playerid,Red,"You are already registered.");
    if (
sscanf(params"s[32]"params)) return SendClientMessage(playeridYellow"Usage: /register password");
      if(
Account[playerid][Logged] == 1) return SendClientMessage(playerid,Red,"You are already registered, and logged in.");
    if(
strlen(params))
    {
        if(!
dini_Exists(file))
        {
            
dini_Create(file);
            
dini_Set(file,"Password",buf);
            
dini_IntSet(file,"Registered",1);
            
dini_IntSet(file,"Logged",1);
            
dini_IntSet(file,"Kills",0);
            
dini_IntSet(file,"Deaths",0);
            
dini_IntSet(file,"Level",0);
            
dini_IntSet(file,"Score",Account[playerid][Score] = 0);
            
dini_IntSet(file,"Cash",Account[playerid][Cash] = 0);
               
Account[playerid][Registered] = 1;
            
Account[playerid][Logged] = 1;
            
Account[playerid][Muted] = 0;
            
SendClientMessage(playerid,Green,"You are now registered and automatically logged in!");
            return 
1;
        }
    }
    return 
1;

If you want any other command that it can help u to make /changepass , post here
Reply
#2

have you tryed with only password

dini_set(file,"password",buf/inputext...);
Reply
#3

pawn Код:
COMMAND:changepass(playerid, params[])
{
    new file[256], PlayerName[MAX_PLAYER_NAME], buf[150];
    GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
    if(Account[playerid][Logged] != 1) return SendClientMessage(playerid,Red,"You are not logged in, so you can't use this command!");
    if(strlen(params) >= 3)
    {
        format(file, sizeof(file), "users/%s.txt", PlayerName);
        WP_Hash(buf, sizeof(buf), params);
        dini_Set(file, "Password", buf);
        SendClientMessage(playerid,Green, "Your password has been succesfull changed!");
    }
    else
    {
        SendClientMessage(playerid, Red, "Your password need to be atleast 3 characters long!");
    }
    return 1;
}
Here you go.
Reply
#4

Quote:
Originally Posted by BlackBank3
Посмотреть сообщение
pawn Код:
COMMAND:changepass(playerid, params[])
{
    new file[256], PlayerName[MAX_PLAYER_NAME], buf[150];
    GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
    if(Account[playerid][Logged] != 1) return SendClientMessage(playerid,Red,"You are not logged in, so you can't use this command!");
    if(strlen(params) >= 3)
    {
        format(file, sizeof(file), "users/%s.txt", PlayerName);
        WP_Hash(buf, sizeof(buf), params);
        dini_Set(file, "Password", buf);
        SendClientMessage(playerid,Green, "Your password has been succesfull changed!");
    }
    else
    {
        SendClientMessage(playerid, Red, "Your password need to be atleast 3 characters long!");
    }
    return 1;
}
Here you go.
100% Working Thanx ! +1Rep
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)