MySQL Login problem
#1

Hi there, I'm having some problem while I'm trying to log in .. I just simply type my password and nothing happens.

Here's my OnPlayerLogin:

PHP код:
public OnPlayerLogin(playerid,password[])
{
    new 
loginstring[256],playername2[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayername2sizeof(playername2));
    new 
string400 ] ;
    new 
tmp2[256];
    new 
string2[64];
    
format(string,400,"SELECT * FROM `players` WHERE `username` = '%s' AND `password` = '%s'",ReturnName(playerid),password);
    
mysql_query(string);
    
mysql_store_result();
    if(
mysql_num_rows() >= 0)
    {
        new 
row[128];
        new 
field[116][64];
        
mysql_fetch_row_format(row"|");
        
explode(rowfield"|");
        
mysql_free_result();
        
PlayerInfo[playerid][pLevel] = strval(field[4]);
        
PlayerInfo[playerid][pAdmin] = strval(field[5]);
        
PlayerInfo[playerid][pHelper] = strval(field[110]);
        
PlayerInfo[playerid][pDonateRank] = strval(field[6]);
        
PlayerInfo[playerid][gPupgrade] = strval(field[7]);
        
PlayerInfo[playerid][pConnectTime] = strval(field[8]);
        
PlayerInfo[playerid][pReg] = strval(field[9]);
        
PlayerInfo[playerid][pSex] = strval(field[10]);
        
PlayerInfo[playerid][pAge] = strval(field[11]);
        
PlayerInfo[playerid][pOrigin] = strval(field[12]);
        
PlayerInfo[playerid][pCK] = strval(field[13]);
        
PlayerInfo[playerid][pMuted] = strval(field[14]);
        
PlayerInfo[playerid][pExp] = strval(field[15]);
        
PlayerInfo[playerid][pCash] = strval(field[16]);
        
PlayerInfo[playerid][pAccount] = strval(field[17]);
        
PlayerInfo[playerid][pCrimes] = strval(field[18]);
        
PlayerInfo[playerid][pKills] = strval(field[19]);
        
PlayerInfo[playerid][pDeaths] = strval(field[20]);
        
PlayerInfo[playerid][pArrested] = strval(field[21]);
        
PlayerInfo[playerid][pWantedDeaths] = strval(field[22]);
        
PlayerInfo[playerid][pPhoneBook] = strval(field[23]);
        
PlayerInfo[playerid][pLottoNr] = strval(field[24]);
        
PlayerInfo[playerid][pFishes] = strval(field[25]);
        
PlayerInfo[playerid][pBiggestFish] = strval(field[26]);
        
PlayerInfo[playerid][pJob] = strval(field[27]);
        
PlayerInfo[playerid][pPayCheck] = strval(field[28]);
        
PlayerInfo[playerid][pHeadValue] = strval(field[29]);
        
PlayerInfo[playerid][pJailed] = strval(field[30]);
        
PlayerInfo[playerid][pJailTime] = strval(field[31]);
        
PlayerInfo[playerid][pMats] = strval(field[32]);
        
PlayerInfo[playerid][pDrugs] = strval(field[33]);
        
PlayerInfo[playerid][pBoxMats] = strval(field[105]);
        
PlayerInfo[playerid][pBoxDrugs] = strval(field[106]);
        
PlayerInfo[playerid][pCompMission] = strval(field[87]);
        
PlayerInfo[playerid][pLeader] = strval(field[34]);
        
PlayerInfo[playerid][pMember] = strval(field[35]);
        
PlayerInfo[playerid][pFMember] = strval(field[36]);
        
PlayerInfo[playerid][pRank] = strval(field[37]);
        
PlayerInfo[playerid][pChar] = strval(field[38]);
        
PlayerInfo[playerid][pCRank] = strval(field[89]);
        
PlayerInfo[playerid][pContractTime] = strval(field[39]);
        
WantedLevel[playerid] = strval(field[98]);
        
WantedPoints[playerid] = strval(field[99]);
        
PlayerInfo[playerid][pDetSkill] = strval(field[40]);
        
PlayerInfo[playerid][pSexSkill] = strval(field[41]);
        
PlayerInfo[playerid][pBoxSkill] = strval(field[42]);
        
PlayerInfo[playerid][pDMH] = strval(field[90]);
        
PlayerInfo[playerid][pDMHTK] = strval(field[91]);
        
PlayerInfo[playerid][pLawSkill] = strval(field[43]);
        
PlayerInfo[playerid][pMechSkill] = strval(field[44]);
        
PlayerInfo[playerid][pJackSkill] = strval(field[45]);
        
PlayerInfo[playerid][pCarSkill] = strval(field[46]);
        
PlayerInfo[playerid][pNewsSkill] = strval(field[47]);
        
PlayerInfo[playerid][pDrugsSkill] = strval(field[48]);
        
PlayerInfo[playerid][pCookSkill] = strval(field[39]);
        
PlayerInfo[playerid][pFishSkill] = strval(field[50]);
        
PlayerInfo[playerid][pSHealth] = floatstr(field[97]);
        
PlayerInfo[playerid][pHealth] = floatstr(field[96]);
        
PlayerInfo[playerid][pInt] = strval(field[107]);
        
PlayerInfo[playerid][pLocal] = strval(field[51]);
        
PlayerInfo[playerid][pTeam] = strval(field[52]);
        
PlayerInfo[playerid][pModel] = strval(field[53]);
        
PlayerInfo[playerid][pSpawnLoc] = strval(field[111]);
        
PlayerInfo[playerid][pPnumber] = strval(field[92]);
        
PlayerInfo[playerid][pPhousekey] = strval(field[93]);
        
PlayerInfo[playerid][pPbiskey] = strval(field[112]);
        
PlayerInfo[playerid][pCarLic] = strval(field[55]);
        
PlayerInfo[playerid][pFlyLic] = strval(field[56]);
        
PlayerInfo[playerid][pBoatLic] = strval(field[57]);
        
PlayerInfo[playerid][pFishLic] = strval(field[58]);
        
PlayerInfo[playerid][pGunLic] = strval(field[59]);
        
PlayerInfo[playerid][pGun1] = strval(field[60]);
        
PlayerInfo[playerid][pGun2] = strval(field[61]);
        
PlayerInfo[playerid][pGun3] = strval(field[62]);
        
PlayerInfo[playerid][pGun4] = strval(field[63]);
        
PlayerInfo[playerid][pAmmo1] = strval(field[64]);
        
PlayerInfo[playerid][pAmmo2] = strval(field[65]);
        
PlayerInfo[playerid][pAmmo3] = strval(field[66]);
        
PlayerInfo[playerid][pAmmo4] = strval(field[67]);
        
PlayerInfo[playerid][pCarTime] = strval(field[68]);
        
PlayerInfo[playerid][pPayDay] = strval(field[69]);
        
PlayerInfo[playerid][pPayDayHad] = strval(field[70]);
        
PlayerInfo[playerid][pCDPlayer] = strval(field[71]);
        
PlayerInfo[playerid][pWins] = strval(field[72]);
        
PlayerInfo[playerid][pKit] = strval(field[113]);
        
PlayerInfo[playerid][pLoses] = strval(field[73]);
        
PlayerInfo[playerid][pAlcoholPerk] = strval(field[74]);
        
PlayerInfo[playerid][pDrugPerk] = strval(field[75]);
        
PlayerInfo[playerid][pMiserPerk] = strval(field[76]);
        
PlayerInfo[playerid][pPainPerk] = strval(field[77]);
        
PlayerInfo[playerid][pTraderPerk] = strval(field[78]);
        
PlayerInfo[playerid][pWarns] = strval(field[81]);
        
PlayerInfo[playerid][pTut] = strval(field[79]);
        
PlayerInfo[playerid][pMissionNr] = strval(field[114]);
        
PlayerInfo[playerid][pAD] = strval(field[94]);
        
PlayerInfo[playerid][pWarns] = strval(field[81]);
        
PlayerInfo[playerid][pAdjustable] = strval(field[82]);
        
PlayerInfo[playerid][pFuel] = strval(field[83]);
        
PlayerInfo[playerid][pFACWarns] = strval(field[88]);
        
PlayerInfo[playerid][pAWarns] = strval(field[109]);
        
PlayerInfo[playerid][pMarried] = strval(field[84]);
        
PlayerInfo[playerid][pRob] = strval(field[95]);
        
PlayerInfo[playerid][pBG] = strval(field[103]);
        
PlayerInfo[playerid][pCLUB] = strval(field[108]);
        
PlayerInfo[playerid][pLocked] = strval(field[85]);
        
PlayerInfo[playerid][pSec] = strval(field[115]);
        
PlayerInfo[playerid][pFstyles] = strval(field[101]);
        
PlayerInfo[playerid][pWstyles] = strval(field[100]);
        
PlayerInfo[playerid][pBounty] = strval(field[102]);
     }
     else
     {
        new 
loginname[64];
        
GetPlayerName(playerid,loginname,sizeof(loginname));
        
format(loginstring,sizeof(loginstring),"PAROLA GRESITA\nTe rog baga parola corecta:",loginname);
        
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
          
gPlayerLogTries[playerid] += 1;
          if(
gPlayerLogTries[playerid] == 4) { Ban(playerid); }
        return 
1;
      }
      
PlayerInfo[playerid][pAdjustable] = 0;
      
ResetPlayerMoney(playerid);
      
ConsumingMoney[playerid] = 1;
      
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
      
CurrentMoney[playerid] = PlayerInfo[playerid][pCash];
          
gPlayerLogged[playerid] = 1;
      
SpawnPlayer(playerid);
      
format(tmp2sizeof(tmp2), "~w~Welcome ~n~~g~~h~ %s"playername2);
      
DateProp(playerid);
      
GameTextForPlayer(playeridtmp23001);
          return 
1;

Reply


Messages In This Thread
MySQL Login problem - by .EnjatsRed. - 16.02.2014, 08:28
Re: MySQL Login problem - by CuervO - 16.02.2014, 09:04
Re: MySQL Login problem - by .EnjatsRed. - 16.02.2014, 11:22
Re: MySQL Login problem - by .EnjatsRed. - 16.02.2014, 16:17
Re: MySQL Login problem - by .EnjatsRed. - 17.02.2014, 15:21

Forum Jump:


Users browsing this thread: 1 Guest(s)