Advertisement
2ky

Untitled

2ky
Feb 12th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.10 KB | None | 0 0
  1. CMD:changepassword(playerid, params[])
  2. {
  3.     new
  4.         accOldPass[128],
  5.         accNewPass[128],
  6.         accName[MAX_PLAYER_NAME], //24
  7.         pwStr[128]
  8.     ;
  9.    
  10.     if(sscanf(params, "s[128]s[128]", accOldPass, accNewPass))
  11.         return SendClientMessage(playerid, -1, ""#LIME"<CMD USAGE> "#WHITE"/changepassword <old password> <new password>");
  12.        
  13.     if(udb_hash(accOldPass) == accInfo[playerid][Passcode])
  14.     {  
  15.  
  16.         accInfo[playerid][Passcode] = udb_hash(accNewPass);
  17.        
  18.         new
  19.             INI:accFile = INI_Open(find_accPath(playerid) );
  20.            
  21.         INI_SetTag(accFile,     "data");
  22.         INI_WriteInt(accFile,   "Passcode",     accInfo[playerid][Passcode] )
  23.            
  24.         INI_Close(accFile);
  25.        
  26.         format(pwStr, sizeof(pwStr), ""#CYAN"» "#WHITE"Your password has been changed from \"%s\" to \"%s\"", accOldPass, accNewPass);
  27.         SendClientMessage(playerid, -1, pwStr);
  28.        
  29.         GetPlayerName(playerid, accName, sizeof(accName));
  30.        
  31.         format(pwStr, sizeof(pwStr), ""#CYAN"» "#BLUE"%s has changed their password.", accName);
  32.         SendAdminMessage(1, pwStr);
  33.        
  34.     }
  35.     else return SendClientMessage(playerid, -1, ""#RED"» "#WHITE"Old password is incorrect!");
  36.     return true;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement