Saving
#1

My saving code looks like this:

PHP код:
stock savePlayer(pid)
{
    new 
jox[1000], jox2[1000];
    static 
Float:xFloat:yFloat:z;
    
GetPlayerPos(pidx,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(joxg_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(joxg_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(joxg_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(joxg_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(joxg_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(joxg_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(jox2g_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(jox2g_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(jox2g_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(jox2g_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(jox2g_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(jox2g_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] [DEBUGmysql_query connection1query"UPDATE users SET Newbie = '0', pLytis = '0', pMoney = '0', Credi"use_cachetrue
[15:58:50] [DEBUGCMySQLQuery::Execute starting query execution
[15:58:50] [ERRORCMySQLQuery::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] [DEBUGmysql_query connection1query"UPDATE users SET `GangSkin` = -1, `GangStatus` = 0, `gLicStatus`"use_cachetrue
[15:58:51] [DEBUGCMySQLQuery::Execute starting query execution
[15:58:51] [ERRORCMySQLQuery::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] [DEBUGmysql_query connection1query"UPDATE player_items SET `item1` = 0, `item2` = 0 WHERE pName = '"use_cachetrue
[15:58:51] [DEBUGCMySQLQuery::Execute starting query execution
[15:58:51] [ERRORCMySQLQuery::Execute - (error #1054) Unknown column 'item1' in 'field list' 
Reply
#2

So I tried to do it like that:
PHP код:
    new string[1520],
        
Float:xFloat:yFloat:z;
    
GetPlayerPos(pidx,y,z);
    
mysql_format(dbHandlestringsizeof 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(dbHandlestringsizeof string"%svWorld = '%i', interior = '%i', pSkin = '%i', HouseId = '%i', rHouseId = '%i', RentMoney = '%i', droped = '%i', Car = '%i',",\
        
stringGetPlayerVirtualWorld(pid), GetPlayerInterior(pid), player[pid][pClothes][0], player[pid][pHouseId],player[pid][pRHouseId],player[pid][pRentMoney],player[pid][pDropped],player[pid][pCar]);
    
    
mysql_format(dbHandlestringsizeof string"%spBank = '%i', pPin = '%i', pBankMoney = '%i', pLastAction = '%i', pActionName = '%s', pActionDate = '%s',",\
        
stringbank[pid][pBank],bank[pid][pPin],bank[pid][pBankMoney],bank[pid][pLastAction],bank[pid][pActionName],bank[pid][pActionDate]);
    
    
mysql_format(dbHandlestringsizeof string"%sAkat = '%i', Bkat = '%i', Ckat = '%i', gLic = '%i', svkPaz = '%i', antrankiai = '%i', stars = '%i',",\ 
        
stringdocs[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(dbHandlestringsizeof string"%s`Leader` = '%d', `SubLeader` = '%d', `WorkId` = '%d', `WorkStatus` = '%d', `WorkSkin` = '%d', `WorkContract` = '%d', `workSalary` = '%d',",\
        
stringplayer[pid][pWorkLeader],player[pid][pWorkSubLeader],player[pid][pWork],player[pid][pWorkStatus],player[pid][pWorkClothes],player[pid][pWorkContract],player[pid][pWorkSalary]);
    
mysql_format(dbHandlestringsizeof string"%s`WorkPoints` = %i, `WorkWarns` = %i, `WorkRank` = %i, `Invited` = %i, `mirtis` = %i, `gangId` = %i, `gangLeadId` = %i,",\
        
stringplayer[pid][pWorkPoints],player[pid][pWorkWarns],player[pid][pWorkRank],player[pid][pInvited],docs[pid][pDeath],player[pid][pGang],player[pid][pGangLeader]);
    
    
mysql_format(dbHandlestringsizeof string"%s`GangSkin` = %i, `GangStatus` = %i, `gLicStatus` = %i, `gLicPoints` = %i, `lic1` = %i, `lic2` = %i, `lic3` = %i, `lic4` = %i,",\
        
stringplayer[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(dbHandlestringsizeof string"%s`jailed` = %i, `jailtime` = %i, `jailedtimes` = %i, `gangKills` = %i, `gangDeaths` = %i, `gangAttacks` = %i, `gangDeffends` = %i, `alkis` = %i,",\
        
stringplayer[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(dbHandlestringsizeof string"%s`pMeras` = %i, `pPatarejas` = %i,`pMeskere` = %i,`pMasalas` = %i,`pValas` = %i,",\
        
stringplayer[pid][pMeras],player[pid][pPatarejas],player[pid][pMeskere],player[pid][pMasalas],player[pid][pValas]);
    
    
mysql_format(dbHandlestringsizeof string"%s`pEseriai` = %i, `pLynai` = %i,`pKarosai` = %i, `pUpetakiai` = %i, `pVegeliai` = %i,",\
        
stringfish[pid][fishAmount][0],fish[pid][fishAmount][1],fish[pid][fishAmount][2],fish[pid][fishAmount][3],fish[pid][fishAmount][4]);
    
    
mysql_format(dbHandlestringsizeof string"%s`pEseriu` = %f, `pLynu` = %f,`pKarosu` = %f, `pUpetakiu` = %f, `pVegeliu` = %f,",\
        
stringfish[pid][fishWeight][0],fish[pid][fishWeight][1],fish[pid][fishWeight][2],fish[pid][fishWeight][3],fish[pid][fishWeight][4]);
    
mysql_format(dbHandlestringsizeof string"%s`Telefonas` = %i, `Telmodelis` = %i,`Telstatusas` = %i, `Telsaskaita` = %f, `Telenergija` = %i, `Telkrovimotime` = %i, `TelSim` = %i",\
        
stringtelefonas[pid][pTelefonas],telefonas[pid][pModelis],telefonas[pid][pStatusas],telefonas[pid][pSask],telefonas[pid][pEnergija],telefonas[pid][pKrovimoTime],telefonas[pid][pSim]);
    
    
mysql_format(dbHandlestringsizeof string"%sWHERE `pName` = '%s'"stringgetPlayerName(pid));
    
mysql_query(dbHandlestring);
    
printf("%s\n"string); 
But the problem is still up there.
Print:
PHP код:
[23:19:39UPDATE `usersSET Newbie '0'pLytis '0'pMoney '0'Credits '0'pXp '0'pAdmin '0''1534.692''-1695.707''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] [DEBUGmysql_format connection1len1520format"UPDATE `users` SET Newbie = '%i', pLytis = '%i', pMoney = '%i', Credits = '%i', pXp = '%i', pAdmin = '%i', x = '%f', y = '%f', z..."
[23:19:39] [DEBUGmysql_format connection1len1520format"%svWorld = '%i', interior = '%i', pSkin = '%i', HouseId = '%i', rHouseId = '%i', RentMoney = '%i', droped = '%i', Car = '%i',"
[23:19:39] [DEBUGmysql_format connection1len1520format"%spBank = '%i', pPin = '%i', pBankMoney = '%i', pLastAction = '%i', pActionName = '%s', pActionDate = '%s',"
[23:19:39] [DEBUGmysql_format connection1len1520format"%sAkat = '%i', Bkat = '%i', Ckat = '%i', gLic = '%i', svkPaz = '%i', antrankiai = '%i', stars = '%i',"
[23:19:39] [DEBUGmysql_format connection1len1520format"%s`Leader` = '%d', `SubLeader` = '%d', `WorkId` = '%d', `WorkStatus` = '%d', `WorkSkin` = '%d', `WorkContract` = '%d', `workSala..."
[23:19:39] [DEBUGmysql_format connection1len1520format"%s`WorkPoints` = %i, `WorkWarns` = %i, `WorkRank` = %i, `Invited` = %i, `mirtis` = %i, `gangId` = %i, `gangLeadId` = %i,"
[23:19:39] [DEBUGmysql_format connection1len1520format"%s`GangSkin` = %i, `GangStatus` = %i, `gLicStatus` = %i, `gLicPoints` = %i, `lic1` = %i, `lic2` = %i, `lic3` = %i, `lic4` = %i,"
[23:19:39] [DEBUGmysql_format connection1len1520format"%s`jailed` = %i, `jailtime` = %i, `jailedtimes` = %i, `gangKills` = %i, `gangDeaths` = %i, `gangAttacks` = %i, `gangDeffends` = ..."
[23:19:39] [DEBUGmysql_format connection1len1520format"%s`pMeras` = %i, `pPatarejas` = %i,`pMeskere` = %i,`pMasalas` = %i,`pValas` = %i,"
[23:19:39] [DEBUGmysql_format connection1len1520format"%s`pEseriai` = %i, `pLynai` = %i,`pKarosai` = %i, `pUpetakiai` = %i, `pVegeliai` = %i,"
[23:19:39] [DEBUGmysql_format connection1len1520format"%s`pEseriu` = %f, `pLynu` = %f,`pKarosu` = %f, `pUpetakiu` = %f, `pVegeliu` = %f,"
[23:19:39] [DEBUGmysql_format connection1len1520format"%s`Telefonas` = %i, `Telmodelis` = %i,`Telstatusas` = %i, `Telsaskaita` = %f, `Telenergija` = %i, `Telkrovimotime` = %i, `TelSim..."
[23:19:39] [DEBUGmysql_format connection1len1520format"%sWHERE `pName` = '%s'"
[23:19:39] [DEBUGmysql_query connection1query"UPDATE `users` SET Newbie = '0', pLytis = '0', pMoney = '0', Cre"use_cachetrue
[23:19:39] [DEBUGCMySQLQuery::Execute starting query execution
[23:19:39] [ERRORCMySQLQuery::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 
Reply
#3

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.
Reply
#4

Yep, found it before you. But mysql log, still looks strange:
PHP код:
[23:32:22] [DEBUGmysql_format connection1len1520format"UPDATE `users` SET Newbie = '%i', pLytis = '%i', pMoney = '%i', Credits = '%i', pXp = '%i', pAdmin = '%i', x = '%f', y = '%f', z..."
[23:32:22] [DEBUGmysql_format connection1len1520format"%svWorld = '%i', interior = '%i', pSkin = '%i', HouseId = '%i', rHouseId = '%i', RentMoney = '%i', droped = '%i', Car = '%i',"
[23:32:22] [DEBUGmysql_format connection1len1520format"%spBank = '%i', pPin = '%i', pBankMoney = '%i', pLastAction = '%i', pActionName = '%s', pActionDate = '%s',"
[23:32:22] [DEBUGmysql_format connection1len1520format"%sAkat = '%i', Bkat = '%i', Ckat = '%i', gLic = '%i', svkPaz = '%i', antrankiai = '%i', stars = '%i',"
[23:32:22] [DEBUGmysql_format connection1len1520format"%s`Leader` = '%d', `SubLeader` = '%d', `WorkId` = '%d', `WorkStatus` = '%d', `WorkSkin` = '%d', `WorkContract` = '%d', `workSala..."
[23:32:22] [DEBUGmysql_format connection1len1520format"%s`WorkPoints` = %i, `WorkWarns` = %i, `WorkRank` = %i, `Invited` = %i, `mirtis` = %i, `gangId` = %i, `gangLeadId` = %i,"
[23:32:22] [DEBUGmysql_format connection1len1520format"%s`GangSkin` = %i, `GangStatus` = %i, `gLicStatus` = %i, `gLicPoints` = %i, `lic1` = %i, `lic2` = %i, `lic3` = %i, `lic4` = %i,"
[23:32:22] [DEBUGmysql_format connection1len1520format"%s`jailed` = %i, `jailtime` = %i, `jailedtimes` = %i, `gangKills` = %i, `gangDeaths` = %i, `gangAttacks` = %i, `gangDeffends` = ..."
[23:32:22] [DEBUGmysql_format connection1len1520format"%s`pMeras` = %i, `pPatarejas` = %i,`pMeskere` = %i,`pMasalas` = %i,`pValas` = %i,"
[23:32:22] [DEBUGmysql_format connection1len1520format"%s`pEseriai` = %i, `pLynai` = %i,`pKarosai` = %i, `pUpetakiai` = %i, `pVegeliai` = %i,"
[23:32:22] [DEBUGmysql_format connection1len1520format"%s`pEseriu` = %f, `pLynu` = %f,`pKarosu` = %f, `pUpetakiu` = %f, `pVegeliu` = %f,"
[23:32:22] [DEBUGmysql_format connection1len1520format"%s`Telefonas` = %i, `Telmodelis` = %i,`Telstatusas` = %i, `Telsaskaita` = %f, `Telenergija` = %i, `Telkrovimotime` = %i, `TelSim..."
[23:32:22] [DEBUGmysql_format connection1len1520format"%s WHERE `pName` = '%s'"
[23:32:22] [DEBUGmysql_query connection1query"UPDATE `users` SET Newbie = '0', pLytis = '1', pMoney = '0', Cre"use_cachetrue
[23:32:22] [DEBUGCMySQLQuery::Execute starting query execution
[23:32:22] [DEBUGCMySQLQuery::Execute query was successfully executed within 3.691 milliseconds 
Shouldn't it show more info, stuff?
Reply
#5

I'm not actually sure. Which MySQL plugin are you using?
Reply
#6

R39-5, I mean that whole thread is not showing up.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)