stock PlayerStats( playerid )
{
if (IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][ pLogged ] ==1)
{
new string3[32];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "/Accounts/%s.ini", playername3);
new ip[ 20 ];
GetPlayerIp(playerid,ip,sizeof(ip));
new File: hFile = fopen(string3, io_write);
if (hFile)
{
dini_Set(string3, "Password", PlayerInfo[playerid][ pPassword ]);
dini_IntSet(string3, "AdminLevel", PlayerInfo[playerid][pAdmin]);
dini_IntSet(string3, "Money", PlayerInfo[playerid][pCash]);
dini_IntSet(string3, "Score", PlayerInfo[playerid][pScore]);
dini_IntSet(string3, "Kills", PlayerInfo[playerid][pKills]);
dini_IntSet(string3, "Deaths", PlayerInfo[playerid][pDeaths]);
dini_IntSet(string3, "Level", PlayerInfo[playerid][Level]);
dini_IntSet(string3, "Exp", PlayerInfo[playerid][Exppoints]);
fclose(hFile);
}
}
}
return 1;
}
stock OnPlayerRegister( playerid, password[] )
{
if (IsPlayerConnected(playerid)) {
new string3[32], playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "/Accounts/%s.ini", playername3);
new ip[ 20 ];
GetPlayerIp(playerid,ip,sizeof(ip));
new File: hFile = fopen(string3, io_write);
if (hFile) {
strmid(PlayerInfo[playerid][ pPassword ], password, 0, strlen(password), 255);
dini_Set(string3, "Password", PlayerInfo[playerid][ pPassword ]);
dini_IntSet(string3, "AdminLevel", 0);
dini_IntSet(string3, "Money", 0);
dini_IntSet(string3, "Score", 0);
dini_IntSet(string3, "Kills", 0);
dini_IntSet(string3, "Deaths", 0);
dini_IntSet(string3, "Level", 0);
dini_IntSet(string3, "Exp", 0);
dini_Set(string3, "IP", ip);
fclose(hFile);
SendClientMessage(playerid, COLOR_FINALSCORE, "You have successfully registered! You may now use /login password to login.");
ResetPlayerMoney(playerid);
}
}
return 1;
}
stock OnPlayerLogin( playerid, password[] )
{
new string2[ 64 ], playername2[ MAX_PLAYER_NAME ], string[ 128 ];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), "/Accounts/%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 , "Password" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(PlayerInfo[playerid][ pPassword ], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(PlayerInfo[playerid][ pPassword ],password, true ) == 0 )
{
new Data[ 256 ];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
PlayerInfo[playerid][pAdmin] = dini_Int(string2, "AdminLevel");
PlayerInfo[playerid][pCash] = dini_Int(string2, "Money");
PlayerInfo[playerid][pScore] = dini_Int(string2, "Score");
PlayerInfo[playerid][pKills] = dini_Int(string2, "Kills");
PlayerInfo[playerid][pDeaths] = dini_Int(string2, "Deaths");
PlayerInfo[playerid][Level] = dini_Int(string2, "Level");
PlayerInfo[playerid][Exppoints] = dini_Int(string2, "Exp");
}//end while
fclose(UserFile);//close the file after everything has been read in the while
}
else
{
SetPVarInt(playerid, "LWarn", GetPVarInt(playerid, "LWarn")+1);
format(string, sizeof(string), "ERROR: Incorrect password! [WARNINGS %d/3]", GetPVarInt(playerid, "LWarn"));
SendClientMessage(playerid, COLOR_RED, string);
if(GetPVarInt(playerid, "LWarn") == 3) {
SendClientMessage(playerid, COLOR_RED, "You have been kicked from the server for too many failed logins");
Kick(playerid);
fclose(UserFile);
}
return 1;
}
PlayerInfo[ playerid ][ pLogged ] =1;
GivePlayerMoney(playerid,PlayerInfo[playerid][ pCash ]);
SetPlayerScore(playerid,PlayerInfo[playerid][ pKills ]);
SystemMsg(playerid, "You have successfully logged in! You may now select your team.");
}
return 1;
}
Originally Posted by park4bmx
Check if it save the PASSWOR when you /Register
|
Key=![]() Level=16 AdminLevel=0 DonateRank=0 UpgradePoints=0 ConnectedTime=0 Registered=1 Sex=1 Age=24 Origin=1 CK=0 Muted=0 Respect=27 Money=10999500 Bank=13000000 Crimes=0 Kills=0 Deaths=4 Arrested=0 WantedDeaths=0 Phonebook=0 LottoNr=0 Fishes=0 BiggestFish=0 Job=16 Paycheck=1214 HeadValue=0 Jailed=0 JailTime=0 Materials=1532500 Drugs=0 Leader=1 Member=0 FMember=255 Rank=0 Char=0 ContractTime=0 DetSkill=0 SexSkill=0 BoxSkill=0 LawSkill=0 MechSkill=0 JackSkill=0 CarSkill=0 NewsSkill=0 DrugsSkill=0 CookSkill=0 FishSkill=0 pSHealth=0.0 pHealth=23.0 Int=0 Local=255 Team=11 Model=0 PhoneNr=321 House=255 Bizz=255 Pos_x=2246.6 Pos_y=-1161.9 Pos_z=1029.5 CarLic=0 FlyLic=0 BoatLic=0 FishLic=0 GunLic=0 Gun1=0 Gun2=0 Gun3=0 Gun4=0 Ammo1=0 Ammo2=0 Ammo3=0 Ammo4=0 CarTime=0 PayDay=1 PayDayHad=0 CDPlayer=0 Wins=0 Loses=0 AlcoholPerk=0 DrugPerk=0 MiserPerk=0 PainPerk=0 TraderPerk=0 Tutorial=1 Mission=0 Warnings=0 Adjustable=1 Fuel=0 Married=0 MarriedTo=No-one |
Password=lwn AdminLevel=0 Money=0 Score=0 Kills=0 Deaths=0 Level=0 Exp=0 IP=127.0.0.1
public Encrypt(string[]) { for (new x=0; x < strlen(string); x++) { string[x] += (3^x) * (x % 15); if (string[x] > (0xff)) { string[x] -= 256; } } return 1; }
dini_IntSet(file,"Password", udb_hash(inputtext));
Originally Posted by park4bmx
have you hashed the pass
EXAMPLE pawn Code:
|