05.07.2015, 10:45
PHP код:
stock SavePlayerData(playerid)
{
new query[256];
new tmp[128];
if(IsLoggedIn[playerid] == 1 && playerid != INVALID_PLAYER_ID && !IsPlayerNPC(playerid))
{
format(query, sizeof(query), "UPDATE `players` SET " );
format(tmp, sizeof(tmp), "`Admin`='%d', ", pData[playerid][pAdmin]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Vip`='%d', ", pData[playerid][pVip]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Money`='%d' ", GetPlayerCash(playerid));
strcat(query, tmp);
format(tmp, sizeof(tmp), "`BankCash`='%d' ", pData[playerid][pBankMoney]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Score`='%d' ", GetPlayerScore(playerid));
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Deaths`='%d' ", pData[playerid][pDeaths]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Kills`='%d' ", pData[playerid][pKills]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`HitsC`='%d' ", pData[playerid][pHitsCompleted]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Skin`='%d' ", GetPlayerSkin(playerid));
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Rob`='%d' ", pData[playerid][pRobbed]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`RobCash`='%d' ", pData[playerid][pRobbedMoney]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`GotRob`='%d' ", pData[playerid][pGotRobbed]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`GotRobCash`='%d' ", pData[playerid][pGotRobbedMoney]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`StoreRob`='%d' ", pData[playerid][pStoreRobbed]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`StoreRobCash`='%d' ", pData[playerid][pStoreRobbedMoney]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`FoodPur`='%d' ", pData[playerid][pFoodPurchased]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`FoodPurCash`='%d' ", pData[playerid][pFoodPurchasedMoney]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`WeaponsPur`='%d' ", pData[playerid][pWeaponsPurchased]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`WeaponsPurCash`='%d' ", pData[playerid][pWeaponsPurchasedMoney]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Healed`='%d' ", pData[playerid][pHealed]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Arrest`='%d' ", pData[playerid][pArrest]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Busted`='%d' ", pData[playerid][pBusted]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Crimes`='%d' ", pData[playerid][pCrimes]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`WantedL`='%d' ", pData[playerid][pWantedLevel]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Drugs`='%d' ", pData[playerid][pDrugs]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`DrugsB`='%d' ", pData[playerid][pDrugsBought]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`DC`='%d' ", pData[playerid][pDrugsCash]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`DS`='%d' ", pData[playerid][pDrugsSell]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`DSC`='%d' ", pData[playerid][pDrugsSellCash]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Medical`='%d' ", pData[playerid][pMedical]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Min`='%d' ", pData[playerid][pMins]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`Hour`='%d' ", pData[playerid][pHours]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "`vLK`='%d' ", pData[playerid][pLock]);
strcat(query, tmp);
format(tmp, sizeof(tmp), "WHERE `ID`= %d AND `Username`= '%e'", pData[playerid][pID], Name[playerid] );
strcat(query, tmp);
mysql_tquery(mysql, query, "", "");
}
return 1;
}
//let's load player's information
public OnAccountLoad(playerid)
{
SetPlayerColor(playerid, -1);
pData[playerid][pAdmin] = cache_get_field_content_int(0, "Admin");
pData[playerid][pVip] = cache_get_field_content_int(0, "Vip");
pData[playerid][pMoney] = cache_get_field_content_int(0, "Money");
pData[playerid][pBankMoney] = cache_get_field_content_int(0, "BankCash");
pData[playerid][pScore] = cache_get_field_content_int(0, "Score");
pData[playerid][pDeaths] = cache_get_field_content_int(0, "Deaths");
pData[playerid][pKills] = cache_get_field_content_int(0, "Kills");
pData[playerid][pHitsCompleted] = cache_get_field_content_int(0, "HitsC");
pData[playerid][pSkinID] = cache_get_field_content_int(0, "Skin");
pData[playerid][pRobbed] = cache_get_field_content_int(0, "Rob");
pData[playerid][pRobbedMoney] = cache_get_field_content_int(0, "RobCash");
pData[playerid][pGotRobbed] = cache_get_field_content_int(0, "GotRob");
pData[playerid][pGotRobbedMoney] = cache_get_field_content_int(0, "GotRobCash");
pData[playerid][pStoreRobbed] = cache_get_field_content_int(0, "StoreRob");
pData[playerid][pStoreRobbedMoney] = cache_get_field_content_int(0, "StoreRobCash");
pData[playerid][pFoodPurchased] = cache_get_field_content_int(0, "FoodPur");
pData[playerid][pFoodPurchasedMoney] = cache_get_field_content_int(0, "FoodPurCash");
pData[playerid][pWeaponsPurchased] = cache_get_field_content_int(0, "WeaponsPur");
pData[playerid][pWeaponsPurchasedMoney] = cache_get_field_content_int(0, "WeaponsPurCash");
pData[playerid][pHealed] = cache_get_field_content_int(0, "Healed");
pData[playerid][pArrest] = cache_get_field_content_int(0, "Arrest");
pData[playerid][pBusted] = cache_get_field_content_int(0, "Busted");
pData[playerid][pCrimes] = cache_get_field_content_int(0, "Crimes");
pData[playerid][pWantedLevel] = cache_get_field_content_int(0, "WantedL");
pData[playerid][pDrugs] = cache_get_field_content_int(0, "Drugs");
pData[playerid][pDrugsBought] = cache_get_field_content_int(0, "DrugsB");
pData[playerid][pDrugsCash] = cache_get_field_content_int(0, "DC");
pData[playerid][pDrugsCash] = cache_get_field_content_int(0, "DS");
pData[playerid][pDrugsCash] = cache_get_field_content_int(0, "DSC");
pData[playerid][pMedical] = cache_get_field_content_int(0, "Medical");
pData[playerid][pMins] = cache_get_field_content_int(0, "Min");
pData[playerid][pHours] = cache_get_field_content_int(0, "Hour");
pData[playerid][pLock] = cache_get_field_content_int(0, "vLK");
SetPlayerCash(playerid, pData[playerid][pMoney]);
SetPlayerScore(playerid, pData[playerid][pScore]);
SetPlayerSkin(playerid, pData[playerid][pSkinID]);
IsLoggedIn[playerid] = 1;
TogglePlayerSpectating(playerid, 0);
if(pData[playerid][pAdmin] != 0) SendClientMessage(playerid, COLOR_RED, "You have logged in as an administrator. Use [/acmds] to see your commands.");
SendClientMessage(playerid, COLOR_CYAN, "You have been logged in, Continue your current life.");
return 1;
}
http://pastebin.com/xiKtLHYa .
PHP код:
[15:40:26] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[15:40:48] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `players` SET `Admin`='0', `Vip`='0', `Money`='44000' `Ba", callback: "(null)", format: "(null)"
[15:40:48] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[15:40:48] [ERROR] CMySQLQuery::Execute[] - (error #1064) Erreur de syntaxe prиs de '`BankCash`='0' `Score`='0' `Deaths`='1' `Kills`='0' `HitsC`='0' `Skin`='297' `Ro' а la ligne 1
[15:40:48] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
[15:40:49] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT * FROM `players` WHERE `Username` = '%e' LIMIT 1"
[15:40:49] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `players` WHERE `Username` = 'JerryCo' LIMIT 1", callback: "OnAccountCheck", format: "i"