SA-MP Forums Archive
Problem with Registration and Login - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with Registration and Login (/showthread.php?tid=344772)



Problem with Registration and Login - EditPawn - 22.05.2012

Hello, I have a problem with my registration and login ... When a player registers it with some password (eg 1945), the password is saved in the folder scriptfiles is different ... But even so the player can connect with any password he types...

Could someone help me in this code? If you need, I'll post other codes ..

PHP код:
forward OnPlayerRegister(playeridpassword[]);
public 
OnPlayerRegister(playeridpassword[])
{
    if(
IsPlayerConnected(playerid))
    {
            new 
string3[64];
            new 
playername3[MAX_PLAYER_NAME];
            
GetPlayerName(playeridplayername3sizeof(playername3));
            
format(string3sizeof(string3), "Players/%s.ini"playername3);
            new 
FilehFile fopen(string3io_write);
            if (
hFile)
            {
                
strmid(PlayerInfo[playerid][pKey], password0strlen(password), 255);
                new var[
32];
                
format(var, 32"Key=%s\n"PlayerInfo[playerid][pKey]);fwrite(hFile, var);
                
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
                
format(var, 32"Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
                
format(var, 32"AdminLevel=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
                
format(var, 32"DonateRank=%d\n",PlayerInfo[playerid][pVIP]);fwrite(hFile, var);
                
format(var, 32"UpgradePoints=%d\n",PlayerInfo[playerid][gPupgrade]);fwrite(hFile, var);
                
format(var, 32"ConnectedTime=%d\n",PlayerInfo[playerid][pConnectTime]);fwrite(hFile, var);
                
format(var, 32"Registered=%d\n",PlayerInfo[playerid][pReg]);fwrite(hFile, var);
                
format(var, 32"Sex=%d\n",PlayerInfo[playerid][pSex]);fwrite(hFile, var);
                
format(var, 32"Muted=%d\n",PlayerInfo[playerid][pMuted]);fwrite(hFile, var);
                
format(var, 32"Respect=%d\n",PlayerInfo[playerid][pExp]);fwrite(hFile, var);
                
format(var, 32"Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
                
format(var, 32"Bank=%d\n",PlayerInfo[playerid][pConta]);fwrite(hFile, var);
                
format(var, 32"Crimes=%d\n",PlayerInfo[playerid][pCrimes]);fwrite(hFile, var);
                
format(var, 32"Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
                
format(var, 32"Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
                
format(var, 32"Phonebook=%d\n",PlayerInfo[playerid][pPhoneBook]);fwrite(hFile, var);
                
format(var, 32"LottoNr=%d\n",PlayerInfo[playerid][pLottoNr]);fwrite(hFile, var);
                
format(var, 32"BiggestFish=%d\n",PlayerInfo[playerid][pBiggestFish]);fwrite(hFile, var);
                
format(var, 32"Emprego=%d\n",PlayerInfo[playerid][pEmprego]);fwrite(hFile, var);
                
format(var, 32"Paycheck=%d\n",PlayerInfo[playerid][pSalario]);fwrite(hFile, var);
                
format(var, 32"HeadValue=%d\n",PlayerInfo[playerid][pHeadValue]);fwrite(hFile, var);
                
format(var, 32"Jailed=%d\n",PlayerInfo[playerid][pJailed]);fwrite(hFile, var);
                
format(var, 32"JailTime=%d\n",PlayerInfo[playerid][pJailTime]);fwrite(hFile, var);
                
format(var, 32"Materiais=%d\n",PlayerInfo[playerid][pMats]);fwrite(hFile, var);
                
format(var, 32"Maconha=%d\n",PlayerInfo[playerid][pDrogas]);fwrite(hFile, var);
                
format(var, 32"Cocaina=%d\n",PlayerInfo[playerid][pDrogas2]);fwrite(hFile, var);
                
format(var, 32"Crack=%d\n",PlayerInfo[playerid][pDrogas3]);fwrite(hFile, var);
                
format(var, 32"Lider=%d\n",PlayerInfo[playerid][pLider]);fwrite(hFile, var);
                
format(var, 32"Member=%d\n",PlayerInfo[playerid][pMembro]);fwrite(hFile, var);
                
format(var, 32"Rank=%d\n",PlayerInfo[playerid][pCargo]);fwrite(hFile, var);
                
format(var, 32"Char=%d\n",PlayerInfo[playerid][pSkin]);fwrite(hFile, var);
                
format(var, 32"DetSkill=%d\n",PlayerInfo[playerid][pDetSkill]);fwrite(hFile, var);
                
format(var, 32"SexSkill=%d\n",PlayerInfo[playerid][pSexSkill]);fwrite(hFile, var);
                
format(var, 32"BoxSkill=%d\n",PlayerInfo[playerid][pBoxSkill]);fwrite(hFile, var);
                
format(var, 32"LawSkill=%d\n",PlayerInfo[playerid][pLawSkill]);fwrite(hFile, var);
                
format(var, 32"MechSkill=%d\n",PlayerInfo[playerid][pMechSkill]);fwrite(hFile, var);
                
format(var, 32"NewsSkill=%d\n",PlayerInfo[playerid][pNewsSkill]);fwrite(hFile, var);
                
format(var, 32"DrogasSkill=%d\n",PlayerInfo[playerid][pDrogasSkill]);fwrite(hFile, var);
                
format(var, 32"CookSkill=%d\n",PlayerInfo[playerid][pCookSkill]);fwrite(hFile, var);
                
format(var, 32"FishSkill=%d\n",PlayerInfo[playerid][pFishSkill]);fwrite(hFile, var);
                
format(var, 32"pSHealth=%.1f\n",PlayerInfo[playerid][pSHealth]);fwrite(hFile, var);
                
format(var, 32"Team=%d\n",PlayerInfo[playerid][pTeam]);fwrite(hFile, var);
                
format(var, 32"PhoneNr=%d\n",PlayerInfo[playerid][pPnumber]);fwrite(hFile, var);
                
format(var, 32"House=%d\n",PlayerInfo[playerid][pPHousekey]);fwrite(hFile, var);
                
format(var, 32"Bizz=%d\n",PlayerInfo[playerid][pPbiskey]);fwrite(hFile, var);
                
format(var, 32"Spawn=%d\n",PlayerInfo[playerid][pSpawn]);fwrite(hFile, var);
                
format(var, 32"SafeMaconha=%d\n",PlayerInfo[playerid][pSafeDrogas]);fwrite(hFile, var);
                
format(var, 32"SafeCocaina=%d\n",PlayerInfo[playerid][pSafeDrogas2]);fwrite(hFile, var);
                
format(var, 32"SafeCrack=%d\n",PlayerInfo[playerid][pSafeDrogas3]);fwrite(hFile, var);
                
format(var, 32"NivelProcurado=%d\n",WantedPoints[playerid]);fwrite(hFile, var);
                
format(var, 32"SafeMateriais=%d\n",PlayerInfo[playerid][psMats]);fwrite(hFile, var);
                if ((
PlayerInfo[playerid][pPos_x]==0.0 && PlayerInfo[playerid][pPos_y]==0.0 && PlayerInfo[playerid][pPos_z]==0.0))
                {
                    
PlayerInfo[playerid][pPos_x] = 1684.9;
                    
PlayerInfo[playerid][pPos_y] = -2244.5;
                    
PlayerInfo[playerid][pPos_z] = 13.5;
                }
                if(
Spectate[playerid] != 255)
                {
                    
PlayerInfo[playerid][pPos_x] = Unspec[playerid][sPx];
                    
PlayerInfo[playerid][pPos_y] = Unspec[playerid][sPy];
                    
PlayerInfo[playerid][pPos_z] = Unspec[playerid][sPz];
                    
PlayerInfo[playerid][pInt] = Unspec[playerid][sPint];
                    
PlayerInfo[playerid][pLocal] = Unspec[playerid][sLocal];
                }
                
format(var, 32"Pos_x=%.1f\n",PlayerInfo[playerid][pPos_x]);fwrite(hFile, var);
                
format(var, 32"Pos_y=%.1f\n",PlayerInfo[playerid][pPos_y]);fwrite(hFile, var);
                
format(var, 32"Pos_z=%.1f\n",PlayerInfo[playerid][pPos_z]);fwrite(hFile, var);
                
format(var, 32"CarLic=%d\n",PlayerInfo[playerid][pCarLic]);fwrite(hFile, var);
                
format(var, 32"FlyLic=%d\n",PlayerInfo[playerid][pFlyLic]);fwrite(hFile, var);
                
format(var, 32"BoatLic=%d\n",PlayerInfo[playerid][pBoatLic]);fwrite(hFile, var);
                
format(var, 32"GunLic=%d\n",PlayerInfo[playerid][pGunLic]);fwrite(hFile, var);
                
format(var, 32"PayDay=%d\n",PlayerInfo[playerid][pPayDay]);fwrite(hFile, var);
                
format(var, 32"Wins=%d\n",PlayerInfo[playerid][pWins]);fwrite(hFile, var);
                
format(var, 32"Loses=%d\n",PlayerInfo[playerid][pLoses]);fwrite(hFile, var);
                
format(var, 32"AlcoholPerk=%d\n",PlayerInfo[playerid][pAlcoholPerk]);fwrite(hFile, var);
                
format(var, 32"DrugPerk=%d\n",PlayerInfo[playerid][pDrugPerk]);fwrite(hFile, var);
                
format(var, 32"MiserPerk=%d\n",PlayerInfo[playerid][pMiserPerk]);fwrite(hFile, var);
                
format(var, 32"PainPerk=%d\n",PlayerInfo[playerid][pPainPerk]);fwrite(hFile, var);
                
format(var, 32"TraderPerk=%d\n",PlayerInfo[playerid][pTraderPerk]);fwrite(hFile, var);
                
format(var, 32"Tutorial=%d\n",PlayerInfo[playerid][pTut]);fwrite(hFile, var);
                
format(var, 32"Avisos=%d\n",PlayerInfo[playerid][pWarns]);fwrite(hFile, var);
                
format(var, 32"Married=%d\n",PlayerInfo[playerid][pMarried]);fwrite(hFile, var);
                
format(var, 32"MarriedTo=%s\n",PlayerInfo[playerid][pMarriedTo]);fwrite(hFile, var);
                
format(var, 32"Luta=%d\n",PlayerInfo[playerid][pLuta]);fwrite(hFile, var);
                
format(var, 32"Dorgado=%d\n",PlayerInfo[playerid][pDorgado]);fwrite(hFile, var);
                
format(var, 32"Dorgado2=%d\n",PlayerInfo[playerid][pDorgado2]);fwrite(hFile, var);
                
format(var, 32"Doenca=%d\n",PlayerInfo[playerid][pDoenca]);fwrite(hFile, var);
                
format(var, 32"Creditos=%d\n",PlayerInfo[playerid][pCreditos]);fwrite(hFile, var);
                
format(var, 32"LU=%s\n",PlayerInfo[playerid][pLastLogin]);fwrite(hFile, var);
                
format(var, 32"Gun1=%d\n"PlayerInfo[playerid][pGun1]);fwrite(hFile, var);
                
format(var, 32"Gun2=%d\n"PlayerInfo[playerid][pGun2]);fwrite(hFile, var);
                
format(var, 32"Gun3=%d\n"PlayerInfo[playerid][pGun3]);fwrite(hFile, var);
                
format(var, 32"Gun4=%d\n"PlayerInfo[playerid][pGun4]);fwrite(hFile, var);
                
format(var, 32"Gun5=%d\n"PlayerInfo[playerid][pGun5]);fwrite(hFile, var);
                
format(var, 32"Gun6=%d\n"PlayerInfo[playerid][pGun6]);fwrite(hFile, var);
                
format(var, 32"Gun7=%d\n"PlayerInfo[playerid][pGun7]);fwrite(hFile, var);
                
format(var, 32"Gun8=%d\n"PlayerInfo[playerid][pGun8]);fwrite(hFile, var);
                
format(var, 32"Gun9=%d\n"PlayerInfo[playerid][pGun9]);fwrite(hFile, var);
                
format(var, 32"Gun10=%d\n"PlayerInfo[playerid][pGun10]);fwrite(hFile, var);
                
format(var, 32"Gun11=%d\n"PlayerInfo[playerid][pGun11]);fwrite(hFile, var);
                
format(var, 32"Gun12=%d\n"PlayerInfo[playerid][pGun12]);fwrite(hFile, var);
                
format(var, 32"Ammo1=%d\n"PlayerInfo[playerid][pAmmo1]);fwrite(hFile, var);
                
format(var, 32"Ammo2=%d\n"PlayerInfo[playerid][pAmmo2]);fwrite(hFile, var);
                
format(var, 32"Ammo3=%d\n"PlayerInfo[playerid][pAmmo3]);fwrite(hFile, var);
                
format(var, 32"Ammo4=%d\n"PlayerInfo[playerid][pAmmo4]);fwrite(hFile, var);
                
format(var, 32"Ammo5=%d\n"PlayerInfo[playerid][pAmmo5]);fwrite(hFile, var);
                
format(var, 32"Ammo6=%d\n"PlayerInfo[playerid][pAmmo6]);fwrite(hFile, var);
                
format(var, 32"Ammo7=%d\n"PlayerInfo[playerid][pAmmo7]);fwrite(hFile, var);
                
format(var, 32"Ammo8=%d\n"PlayerInfo[playerid][pAmmo8]);fwrite(hFile, var);
                
format(var, 32"Ammo9=%d\n"PlayerInfo[playerid][pAmmo9]);fwrite(hFile, var);
                
format(var, 32"Ammo10=%d\n"PlayerInfo[playerid][pAmmo10]);fwrite(hFile, var);
                
format(var, 32"Ammo11=%d\n"PlayerInfo[playerid][pAmmo11]);fwrite(hFile, var);
                
format(var, 32"Ammo12=%d\n"PlayerInfo[playerid][pAmmo12]);fwrite(hFile, var);
                
fclose(hFile);
            }
            
SendClientMessage(playerid0x33FF00FF"You can now type /login <password>");
            
ShowPlayerDialog(playerid1DIALOG_STYLE_INPUT"TEST""TEST\n{5CACEE}Enter your password to log in.""Log""Wait");
    }
    return 
1;
}
forward OnPlayerLogin(playerid,password[]);
public 
OnPlayerLogin(playerid,password[])
{
    new 
tmp2[256];
    new 
string2[64];
    
format(string2sizeof(string2), "Players/%s.ini"PlayerName(playerid));
    
strmid(PlayerInfo[playerid][pKey], dini_Get(string2"Key"), 0strlen(dini_Get(string2"Key")), 255);
    new 
FileUserFile fopen(string2io_read);
    if (
UserFile)
    {
        if(
strcmp(PlayerInfo[playerid][pKey],passwordtrue ) == 0)
        {
                new 
key256 ] , val256 ];
                new 
Data256 ];
                while (
fread(UserFileDatasizeof(Data)))
                {
                    
key ini_GetKeyData );
                    if( 
strcmpkey "Level" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pLevel] = strvalval ); }
                    if( 
strcmpkey "AdminLevel" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAdmin] = strvalval ); }
                    if( 
strcmpkey "DonateRank" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pVIP] = strvalval ); }
                    if( 
strcmpkey "UpgradePoints" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][gPupgrade] = strvalval ); }
                    if( 
strcmpkey "ConnectedTime" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pConnectTime] = strvalval ); }
                    if( 
strcmpkey "Registered" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pReg] = strvalval ); }
                    if( 
strcmpkey "Sex" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pSex] = strvalval ); }
                    if( 
strcmpkey "Muted" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pMuted] = strvalval ); }
                    if( 
strcmpkey "Respect" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pExp] = strvalval ); }
                    if( 
strcmpkey "Money" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pCash] = strvalval ); }
                    if( 
strcmpkey "Bank" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pConta] = strvalval ); }
                    if( 
strcmpkey "Crimes" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pCrimes] = strvalval ); }
                    if( 
strcmpkey "Kills" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pKills] = strvalval ); }
                    if( 
strcmpkey "Deaths" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pDeaths] = strvalval ); }
                    if( 
strcmpkey "Phonebook" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pPhoneBook] = strvalval ); }
                    if( 
strcmpkey "LottoNr" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pLottoNr] = strvalval ); }
                    if( 
strcmpkey "BiggestFish" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pBiggestFish] = strvalval ); }
                    if( 
strcmpkey "Emprego" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pEmprego] = strvalval ); }
                    if( 
strcmpkey "Paycheck" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pSalario] = strvalval ); }
                    if( 
strcmpkey "HeadValue" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pHeadValue] = strvalval ); }
                    if( 
strcmpkey "Jailed" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pJailed] = strvalval ); }
                    if( 
strcmpkey "JailTime" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pJailTime] = strvalval ); }
                    if( 
strcmpkey "Materiais" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pMats] = strvalval ); }
                    if( 
strcmpkey "Maconha" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pDrogas] = strvalval ); }
                    if( 
strcmpkey "Cocaina" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pDrogas2] = strvalval ); }
                    if( 
strcmpkey "Crack" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pDrogas3] = strvalval ); }
                    if( 
strcmpkey "Lider" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pLider] = strvalval ); }
                    if( 
strcmpkey "Member" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pMembro] = strvalval ); }
                    if( 
strcmpkey "Rank" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pCargo] = strvalval ); }
                    if( 
strcmpkey "Char" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pSkin] = strvalval ); }
                    if( 
strcmpkey "DetSkill" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pDetSkill] = strvalval ); }
                    if( 
strcmpkey "SexSkill" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pSexSkill] = strvalval ); }
                    if( 
strcmpkey "BoxSkill" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pBoxSkill] = strvalval ); }
                    if( 
strcmpkey "LawSkill" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pLawSkill] = strvalval ); }
                    if( 
strcmpkey "MechSkill" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pMechSkill] = strvalval ); }
                    if( 
strcmpkey "NewsSkill" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pNewsSkill] = strvalval ); }
                    if( 
strcmpkey "DrogasSkill" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pDrogasSkill] = strvalval ); }
                    if( 
strcmpkey "CookSkill" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pCookSkill] = strvalval ); }
                    if( 
strcmpkey "FishSkill" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pFishSkill] = strvalval ); }
                    if( 
strcmpkey "pSHealth" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pSHealth] = floatstrval ); }
                    if( 
strcmpkey "Team" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pTeam] = strvalval ); }
                    if( 
strcmpkey "PhoneNr" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pPnumber] = strvalval ); }
                    if( 
strcmpkey "House" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pPHousekey] = strvalval ); }
                    if( 
strcmpkey "Bizz" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pPbiskey] = strvalval ); }
                    if( 
strcmpkey "Pos_x" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pPos_x] = floatstrval ); }
                    if( 
strcmpkey "Pos_y" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pPos_y] = floatstrval ); }
                    if( 
strcmpkey "Pos_z" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pPos_z] = floatstrval ); }
                    if( 
strcmpkey "CarLic" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pCarLic] = strvalval ); }
                    if( 
strcmpkey "FlyLic" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pFlyLic] = strvalval ); }
                    if( 
strcmpkey "BoatLic" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pBoatLic] = strvalval ); }
                    if( 
strcmpkey "GunLic" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGunLic] = strvalval ); }
                    if( 
strcmpkey "PayDay" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pPayDay] = strvalval ); }
                    if( 
strcmpkey "Wins" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pWins] = strvalval ); }
                    if( 
strcmpkey "Loses" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pLoses] = strvalval ); }
                    if( 
strcmpkey "AlcoholPerk" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAlcoholPerk] = strvalval ); }
                    if( 
strcmpkey "DrugPerk" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pDrugPerk] = strvalval ); }
                    if( 
strcmpkey "MiserPerk" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pMiserPerk] = strvalval ); }
                    if( 
strcmpkey "PainPerk" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pPainPerk] = strvalval ); }
                    if( 
strcmpkey "TraderPerk" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pTraderPerk] = strvalval ); }
                    if( 
strcmpkey "Tutorial" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pTut] = strvalval ); }
                    if( 
strcmpkey "Avisos" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pWarns] = strvalval ); }
                    if( 
strcmpkey "Married" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pMarried] = strvalval ); }
                    if( 
strcmpkey "MarriedTo" true ) == ) { val ini_GetValueData ); strmid(PlayerInfo[playerid][pMarriedTo], val0strlen(val)-1255); }
                    if( 
strcmpkey "Spawn" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pSpawn] = strvalval ); }
                    if( 
strcmpkey "SafeMaconha" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pSafeDrogas] = strvalval ); }
                    if( 
strcmpkey "SafeCocaina" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pSafeDrogas2] = strvalval ); }
                    if( 
strcmpkey "SafeCrack" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pSafeDrogas3] = strvalval ); }
                    if( 
strcmpkey "NivelProcurado" true ) == ) { val ini_GetValueData ); WantedPoints[playerid] = strvalval ); }
                    if( 
strcmpkey "SafeMateriais" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][psMats] = strvalval ); }
                    if( 
strcmpkey "Luta" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pLuta] = strvalval ); }
                    if( 
strcmpkey "Dorgado" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pDorgado] = strvalval ); }
                    if( 
strcmpkey "Dorgado2" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pDorgado2] = strvalval ); }
                    if( 
strcmpkey "Doenca" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pDoenca] = strvalval ); }
                    if( 
strcmpkey "Creditos" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pCreditos] = strvalval ); }
                    if( 
strcmpkey "LU" true ) == ) { val ini_GetValueData ); strmid(PlayerInfo[playerid][pLastLogin], val0strlen(val)-1255); }
                    if( 
strcmpkey "Gun1" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGun1] = strvalval ); }
                    if( 
strcmpkey "Gun2" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGun2] = strvalval ); }
                    if( 
strcmpkey "Gun3" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGun3] = strvalval ); }
                    if( 
strcmpkey "Gun4" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGun4] = strvalval ); }
                    if( 
strcmpkey "Gun5" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGun5] = strvalval ); }
                    if( 
strcmpkey "Gun6" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGun6] = strvalval ); }
                    if( 
strcmpkey "Gun7" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGun7] = strvalval ); }
                    if( 
strcmpkey "Gun8" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGun8] = strvalval ); }
                    if( 
strcmpkey "Gun9" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGun9] = strvalval ); }
                    if( 
strcmpkey "Gun10" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGun10] = strvalval ); }
                    if( 
strcmpkey "Gun11" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGun11] = strvalval ); }
                    if( 
strcmpkey "Gun12" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pGun12] = strvalval ); }
                    if( 
strcmpkey "Ammo1" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAmmo1] = strvalval ); }
                    if( 
strcmpkey "Ammo2" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAmmo2] = strvalval ); }
                    if( 
strcmpkey "Ammo3" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAmmo3] = strvalval ); }
                    if( 
strcmpkey "Ammo4" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAmmo4] = strvalval ); }
                    if( 
strcmpkey "Ammo5" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAmmo5] = strvalval ); }
                    if( 
strcmpkey "Ammo6" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAmmo6] = strvalval ); }
                    if( 
strcmpkey "Ammo7" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAmmo7] = strvalval ); }
                    if( 
strcmpkey "Ammo8" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAmmo8] = strvalval ); }
                    if( 
strcmpkey "Ammo9" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAmmo9] = strvalval ); }
                    if( 
strcmpkey "Ammo10" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAmmo10] = strvalval ); }
                    if( 
strcmpkey "Ammo11" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAmmo11] = strvalval ); }
                    if( 
strcmpkey "Ammo12" true ) == ) { val ini_GetValueData ); PlayerInfo[playerid][pAmmo12] = strvalval ); }
                    
