26.06.2013, 18:42
First is for a player to change his pass
Second is for admin to change pass for offline players incase a player forgets password....
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;
}