CMD:changepass(playerid,params[]) { new newstring[128]; new newpass[129]; if(PInfo[playerid][Logged] == 0) return SendClientMessage(playerid,STEALTH_BLUE,"You need to be logged in first."); if(sscanf(params,"s[128]",newpass)) return SendClientMessage(playerid,STEALTH_BLUE,"USAGE: /changepass [new pass]"); format(newstring, sizeof(newstring), "You have successfully changed your password to %s",newpass); SendClientMessage(playerid,COLOR_PALEGREEN,newstring); WP_Hash(newpass,sizeof(newpass),newstring); new INI:file = INI_Open(Path(playerid)); PInfo[playerid][Password] = newpass; INI_Close(file); return 1; }
CMD:changepass(playerid,params[])
{
new newstring[128];
new newpass[129];
if(PInfo[playerid][Logged] == 0)
return SendClientMessage(playerid,STEALTH_BLUE,"You need to be logged in first.");
if(sscanf(params,"s[128]",newpass))
return SendClientMessage(playerid,STEALTH_BLUE,"USAGE: /changepass [new pass]");
format(newstring, sizeof(newstring), "You have successfully changed your password to %s",newpass);
SendClientMessage(playerid,COLOR_PALEGREEN,newstring);
WP_Hash(newpass,sizeof(newpass),newstring);
PInfo[playerid][Password] = newpass;
new INI:file = INI_Open(Path(playerid));
INI_WriteString(file, "Password", newpass);
INI_Close(file);
return 1;
}
CMD:changepass(playerid,params[]) { new newstring[128]; new newpass[129]; if(PInfo[playerid][Logged] == 0) return SendClientMessage(playerid,STEALTH_BLUE,"You need to be logged in first."); if(sscanf(params,"s[128]",newpass)) return SendClientMessage(playerid,STEALTH_BLUE,"USAGE: /changepass [new pass]"); format(newstring, sizeof(newstring), "You have successfully changed your password to %s",newpass); SendClientMessage(playerid,COLOR_PALEGREEN,newstring); WP_Hash(newpass,sizeof(newpass),newstring); PInfo[playerid][Password] = newpass; INI_ParseFile(Path(playerid), "ChangePass", .bExtra = true, .extra = newpass); return 1; } forward ChangePass(newpass, name[], value[]); public ChangePass(newpass, name[], value[]) { INI_String("Password", newpass); return 0; }
new INI:file = INI_Open(Path(playerid));
strcpy(PInfo[playerid][Password], newpass, 129);
INI_WriteString(file, "Password", newpass);
INI_Close(file);
CMD:changepass(playerid,params[])
{
new newstring[128], newpass[129];
if(PInfo[playerid][Logged] == 0) return SendClientMessage(playerid,STEALTH_BLUE,"You need to be logged in first.");
if(sscanf(params,"s[128]",newpass))
return SendClientMessage(playerid,STEALTH_BLUE,"USAGE: /changepass [new pass]");
format(newstring, sizeof(newstring), "You have successfully changed your password to %s",newpass);
SendClientMessage(playerid,COLOR_PALEGREEN,newstring);
WP_Hash(newpass, sizeof(newpass), newstring);
new INI:file = INI_Open(Path(playerid));
INI_SetTag(file, "[Player's Data]");
INI_WriteString(file, "Password", newpass);
INI_Close(file);
PInfo[playerid][Password] = newpass;
return 1;
}
this is my config file
i tried your code,now it shows this in my file Password = 04C730B23159E2FA3B3148B8C3EC784EA8E0D62D11D44E5040 405E24440A554B376A54AAE82625B93C8804BF00666FA748A2 5DC198E30DE6025BE9DC09C3B717 [Player's Data] Password = 0AA2336AC0A19C46864358E6F39FA9E48C252A705170CF4B7C A4F8A93C55960F93A156BFD81B9FBA286AFBC07E6B982D156D AD03AB250361CB8A503A673DFA13 AdminLevel = 7 Money = 0 Score = 0 Kill = 0 Death = 0 Mute = 0 Jail = 0 CMDMuted = 0 Crashed = 0 Crash = 0 |
[Player's Data] Password = 04C730B23159E2FA3B3148B8C3EC784EA8E0D62D11D44E5040405E24440A554B376A54AAE82625B93C8804BF00666FA748A25DC198E30DE6025BE9DC09C3B717 [Player's Data] Password = 0AA2336AC0A19C46864358E6F39FA9E48C252A705170CF4B7CA4F8A93C55960F93A156BFD81B9FBA286AFBC07E6B982D156DAD03AB250361CB8A503A673DFA13 AdminLevel = 7 Money = 0 Score = 0 Kill = 0 Death = 0 Mute = 0 Jail = 0 CMDMuted = 0 Crashed = 0 Crash = 0
CMD:changepass(playerid,params[]) { new newstring[64], hashpass[129], newpass[32]; if(PInfo[playerid][Logged] == 0) return SendClientMessage(playerid,STEALTH_BLUE,"You need to be logged in first."); if(sscanf(params,"s[32]",newpass)) return SendClientMessage(playerid,STEALTH_BLUE,"USAGE: /changepass [new pass]"); format(newstring, sizeof(newstring), "You have successfully changed your password to %s",newpass); SendClientMessage(playerid,COLOR_PALEGREEN,newstring); WP_Hash(hashpass,sizeof(hashpass),newpass); format(PInfo[playerid][Password], 129, "%s", hashpass); INI_ParseFile(Path(playerid), "ChangePass", .bExtra = true, .extra = playerid); return 1; } forward ChangePass(playerid, name[], value[]); public ChangePass(playerid, name[], value[]) { INI_String("Password", PInfo[playerid][Password], 129); return 0; }
enum Example { Password[129] } new PInfo[MAX_PLAYERS][Example];