logouagora[playerid] = 1;
                    
CheckOwner(playerid);
                    
//CheckAdmin(playerid);
                    
CheckOwnerb(playerid);
                    
CheckOwnerh(playerid);
                    
//CheckVip(playerid);
                
}//end while
                
fclose(UserFile);//close the file after everything has been read in the while
        
}
        else
        {
            
SendClientMessage(playeridCOLOR_YELLOW"Wrong password! - If the wrong password five times will be IP Banned!");
            
SetPlayerCameraPos(playerid,1483.8164,-1727.4125,13.3828);
            
SetPlayerCameraLookAt(playerid,1481.0267,-1772.1371,19.4570);
            
ShowPlayerDialog(playerid1DIALOG_STYLE_INPUT"TEST""TEST\n{5CACEE}Enter your password to log in.""Log""Wait");
            
fclose(UserFile);
            
gPlayerLogTries[playerid] += 1;
            if(
gPlayerLogTries[playerid] == 5)
            {
                new 
stri[64], tmp[20], tmp3[20], ip[16];
                
GetPlayerIp(playeridipsizeof ip);
                
format(strisizeof(stri), "IPsBans/%s.ini",ip);
                
getdate(YearMonthDay);
                
format(tmp20"%d/%d/%d"DayMonthYear);
                
gettime(HouMinuteSecond);
                
format(tmp320"%d:%d:%d"HourMinuteSecond);
                
format(strisizeof(stri), "IPsBans/%s.ini",ip);
                
dini_Create(stri);
                
dini_Set(stri,"Reason","Wrong password five times");
                
dini_Set(stri,"Admin","BSG_BOT");
                
dini_Set(stri,"Date",tmp);
                
dini_Set(stri,"Hour",tmp3);
                
dini_Set(stri,"Nick",PlayerName(playerid));
            }
            return 
1;
        }
    }
    return 
