04.11.2014, 14:12
Код:
public OnPlayerStatsUpdate(playerid) { if(GetPVarInt(playerid, "TempName") == 1) return 1; if(IsPlayerConnected(playerid)) { if(gPlayerLogged{playerid}) { new string3[32]; new playername3[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername3, sizeof(playername3)); format(string3, sizeof(string3), "users/%s.ini", playername3); new File: hFile = fopen(string3, io_write); if (hFile) { new var[156]; format(var, 32, "Key=%s\n", PlayerInfo[playerid][pKey]);fwrite(hFile, var); format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var); format(var, 32, "AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var); fclose(hFile); } } } return 1; }
Код:
public OnPlayerLogin(playerid,password[]) { new string[128]; new tmp2[256]; new string2[128]; new playername2[MAX_PLAYER_NAME]; GetPlayerName(playerid, playername2, sizeof(playername2)); format(string2, sizeof(string2), "users/%s.ini", playername2); new File: UserFile = fopen(string2, io_read); if ( UserFile ) { new PassData[256]; new keytmp[256], valtmp[256]; fread( UserFile , PassData , sizeof( PassData ) ); keytmp = ini_GetKey( PassData ); if( strcmp( keytmp , "Key" , true ) == 0 ) { valtmp = ini_GetValue( PassData ); strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255); } if( strfind( PlayerInfo[playerid][pKey], "\r", true) != -1) { format(string, sizeof(string), "Warning: \\r found in player %s's password. Removing now. Password Before: %s", GetPlayerNameEx(playerid), PlayerInfo[playerid][pKey]); Log("logs/password.log", string); new pos = strfind( PlayerInfo[playerid][pKey], "\r", true); strdel(PlayerInfo[playerid][pKey], pos, pos+2); format(string, sizeof(string), "%s's Password After: %s (Note these passwords are encrypted)", GetPlayerNameEx(playerid), PlayerInfo[playerid][pKey]); Log("logs/password.log", string); } //if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 ) if(strcmp(PlayerInfo[playerid][pKey],password,true) == 0) { new key[ 256 ] , val[ 256 ]; new Data[ 256 ]; while ( fread( UserFile , Data , sizeof( Data ) ) ) { key = ini_GetKey( Data ); if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); } if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); } } fclose(UserFile); }
pLevel
pAdmin
pKey
In your pInfo