25.10.2015, 08:07
Hello, there are problems with your player! For example: If today we have 1,000 drug or $10,000 tomorrow I will have $ 4,000 + 0 drugs, do not know why ...
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM `players` WHERE `user` = '%e' LIMIT 1", GetName(playerid)); mysql_pquery(MySQLCon, query, "OnAccountCheck", "d", playerid);
forward OnAccountCheck(playerid); public OnAccountCheck(playerid) { new string[228], rows = cache_num_rows(); if(rows) { cache_get_field_content(0, "pass", pInfo[playerid][pPass], MySQLCon, 129); cache_get_field_content(0, "LastLogin", string), strmid(pInfo[playerid][pLastLogin], string, 0, 255, 255); pInfo[playerid][pID] = cache_get_field_content_int(0, "ID"); format(string, sizeof(string), "%s\nEnter password\nLast login: {4D97FF}%s",GetName(playerid), pInfo[playerid][pLastLogin]); ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login",string,"Login","Cancel"); } else { format(string, sizeof(string), "%s\nPlease register an account.",GetName(playerid)); ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Registration",string,"Register","Cancel"); } return 1; }
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM `players` WHERE `user` = '%e' LIMIT 1", GetName(playerid)); mysql_pquery(MySQLCon, query, "OnPlayerLogin", "d", playerid);
forward OnPlayerLogin(playerid); public OnPlayerLogin(playerid) { new rows = cache_num_rows(); if(rows) { pInfo[playerid][pAdmin] = cache_get_field_content_int(0, "Admin"); pInfo[playerid][pHelper] = cache_get_field_content_int(0, "Helper"); pInfo[playerid][pMoney] = cache_get_field_content_int(0, "Money"); pInfo[playerid][pScore] = cache_get_field_content_int(0, "Score"); pInfo[playerid][pStatus] = cache_get_field_content_int(0, "Status"); pInfo[playerid][pReg] = cache_get_field_content_int(0, "Reg"); pInfo[playerid][pSex] = cache_get_field_content_int(0, "Sex"); pInfo[playerid][pAge] = cache_get_field_content_int(0, "Age"); pInfo[playerid][pMute] = cache_get_field_content_int(0, "Mute"); pInfo[playerid][pHoursPlayed] = cache_get_field_content_int(0, "HoursPlayed"); pInfo[playerid][pRPoints] = cache_get_field_content_int(0, "RPoints"); pInfo[playerid][pBankMoney] = cache_get_field_content_int(0, "BankMoney"); pInfo[playerid][pWantedLevel] = cache_get_field_content_int(0, "WantedLevel"); pInfo[playerid][pPhoneBook] = cache_get_field_content_int(0, "PhoneBook"); pInfo[playerid][pJob] = cache_get_field_content_int(0, "Job"); pInfo[playerid][pJailed] = cache_get_field_content_int(0, "Jailed"); pInfo[playerid][pPremium] = cache_get_field_content_int(0, "Premium"); pInfo[playerid][pMaterials] = cache_get_field_content_int(0, "Materials"); pInfo[playerid][pDrugs] = cache_get_field_content_int(0, "Drugs"); pInfo[playerid][pLeader] = cache_get_field_content_int(0, "Leader"); pInfo[playerid][pMember] = cache_get_field_content_int(0, "Member"); pInfo[playerid][pRank] = cache_get_field_content_int(0, "Rank"); pInfo[playerid][pPhoneNumber] = cache_get_field_content_int(0, "PhoneNumber"); pInfo[playerid][pHouse] = cache_get_field_content_int(0, "House"); pInfo[playerid][pBusiness] = cache_get_field_content_int(0, "Business"); pInfo[playerid][pCarLic] = cache_get_field_content_int(0, "CarLic"); pInfo[playerid][pFlyLic] = cache_get_field_content_int(0, "FlyLic"); pInfo[playerid][pBoatLic] = cache_get_field_content_int(0, "BoatLic"); pInfo[playerid][pGunLic] = cache_get_field_content_int(0, "GunLic"); pInfo[playerid][pCarLicTime] = cache_get_field_content_int(0, "CarLicTime"); pInfo[playerid][pFlyLicTime] = cache_get_field_content_int(0, "FlyLicTime"); pInfo[playerid][pBoatLicTime] = cache_get_field_content_int(0, "BoatLicTime"); pInfo[playerid][pGunLicTime] = cache_get_field_content_int(0, "GunLicTime"); pInfo[playerid][pWarns] = cache_get_field_content_int(0, "Warns"); pInfo[playerid][pFWarns] = cache_get_field_content_int(0, "FWarns"); pInfo[playerid][pDeaths] = cache_get_field_content_int(0, "Deaths"); pInfo[playerid][pKills] = cache_get_field_content_int(0, "Kills"); } return 1; }
ResetPlayerData(playerid);
stock ResetPlayerData(playerid) { pInfo[playerid][pID] = -1; pInfo[playerid][pPass] = '\0'; pInfo[playerid][pAdmin] = 0; pInfo[playerid][pHelper] = 0; pInfo[playerid][pMoney] = 0; pInfo[playerid][pScore] = 0; pInfo[playerid][pStatus] = 0; pInfo[playerid][pReg] = 0; pInfo[playerid][pSex] = 0; pInfo[playerid][pAge] = 0; pInfo[playerid][pMute] = -1; pInfo[playerid][pHoursPlayed] = 0; pInfo[playerid][pRPoints] = 0; pInfo[playerid][pBankMoney] = 2500; pInfo[playerid][pWantedLevel] = 0; pInfo[playerid][pPhoneBook] = 0; pInfo[playerid][pJob] = 0; pInfo[playerid][pJailed] = -1; pInfo[playerid][pPremium] = 0; pInfo[playerid][pMaterials] = 0; pInfo[playerid][pDrugs] = 0; pInfo[playerid][pLeader] = 0; pInfo[playerid][pMember] = 0; pInfo[playerid][pRank] = 0; pInfo[playerid][pPhoneNumber] = 0; pInfo[playerid][pHouse] = 355; pInfo[playerid][pBusiness] = 355; pInfo[playerid][pCarLic] = 0; pInfo[playerid][pFlyLic] = 0; pInfo[playerid][pBoatLic] = 0; pInfo[playerid][pGunLic] = 0; pInfo[playerid][pCarLicTime] = 0; pInfo[playerid][pFlyLicTime] = 0; pInfo[playerid][pBoatLicTime] = 0; pInfo[playerid][pGunLicTime] = 0; pInfo[playerid][pWarns] = 0; pInfo[playerid][pFWarns] = 0; pInfo[playerid][pDeaths] = 0; pInfo[playerid][pKills] = 0; pInfo[playerid][pLastLogin] = '\0'; return true; }