1;

CMDs:

PHP код:
CMD:login(playeridparams[])
{
    if(
IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
    {
        new 
tmppass[64];
        if(
gPlayerLogged[playerid] == 1)
            return 
SendClientMessage(playeridCOLOR_GREY"You're already logged.");
        if(
sscanf(params"d[64]"tmppass))
        {
            
OnPlayerLogin(playeridtmppass);
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GRAD1"/login[password]");
            
ShowPlayerDialog(playerid1DIALOG_STYLE_INPUT"TEST""TEST\n{5CACEE}Enter your password to log in.""Log""Wait");
        }
    }
    return 
1;
}
CMD:register(playeridparams[]) 
{
    new 
sStr[64];
    if(
gPlayerLogged[playerid] == 1)
        return 
SendClientMessage(playeridCOLOR_GREY" You're already logged.");
    
format(sStr64"Players/%s.ini"PlayerName(playerid));
    new 
FilehFile fopen(sStrio_read);
    if(
hFile)
    {
        
SendClientMessage(playeridCOLOR_YELLOW"This Nick already exists, use another.");
        
fclose(hFile);
        
ShowPlayerDialog(playerid2DIALOG_STYLE_INPUT"TEST""TEST\n{5CACEE}Enter your Password to Register!""Register""Cancel");
        return 
1;
    }
    new 
tmppass[64];
    if(
sscanf(params"d[64]"tmppass))
    {
        
OnPlayerRegister(playeridtmppass);
    }
    else
    {
        
SendClientMessage(playeridCOLOR_GRAD1"/register [password]");
        
ShowPlayerDialog(playerid2DIALOG_STYLE_INPUT"TEST""TEST\n{5CACEE}Enter your Password to Register!""Register""Cancel");
    }
    return 
1;




Re: Problem with Registration and Login - Ruben_Alonso - 22.05.2012

Switch your register command to this one.
pawn Код:
CMD:register(playerid, params[])  
{
    new sStr[64];
    if(gPlayerLogged[playerid] == 1)
        return SendClientMessage(playerid, COLOR_GREY, " You're already logged.");

    format(sStr, 64, "Players/%s.ini", PlayerName(playerid));
    new File: hFile = fopen(sStr, io_read);
    if(hFile)
    {
        SendClientMessage(playerid, COLOR_YELLOW, "This Nick already exists, use another.");
        fclose(hFile);
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "TEST", "TEST\n{5CACEE}Enter your Password to Register!", "Register", "Cancel");
        return 1;
    }
    new tmppass[64];
    if(sscanf(params, "s[64]", tmppass))
    {
        OnPlayerRegister(playerid, tmppass);
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD1, "/register [password]");
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "TEST", "TEST\n{5CACEE}Enter your Password to Register!", "Register", "Cancel");
    }
    return 1;
}
What's changed:
pawn Код:
if(sscanf(params, "d[64]", tmppass))
to
pawn Код:
if(sscanf(params, "s[64]", tmppass))



Re: Problem with Registration and Login - EditPawn - 22.05.2012

Thanks, it worked just right aki

+rep


Re: Problem with Registration and Login - kikito - 22.05.2012

Quote:
Originally Posted by EditPawn
Посмотреть сообщение
Thanks, it worked just right aki

+rep
Don't use translate buddy, since the people on brazil do alot of gramatical errors, ****** will do alot of errors too(on translation)