Saving -
bogushas - 08.12.2018
My saving code looks like this:
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);
}
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 код:
[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'
Re: Saving -
bogushas - 08.12.2018
So I tried to do it like that:
PHP код:
new string[1520],
Float:x, Float:y, Float:z;
GetPlayerPos(pid, x,y,z);
mysql_format(dbHandle, string, sizeof string, "UPDATE `"MySQL_PLAYERS_TABLE"` SET Newbie = '%i', pLytis = '%i', pMoney = '%i', Credits = '%i', pXp = '%i', pAdmin = '%i', x = '%f', y = '%f', z = '%f',",\
player[pid][pNewbie],player[pid][pGender],getPlayerMoney(pid), player[pid][pCredits],getPlayerXp(pid), getPlayerAdmin(pid),x,y,z);
mysql_format(dbHandle, string, sizeof string, "%svWorld = '%i', interior = '%i', pSkin = '%i', HouseId = '%i', rHouseId = '%i', RentMoney = '%i', droped = '%i', Car = '%i',",\
string, GetPlayerVirtualWorld(pid), GetPlayerInterior(pid), player[pid][pClothes][0], player[pid][pHouseId],player[pid][pRHouseId],player[pid][pRentMoney],player[pid][pDropped],player[pid][pCar]);
mysql_format(dbHandle, string, sizeof string, "%spBank = '%i', pPin = '%i', pBankMoney = '%i', pLastAction = '%i', pActionName = '%s', pActionDate = '%s',",\
string, bank[pid][pBank],bank[pid][pPin],bank[pid][pBankMoney],bank[pid][pLastAction],bank[pid][pActionName],bank[pid][pActionDate]);
mysql_format(dbHandle, string, sizeof string, "%sAkat = '%i', Bkat = '%i', Ckat = '%i', gLic = '%i', svkPaz = '%i', antrankiai = '%i', stars = '%i',",\
string, 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));
mysql_format(dbHandle, string, sizeof string, "%s`Leader` = '%d', `SubLeader` = '%d', `WorkId` = '%d', `WorkStatus` = '%d', `WorkSkin` = '%d', `WorkContract` = '%d', `workSalary` = '%d',",\
string, player[pid][pWorkLeader],player[pid][pWorkSubLeader],player[pid][pWork],player[pid][pWorkStatus],player[pid][pWorkClothes],player[pid][pWorkContract],player[pid][pWorkSalary]);
mysql_format(dbHandle, string, sizeof string, "%s`WorkPoints` = %i, `WorkWarns` = %i, `WorkRank` = %i, `Invited` = %i, `mirtis` = %i, `gangId` = %i, `gangLeadId` = %i,",\
string, player[pid][pWorkPoints],player[pid][pWorkWarns],player[pid][pWorkRank],player[pid][pInvited],docs[pid][pDeath],player[pid][pGang],player[pid][pGangLeader]);
mysql_format(dbHandle, string, sizeof string, "%s`GangSkin` = %i, `GangStatus` = %i, `gLicStatus` = %i, `gLicPoints` = %i, `lic1` = %i, `lic2` = %i, `lic3` = %i, `lic4` = %i,",\
string, 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]);
mysql_format(dbHandle, string, sizeof string, "%s`jailed` = %i, `jailtime` = %i, `jailedtimes` = %i, `gangKills` = %i, `gangDeaths` = %i, `gangAttacks` = %i, `gangDeffends` = %i, `alkis` = %i,",\
string, 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]);
mysql_format(dbHandle, string, sizeof string, "%s`pMeras` = %i, `pPatarejas` = %i,`pMeskere` = %i,`pMasalas` = %i,`pValas` = %i,",\
string, player[pid][pMeras],player[pid][pPatarejas],player[pid][pMeskere],player[pid][pMasalas],player[pid][pValas]);
mysql_format(dbHandle, string, sizeof string, "%s`pEseriai` = %i, `pLynai` = %i,`pKarosai` = %i, `pUpetakiai` = %i, `pVegeliai` = %i,",\
string, fish[pid][fishAmount][0],fish[pid][fishAmount][1],fish[pid][fishAmount][2],fish[pid][fishAmount][3],fish[pid][fishAmount][4]);
mysql_format(dbHandle, string, sizeof string, "%s`pEseriu` = %f, `pLynu` = %f,`pKarosu` = %f, `pUpetakiu` = %f, `pVegeliu` = %f,",\
string, fish[pid][fishWeight][0],fish[pid][fishWeight][1],fish[pid][fishWeight][2],fish[pid][fishWeight][3],fish[pid][fishWeight][4]);
mysql_format(dbHandle, string, sizeof string, "%s`Telefonas` = %i, `Telmodelis` = %i,`Telstatusas` = %i, `Telsaskaita` = %f, `Telenergija` = %i, `Telkrovimotime` = %i, `TelSim` = %i",\
string, telefonas[pid][pTelefonas],telefonas[pid][pModelis],telefonas[pid][pStatusas],telefonas[pid][pSask],telefonas[pid][pEnergija],telefonas[pid][pKrovimoTime],telefonas[pid][pSim]);
mysql_format(dbHandle, string, sizeof string, "%sWHERE `pName` = '%s'", string, getPlayerName(pid));
mysql_query(dbHandle, string);
printf("%s\n", string);
But the problem is still up there.
Print:
PHP код:
[23:19:39] UPDATE `users` SET Newbie = '0', pLytis = '0', pMoney = '0', Credits = '0', pXp = '0', pAdmin = '0', x = '1534.692', y = '-1695.707', z = '13.547',vWorld = '0', interior = '0', pSkin = '0', HouseId = '0', rHouseId = '0', RentMoney = '0', droped = '0', Car = '0',pBank = '0', pPin = '0', pBankMoney = '0', pLastAction = '0', pActionName = '', pActionDate = '',Akat = '0', Bkat = '0', Ckat = '0', gLic = '0', svkPaz = '0', antrankiai = '0', stars = '0',`Leader` = '0', `SubLeader` = '0', `WorkId` = '0', `WorkStatus` = '0', `WorkSkin` = '0', `WorkContract` = '0', `workSalary` = '0',`WorkPoints` = 0, `WorkWarns` = 0, `WorkRank` = 0, `Invited` = -1, `mirtis` = 0, `gangId` = 0, `gangLeadId` = 0,`GangSkin` = 0, `GangStatus` = 0, `gLicStatus` = 0, `gLicPoints` = 0, `lic1` = 0, `lic2` = 0, `lic3` = 0, `lic4` = 0,`jailed` = 0, `jailtime` = 0, `jailedtimes` = 0, `gangKills` = 0, `gangDeaths` = 0, `gangAttacks` = 0, `gangDeffends` = 0, `alkis` = 0,`pMeras` = 0, `pPatarejas` = 0,`pMeskere` = 0,`pMasalas` = 0,`pValas` = 0,`pEseriai` = 0, `pLynai` = 0,`pKarosai` = 0, `pUpetakiai` = 0, `pVegeliai` = 0,`pEseriu` = 0.0, `pLynu` = 0.0,`pKarosu` = 0.0, `pUpetakiu` = 0.0, `pVegeliu` = 0.0,`Telefonas` = 0, `Telmodelis` = 0,`Telstatusas` = 0, `Telsaskaita` = 0.0, `Telenergija` = 0, `Telkrovimotime` = 0, `TelSim` = 0WHERE `pName` = 'ForzetukalS'
mysql log:
PHP код:
[23:19:38] [DEBUG] mysql_format - connection: 1, len: 1520, format: "UPDATE `users` SET Newbie = '%i', pLytis = '%i', pMoney = '%i', Credits = '%i', pXp = '%i', pAdmin = '%i', x = '%f', y = '%f', z..."
[23:19:39] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%svWorld = '%i', interior = '%i', pSkin = '%i', HouseId = '%i', rHouseId = '%i', RentMoney = '%i', droped = '%i', Car = '%i',"
[23:19:39] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%spBank = '%i', pPin = '%i', pBankMoney = '%i', pLastAction = '%i', pActionName = '%s', pActionDate = '%s',"
[23:19:39] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%sAkat = '%i', Bkat = '%i', Ckat = '%i', gLic = '%i', svkPaz = '%i', antrankiai = '%i', stars = '%i',"
[23:19:39] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`Leader` = '%d', `SubLeader` = '%d', `WorkId` = '%d', `WorkStatus` = '%d', `WorkSkin` = '%d', `WorkContract` = '%d', `workSala..."
[23:19:39] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`WorkPoints` = %i, `WorkWarns` = %i, `WorkRank` = %i, `Invited` = %i, `mirtis` = %i, `gangId` = %i, `gangLeadId` = %i,"
[23:19:39] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`GangSkin` = %i, `GangStatus` = %i, `gLicStatus` = %i, `gLicPoints` = %i, `lic1` = %i, `lic2` = %i, `lic3` = %i, `lic4` = %i,"
[23:19:39] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`jailed` = %i, `jailtime` = %i, `jailedtimes` = %i, `gangKills` = %i, `gangDeaths` = %i, `gangAttacks` = %i, `gangDeffends` = ..."
[23:19:39] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`pMeras` = %i, `pPatarejas` = %i,`pMeskere` = %i,`pMasalas` = %i,`pValas` = %i,"
[23:19:39] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`pEseriai` = %i, `pLynai` = %i,`pKarosai` = %i, `pUpetakiai` = %i, `pVegeliai` = %i,"
[23:19:39] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`pEseriu` = %f, `pLynu` = %f,`pKarosu` = %f, `pUpetakiu` = %f, `pVegeliu` = %f,"
[23:19:39] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`Telefonas` = %i, `Telmodelis` = %i,`Telstatusas` = %i, `Telsaskaita` = %f, `Telenergija` = %i, `Telkrovimotime` = %i, `TelSim..."
[23:19:39] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%sWHERE `pName` = '%s'"
[23:19:39] [DEBUG] mysql_query - connection: 1, query: "UPDATE `users` SET Newbie = '0', pLytis = '0', pMoney = '0', Cre", use_cache: true
[23:19:39] [DEBUG] CMySQLQuery::Execute - starting query execution
[23:19:39] [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 '`pName` = 'ForzetukalS'' at line 1
Re: Saving -
Macronix - 08.12.2018
Try this:
pawn Код:
mysql_format(dbHandle, string, sizeof string, "%s WHERE `pName` = '%s'", string, getPlayerName(pid));
You forgot to add a blank space between the "%s" and the WHERE clause.
Re: Saving -
bogushas - 09.12.2018
Yep, found it before you. But mysql log, still looks strange:
PHP код:
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "UPDATE `users` SET Newbie = '%i', pLytis = '%i', pMoney = '%i', Credits = '%i', pXp = '%i', pAdmin = '%i', x = '%f', y = '%f', z..."
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%svWorld = '%i', interior = '%i', pSkin = '%i', HouseId = '%i', rHouseId = '%i', RentMoney = '%i', droped = '%i', Car = '%i',"
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%spBank = '%i', pPin = '%i', pBankMoney = '%i', pLastAction = '%i', pActionName = '%s', pActionDate = '%s',"
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%sAkat = '%i', Bkat = '%i', Ckat = '%i', gLic = '%i', svkPaz = '%i', antrankiai = '%i', stars = '%i',"
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`Leader` = '%d', `SubLeader` = '%d', `WorkId` = '%d', `WorkStatus` = '%d', `WorkSkin` = '%d', `WorkContract` = '%d', `workSala..."
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`WorkPoints` = %i, `WorkWarns` = %i, `WorkRank` = %i, `Invited` = %i, `mirtis` = %i, `gangId` = %i, `gangLeadId` = %i,"
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`GangSkin` = %i, `GangStatus` = %i, `gLicStatus` = %i, `gLicPoints` = %i, `lic1` = %i, `lic2` = %i, `lic3` = %i, `lic4` = %i,"
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`jailed` = %i, `jailtime` = %i, `jailedtimes` = %i, `gangKills` = %i, `gangDeaths` = %i, `gangAttacks` = %i, `gangDeffends` = ..."
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`pMeras` = %i, `pPatarejas` = %i,`pMeskere` = %i,`pMasalas` = %i,`pValas` = %i,"
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`pEseriai` = %i, `pLynai` = %i,`pKarosai` = %i, `pUpetakiai` = %i, `pVegeliai` = %i,"
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`pEseriu` = %f, `pLynu` = %f,`pKarosu` = %f, `pUpetakiu` = %f, `pVegeliu` = %f,"
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s`Telefonas` = %i, `Telmodelis` = %i,`Telstatusas` = %i, `Telsaskaita` = %f, `Telenergija` = %i, `Telkrovimotime` = %i, `TelSim..."
[23:32:22] [DEBUG] mysql_format - connection: 1, len: 1520, format: "%s WHERE `pName` = '%s'"
[23:32:22] [DEBUG] mysql_query - connection: 1, query: "UPDATE `users` SET Newbie = '0', pLytis = '1', pMoney = '0', Cre", use_cache: true
[23:32:22] [DEBUG] CMySQLQuery::Execute - starting query execution
[23:32:22] [DEBUG] CMySQLQuery::Execute - query was successfully executed within 3.691 milliseconds
Shouldn't it show more info, stuff?
Re: Saving -
Macronix - 09.12.2018
I'm not actually sure. Which MySQL plugin are you using?
Re: Saving -
bogushas - 09.12.2018
R39-5, I mean that whole thread is not showing up.