/changepass YINI
#1

Hello, how can i make an changepass cmd with YINI i tried everything and nothing works.
Reply
#2

try this dude

Код:
CMD:password(playerid,params[])
{
      new Old[32],New[32],string[128];
      if(sscanf(params, "ss", old,new)) return SendClientMessage(playerid, CO_IVORY, "Command: /passowrd old new");
      else if(strlen(old) != pInfo[playerid][Your Pass Variable])) return SendClientMessage(playerid, CO_IVORY, "The old password is incorrect");
      else if(strlen(old) < 4 || strlen(old) > 32) return SCM(message with characters 4 - 10); 
      else if(strlen(old) == strlen(new)) SCM(message with old is new);
      else
      {
            new INI:File = INI_Open(YourPath(playerid));
            INI_SetTag(File,"Player Info");
            INI_WriteInt(File,"Password",new);
            INI_Close(File);
      }
      return 1;
}
Reply
#3

There is nothing, and i asking how to make one with YINI.
Reply
#4

Sry i pressed enter when i was typed
Reply
#5

It dont work, can anyone help me?
Reply
#6

wtf so use ****** or wiki omg ..

try this

Код:
CMD:password(playerid, params[])
{
    new New[50], Old[50],Password[129];
    
    if(sscanf(params, "s[50]s[50]", OldPass, NewPass))return SendClientMessage(playerid, COLOR_WHITE, "cmd: old new");
    else if(strcmp(old, yourvariable, false) != 0)return SendClientMessage(playerid, COLOR_RED, "old pass is bad");
    else if(strlen(New) < 4 || strlen(New) > 15)return SendClientMessage(playerid, COLOR_RED, "4 - 15.");
    else
    {
         new INI:file = INI_Open(Your path(playerid));
         INI_WriteString(file,  "Password",strlen(New)); // try with strlen or not
         INI_Close(file);
    }
    return 1;
}
Reply
#7

Is too heavy for me, can someone help me?
Reply
#8

what about to tell me whats wrong ??
Reply
#9

pawn Код:
CMD:changepass(playerid, params[])
{
    new player[MAX_PLAYER_NAME],string[256]; // the player name, // and the string for the path
    if(sscanf(params, "s[256]", parms))return SendClientMessage(playerid, -1, "/changepassword [password]");//sscanf, what ever u write after /change
    format(string, 256, "/%s.ini", player);//put ur ini path here but keep the player
    new INI:file = INI_Open(string); // opening the path
    INI_WriteString(file,  "Password", params);//writing in the path
    INI_Close(file);// close the file
    return 1;
}
Reply
#10

I use hash too and it just open a new file with the password.
Reply
#11

pawn Code:
CMD:changepass(playerid, params[])
{
    new player[MAX_PLAYER_NAME],string[256], hashpass[129];       // the player name, // and the string for the path
    if(sscanf(params, "s[32]s[50]", player, params))return SendClientMessage(playerid, -1, "/changepassword [password]");//sscanf, what ever u write after /change
    format(string, 256, "/%s.ini", player);//put ur ini path here but keep the player
    new INI:file = INI_Open(string); // opening the path
    WP_Hash(hashpass,sizeof(hashpass),params);
    INI_WriteString(file,  "Password", hashpass);//writing in the path
    INI_Close(file);// close the file
    return 1;
}
pawn Code:
/*
  Okay Here what is wrong

*/

 INI_WriteString(file,  "Password", hashpass);//writing in the path
/* Why is it so hard to see you have two different variabls one is password the other is pPasspword
so change this line to
 INI_WriteString(file,  "pPassword", hashpass);//writing in the path
*/
Reply
#12

~fixed~
Reply
#13

First is for a player to change his pass
Second is for admin to change pass for offline players incase a player forgets password....

pawn Code:
CMD:changepass(playerid, params[])
{
    new string[256], hashpass[129], playername[MAX_PLAYER_NAME];     // the player name, // and the string for the path
    if(sscanf(params, "s[256]", params))return SendClientMessage(playerid, -1, "/changepass [password]");//sscanf, what ever u write after /change
    GetPlayerName(playerid, sizeof(playername), playername);
    format(string, 256, "/Users/%s.ini", playername);//put ur ini path here but keep the player
    new INI:file = INI_Open(string); // opening the path
    WP_Hash(hashpass,sizeof(hashpass),params);
    INI_SetTag(file,"data");
    INI_WriteString(file,  "pPassword", hashpass);//writing in the path
    INI_Close(file);// close the file
    return 1;
}

CMD:changepass(playerid, params[])
{
    new player[MAX_PLAYER_NAME],string[256], hashpass[129];      // the player name, // and the string for the path
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You Are Not Rcon"); // make sure online admins can do this cause this is to change any play password
    if(sscanf(params, "s[32]s[50]", player, params))return SendClientMessage(playerid, -1, "/changepass [Username] [password]");//sscanf, what ever u write after /change
    format(string, 256, "/Users/%s.ini", player);//put ur ini path here but keep the player
    new INI:file = INI_Open(string); // opening the path
    WP_Hash(hashpass,sizeof(hashpass),params);
    INI_SetTag(file,"data");
    INI_WriteString(file,  "pPassword", hashpass);//writing in the path
    INI_Close(file);// close the file
    return 1;
}
Reply
#14

It works now, thanks i +rep you!
Reply
#15

PHP Code:

            
new hashpass[129],string[200];
        
WP_Hash(hashpass,sizeof(hashpass),inputtext);
        new 
INI:File INI_Open(Path(playerid));
        
INI_SetTag(File,"Player's Info");
        
INI_WriteString(File,"Password"hashpass);
        
INI_Close(File);
        
SCM(playerid,COLOR_LIGHTBLUE,"You've successfully changed your password");
        
format(string,200,"[AdmWarn]: %s has changed his password",GetName(playerid));
        
SAM(string); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)