08.12.2018, 13:02
My saving code looks like this:
But at the moments I think this code is too old, shitty and there should be an easier way to improve it.
And I'm getting these logs:
PHP код:
stock savePlayer(pid)
{
new jox[1000], jox2[1000];
static Float:x, Float:y, Float:z;
GetPlayerPos(pid, x,y,z);
format(g_szBuffer,600,"UPDATE "MySQL_PLAYERS_TABLE" SET Newbie = '%i', pLytis = '%i', pMoney = '%i', Credits = '%i', pXp = '%i', pAdmin = '%i', x = '%f', y = '%f', z = '%f',\
vWorld = '%i', interior = '%i', pSkin = '%i' WHERE pName = '%s'",\
player[pid][pNewbie],player[pid][pGender],getPlayerMoney(pid), player[pid][pCredits],getPlayerXp(pid), getPlayerAdmin(pid),x,y,z,GetPlayerVirtualWorld(pid),\
GetPlayerInterior(pid),player[pid][pClothes][0],getPlayerName(pid));
strcat(jox, g_szBuffer);
format(g_szBuffer,600,"HouseId = '%i', rHouseId = '%i', RentMoney = '%i', droped = '%i', Car = '%i' WHERE pName = '%s'",\
player[pid][pHouseId],player[pid][pRHouseId],player[pid][pRentMoney],player[pid][pDropped],player[pid][pCar],getPlayerName(pid));
strcat(jox, g_szBuffer);
format(g_szBuffer,600,"pBank = '%i', pPin = '%i', pBankMoney = '%i', pLastAction = '%i', pActionName = '%s', pActionDate = '%s' WHERE pName = '%s'",\
bank[pid][pBank],bank[pid][pPin],bank[pid][pBankMoney],bank[pid][pLastAction],bank[pid][pActionName],bank[pid][pActionDate],getPlayerName(pid));
strcat(jox, g_szBuffer);
format(g_szBuffer,600,"Akat = '%i', Bkat = '%i', Ckat = '%i', gLic = '%i', svkPaz = '%i', antrankiai = '%i', stars = '%i' WHERE pName = '%s'",\
docs[pid][pLicenses][1],docs[pid][pLicenses][2],docs[pid][pLicenses][3],docs[pid][pDocs][1],docs[pid][pDocs][0],player[pid][cuffed], GetPlayerWantedLevel(pid),getPlayerName(pid));
strcat(jox, g_szBuffer);
format(g_szBuffer,600,"`Leader` = %i, `SubLeader` = %i, `WorkId` = %i, `WorkStatus` = %i, `WorkSkin` = %i, `WorkContract` = %i, `workSalary` = %i WHERE pName = '%s'",\
player[pid][pWorkLeader],player[pid][pWorkSubLeader],player[pid][pWork],player[pid][pWorkStatus],player[pid][pWorkClothes],player[pid][pWorkContract],player[pid][pWorkSalary],getPlayerName(pid));
strcat(jox, g_szBuffer);
format(g_szBuffer,600,"`WorkPoints` = %i, `WorkWarns` = %i, `WorkRank` = %i, `Invited` = %i, `mirtis` = %i, `gangId` = %i, `gangLeadId` = %i WHERE pName = '%s'",\
player[pid][pWorkPoints],player[pid][pWorkWarns],player[pid][pWorkRank],player[pid][pInvited],docs[pid][pDeath],player[pid][pGang],player[pid][pGangLeader],getPlayerName(pid));
strcat(jox, g_szBuffer);
mysql_query(dbHandle,jox);
printf(jox);
format(g_szBuffer,600,"UPDATE "MySQL_PLAYERS_TABLE" SET `GangSkin` = %i, `GangStatus` = %i, `gLicStatus` = %i, `gLicPoints` = %i, `lic1` = %i, `lic2` = %i, `lic3` = %i,\
`lic4` = %i WHERE pName = '%s'",\
player[pid][pGangSkin], player[pid][pGangStatus], docs[pid][pGunLic][0], docs[pid][pGunLic][1], docs[pid][pLic][0], docs[pid][pLic][1], docs[pid][pLic][2],\
docs[pid][pLic][3], getPlayerName(pid));
strcat(jox2, g_szBuffer);
format(g_szBuffer,600,"`jailed` = %i, `jailtime` = %i, `jailedtimes` = %i, `gangKills` = %i, `gangDeaths` = %i, `gangAttacks` = %i,\
`gangDeffends` = %i, `alkis` = %i WHERE pName = '%s'",\
player[pid][pJail][0], player[pid][pJail][1], player[pid][pJail][2], player[pid][pGangStats][0], player[pid][pGangStats][1], player[pid][pGangStats][2],\
player[pid][pGangStats][3], player[pid][hunger], getPlayerName(pid));
strcat(jox2, g_szBuffer);
format(g_szBuffer,600,"`pMeras` = %i, `pPatarejas` = %i,`pMeskere` = %i,`pMasalas` = %i,`pValas` = %i WHERE pName = '%s'",\
player[pid][pMeras],player[pid][pPatarejas],player[pid][pMeskere],player[pid][pMasalas],player[pid][pValas],getPlayerName(pid));
strcat(jox2, g_szBuffer);
format(g_szBuffer,400,"`pEseriai` = %i, `pLynai` = %i,`pKarosai` = %i, `pUpetakiai` = %i, `pVegeliai` = %i WHERE pName = '%s'",\
fish[pid][fishAmount][0],fish[pid][fishAmount][1],fish[pid][fishAmount][2],fish[pid][fishAmount][3],fish[pid][fishAmount][4],getPlayerName(pid));
strcat(jox2, g_szBuffer);
format(g_szBuffer,400,"`pEseriu` = %f, `pLynu` = %f,`pKarosu` = %f, `pUpetakiu` = %f, `pVegeliu` = %f WHERE pName = '%s'",\
fish[pid][fishWeight][0],fish[pid][fishWeight][1],fish[pid][fishWeight][2],fish[pid][fishWeight][3],fish[pid][fishWeight][4],getPlayerName(pid));
strcat(jox2, g_szBuffer);
format(g_szBuffer,400,"`Telefonas` = %i, `Telmodelis` = %i,`Telstatusas` = %i, `Telsaskaita` = %f, `Telenergija` = %i, `Telkrovimotime` = %i, `TelSim` = %i WHERE pName = '%s'",\
telefonas[pid][pTelefonas],telefonas[pid][pModelis],telefonas[pid][pStatusas],telefonas[pid][pSask],telefonas[pid][pEnergija],telefonas[pid][pKrovimoTime],telefonas[pid][pSim], getPlayerName(pid));
strcat(jox2, g_szBuffer);
mysql_query(dbHandle,jox2);
printf(jox2);
}
And I'm getting these logs:
PHP код:
[15:58:50] [DEBUG] mysql_query - connection: 1, query: "UPDATE users SET Newbie = '0', pLytis = '0', pMoney = '0', Credi", use_cache: true
[15:58:50] [DEBUG] CMySQLQuery::Execute - starting query execution
[15:58:50] [ERROR] CMySQLQuery::Execute - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'HouseId = '-1', rHouseId = '-1', RentMoney = '-1', droped = '-1', Car = '0' WHER' at line 1
[15:58:51] [DEBUG] mysql_query - connection: 1, query: "UPDATE users SET `GangSkin` = -1, `GangStatus` = 0, `gLicStatus`", use_cache: true
[15:58:51] [DEBUG] CMySQLQuery::Execute - starting query execution
[15:58:51] [ERROR] CMySQLQuery::Execute - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`jailed` = 0, `jailtime` = 0, `jailedtimes` = 0, `gangKills` = 0, `gangDeaths` =' at line 1
[15:58:51] [DEBUG] mysql_query - connection: 1, query: "UPDATE player_items SET `item1` = 0, `item2` = 0 WHERE pName = '", use_cache: true
[15:58:51] [DEBUG] CMySQLQuery::Execute - starting query execution
[15:58:51] [ERROR] CMySQLQuery::Execute - (error #1054) Unknown column 'item1' in 'field list'