31.05.2011, 18:23
So I did and I did connect to mysql to save the accounts in datebase but when I relog but I see that makes me have an account and write your birth date and city male female spawn. What is the problem?
My gamemode is connected to mysql to save the accounts in the database, but when I relog I see that it makes me register again. What is the problem?
public OnPlayerUpdate(playerid) // by Luk0r v1.2
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid])
{
MySQLCheckConnection();
new query[MAX_STRING];
format(query, MAX_STRING, "UPDATE players SET ");
MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pKey]);
PlayerInfo[playerid][pCash] = GetPlayerCash(playerid);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "PlayerLevel", PlayerInfo[playerid][pLevel]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "AdminLevel", PlayerInfo[playerid][pAdmin]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "DonateRank", PlayerInfo[playerid][pDonateRank]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "UpgradePoints", PlayerInfo[playerid][gPupgrade]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "ConnectedTime", PlayerInfo[playerid][pConnectTime]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Registered", PlayerInfo[playerid][pReg]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Sex", PlayerInfo[playerid][pSex]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Age", PlayerInfo[playerid][pAge]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Origin", PlayerInfo[playerid][pOrigin]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "CK", PlayerInfo[playerid][pCK]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Muted", PlayerInfo[playerid][pMuted]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Respect", PlayerInfo[playerid][pExp]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Money", PlayerInfo[playerid][pCash]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "NameChanged", PlayerInfo[playerid][pNameChanged]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Bank", PlayerInfo[playerid][pAccount]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Crimes", PlayerInfo[playerid][pCrimes]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Kills", PlayerInfo[playerid][pKills]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Deaths", PlayerInfo[playerid][pDeaths]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Arrested", PlayerInfo[playerid][pArrested]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "WantedDeaths", PlayerInfo[playerid][pWantedDeaths]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Phonebook", PlayerInfo[playerid][pPhoneBook]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "LottoNr", PlayerInfo[playerid][pLottoNr]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Fishes", PlayerInfo[playerid][pFishes]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "BiggestFish", PlayerInfo[playerid][pBiggestFish]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Job", PlayerInfo[playerid][pJob]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Paycheck", PlayerInfo[playerid][pPayCheck]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "HeadValue", PlayerInfo[playerid][pHeadValue]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Jailed", PlayerInfo[playerid][pJailed]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "JailTime", PlayerInfo[playerid][pJailTime]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "RobTime", PlayerInfo[playerid][pRobTime]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "BlackList", PlayerInfo[playerid][pBlackList]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "MoneyClear", PlayerInfo[playerid][pMoneyClear]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Bonus", PlayerInfo[playerid][pBonus]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "BlackListTime", PlayerInfo[playerid][pBLTime]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FactionTimeSpent", PlayerInfo[playerid][pFacTimeSpent]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FactionTime", PlayerInfo[playerid][pFacTime]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "MuteTime", PlayerInfo[playerid][pMuteTime]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "MaterialsPackages", PlayerInfo[playerid][pMatsPack]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Materials", PlayerInfo[playerid][pMats]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Drugs", PlayerInfo[playerid][pDrugs]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Leader", PlayerInfo[playerid][pLeader]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Member", PlayerInfo[playerid][pMember]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FMember", PlayerInfo[playerid][pFMember]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Rank", PlayerInfo[playerid][pRank]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Char", PlayerInfo[playerid][pChar]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "ContractTime", PlayerInfo[playerid][pContractTime]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "DetSkill", PlayerInfo[playerid][pDetSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "SexSkill", PlayerInfo[playerid][pSexSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "BoxSkill", PlayerInfo[playerid][pBoxSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "LawSkill", PlayerInfo[playerid][pLawSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "MechSkill", PlayerInfo[playerid][pMechSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "JackSkill", PlayerInfo[playerid][pJackSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "CarSkill", PlayerInfo[playerid][pCarSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "NewsSkill", PlayerInfo[playerid][pNewsSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "DrugsSkill", PlayerInfo[playerid][pDrugsSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "CookSkill", PlayerInfo[playerid][pCookSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FishSkill", PlayerInfo[playerid][pFishSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Fighting", PlayerInfo[playerid][pFS]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Boxing", PlayerInfo[playerid][pBoxiSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "KneeHead", PlayerInfo[playerid][pKneeSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "KungFu", PlayerInfo[playerid][pKungSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "GrabKick", PlayerInfo[playerid][pGrabSkill]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Elbow", PlayerInfo[playerid][pElbowSkill]);
MySQLUpdatePlayerFlo(query, PlayerInfo[playerid][pSQLID], "pSHealth", PlayerInfo[playerid][pSHealth]);
GetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
GetPlayerArmour(playerid,PlayerInfo[playerid][pArmour]);
MySQLUpdatePlayerFlo(query, PlayerInfo[playerid][pSQLID], "pHealth", PlayerInfo[playerid][pHealth]);
MySQLUpdatePlayerFlo(query, PlayerInfo[playerid][pSQLID], "pArmour", PlayerInfo[playerid][pArmour]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Int", PlayerInfo[playerid][pInt]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Local", PlayerInfo[playerid][pLocal]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Team", PlayerInfo[playerid][pTeam]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Model", PlayerInfo[playerid][pModel]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "PhoneNr", PlayerInfo[playerid][pPnumber]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "House", PlayerInfo[playerid][pPhousekey]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Bizz", PlayerInfo[playerid][pPbiskey]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Car1", PlayerInfo[playerid][pPcarkey1]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Car2", PlayerInfo[playerid][pPcarkey2]);
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];
}
MySQLUpdatePlayerFlo(query, PlayerInfo[playerid][pSQLID], "Pos_x", PlayerInfo[playerid][pPos_x]);
MySQLUpdatePlayerFlo(query, PlayerInfo[playerid][pSQLID], "Pos_y", PlayerInfo[playerid][pPos_y]);
MySQLUpdatePlayerFlo(query, PlayerInfo[playerid][pSQLID], "Pos_z", PlayerInfo[playerid][pPos_z]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "CarLic", PlayerInfo[playerid][pCarLic]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FlyLic", PlayerInfo[playerid][pFlyLic]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "BoatLic", PlayerInfo[playerid][pBoatLic]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FishLic", PlayerInfo[playerid][pFishLic]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "GunLic", PlayerInfo[playerid][pGunLic]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Gun1", PlayerInfo[playerid][pGun1]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Gun2", PlayerInfo[playerid][pGun2]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Gun3", PlayerInfo[playerid][pGun3]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Gun4", PlayerInfo[playerid][pGun4]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo1", PlayerInfo[playerid][pAmmo1]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo2", PlayerInfo[playerid][pAmmo2]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo3", PlayerInfo[playerid][pAmmo3]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Ammo4", PlayerInfo[playerid][pAmmo4]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "CarTime", PlayerInfo[playerid][pCarTime]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "PayDay", PlayerInfo[playerid][pPayDay]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "PayDayHad", PlayerInfo[playerid][pPayDayHad]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "CDPlayer", PlayerInfo[playerid][pCDPlayer]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Wins", PlayerInfo[playerid][pWins]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Loses", PlayerInfo[playerid][pLoses]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "AlcoholPerk", PlayerInfo[playerid][pAlcoholPerk]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "DrugPerk", PlayerInfo[playerid][pDrugPerk]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "MiserPerk", PlayerInfo[playerid][pMiserPerk]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "PainPerk", PlayerInfo[playerid][pPainPerk]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "TraderPerk", PlayerInfo[playerid][pTraderPerk]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Tutorial", PlayerInfo[playerid][pTut]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Mission", PlayerInfo[playerid][pMissionNr]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Warnings", PlayerInfo[playerid][pWarns]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "FactionWarnings", PlayerInfo[playerid][pFACWarns]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "AdminWarnings", PlayerInfo[playerid][pADMWarns]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "GameMasterWarnings", PlayerInfo[playerid][pGMWarns]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Adjustable", PlayerInfo[playerid][pAdjustable]);
if(PlayerInfo[playerid][pDonateRank] < 1) { PlayerInfo[playerid][pFuel] = 0; }
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Fuel", PlayerInfo[playerid][pFuel]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Married", PlayerInfo[playerid][pMarried]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "MarriedTo", PlayerInfo[playerid][pMarriedTo]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "StoredDrugs", PlayerInfo[playerid][pStoredDrugs]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "StoredMaterials", PlayerInfo[playerid][pStoredMats]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "GameMaster", PlayerInfo[playerid][pGM]);
//MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "StoredMaterials", PlayerInfo[playerid][pStoredMats]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "WantedLevel", WantedLevel[playerid]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Passport", PlayerInfo[playerid][pPassport]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement0", PlayerInfo[playerid][pAchievement0]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement1", PlayerInfo[playerid][pAchievement1]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement2", PlayerInfo[playerid][pAchievement2]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement3", PlayerInfo[playerid][pAchievement3]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement4", PlayerInfo[playerid][pAchievement4]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement5", PlayerInfo[playerid][pAchievement5]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement6", PlayerInfo[playerid][pAchievement6]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement7", PlayerInfo[playerid][pAchievement7]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement8", PlayerInfo[playerid][pAchievement8]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement9", PlayerInfo[playerid][pAchievement9]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement10", PlayerInfo[playerid][pAchievement10]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement11", PlayerInfo[playerid][pAchievement11]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement12", PlayerInfo[playerid][pAchievement12]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement13", PlayerInfo[playerid][pAchievement13]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement14", PlayerInfo[playerid][pAchievement14]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement15", PlayerInfo[playerid][pAchievement15]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement16", PlayerInfo[playerid][pAchievement16]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement17", PlayerInfo[playerid][pAchievement17]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement18", PlayerInfo[playerid][pAchievement18]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement19", PlayerInfo[playerid][pAchievement19]);
MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Achievement20", PlayerInfo[playerid][pAchievement20]);
MySQLUpdateFinish(query, PlayerInfo[playerid][pSQLID]);
}
}
return 1;
}
public OnPlayerRegister(playerid, password[]) // v1.0 by Luk0r
{
if(IsPlayerConnected(playerid))
{
MySQLCheckConnection();
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
new newaccountsqlid = MySQLCreateAccount(playername3, password);
if (newaccountsqlid != 0)
{
PlayerInfo[playerid][pSQLID] = newaccountsqlid;
//PlayerInfo[playerid][pKey] = password;
strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
OnPlayerUpdate(playerid);
new loginstring[128];
new loginname[64];
GetPlayerName(playerid,loginname,sizeof(loginname));
format(loginstring,sizeof(loginstring),"Bine ai venit, {91B17A}%s{A9C4E4}\nAcum poti sa te loghezi pe cont:",loginname);
ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",loginstring,"Login","Exit");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "There was an error creating your account. You will be disconnected now.");
Kick(playerid);
return 0;
}
}
return 0;
}