SA-MP Forums Archive
Mysql save problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql save problem (/showthread.php?tid=427474)



Mysql save problem - LilBob - 01.04.2013

Hi !

My MySQL system is working perfect but I have some problems: houses are saved but not the bizz (when the server restarts, bizz are reset (so no owners)).

Help pls !


Re: Mysql save problem - Hanger - 01.04.2013

We cannot help you without any written code where you think might be an error.
It is well possible that there are wrong value parameters in databes as well as wrongly written database name, usually case sensitive. Try to look in mysql_debug, enable it if there is no such file..


Re: Mysql save problem - LilBob - 06.04.2013

I've tried to put :

Quote:

public OnGameModeExit() {
dmap_GameModeExit();
LoadSQLBizz();
LoadSQLCars();
OnPlayerUpdateSQL();
}

But still doesn't work :/


Re: Mysql save problem - Smally - 06.04.2013

Show us the code for LoadSQLBizz and SaveSQLBizz


Re: Mysql save problem - Arpatos - 06.04.2013

I've the same problem...


Re: Mysql save problem - LilBob - 06.04.2013

Same problem for cars: reset while player disconnect.

Here is the code for loadsqlbizz:

Quote:

public LoadSQLBizz()
{
new arrCoords[28][64];
new sql[64];
new row[512];
format(sql, sizeof(sql), "SELECT COUNT(*) FROM srp_players_bizz");
MySQLCheckconnexion();
mysql_query(sql);
//SQLLog(sql);
mysql_store_result();
mysql_fetch_row(row);
totalbizz = strval(row);
mysql_free_result();
for (new idx=0; idx<totalbizz; idx++)
{
format(sql, sizeof(sql), "SELECT * FROM srp_players_bizz WHERE id=%d", idx+1);
MySQLCheckconnexion();
mysql_query(sql);
//SQLLog(sql);
mysql_store_result();
if (mysql_num_rows() > 0)
{
mysql_fetch_row(row);
split(row, arrCoords, '|');
BizzInfo[idx][bID] = strval(arrCoords[1]);
BizzInfo[idx][bVar] = strval(arrCoords[2]);
BizzInfo[idx][bOwned] = strval(arrCoords[3]);
strmid(BizzInfo[idx][bOwner], arrCoords[4], 0, strlen(arrCoords[4]), 255);
strmid(BizzInfo[idx][bMessage], arrCoords[5], 0, strlen(arrCoords[5]), 255);
strmid(BizzInfo[idx][bExtortion], arrCoords[6], 0, strlen(arrCoords[6]), 255);
BizzInfo[idx][bEntranceX] = floatstr(arrCoords[7]);
BizzInfo[idx][bEntranceY] = floatstr(arrCoords[8]);
BizzInfo[idx][bEntranceZ] = floatstr(arrCoords[9]);
BizzInfo[idx][bExitX] = floatstr(arrCoords[10]);
BizzInfo[idx][bExitY] = floatstr(arrCoords[11]);
BizzInfo[idx][bExitZ] = floatstr(arrCoords[12]);
BizzInfo[idx][bLevelNeeded] = strval(arrCoords[13]);
BizzInfo[idx][bBuyPrice] = strval(arrCoords[14]);
BizzInfo[idx][bEntranceCost] = strval(arrCoords[15]);
BizzInfo[idx][bTill] = strval(arrCoords[16]);
BizzInfo[idx][bLocked] = strval(arrCoords[17]);
BizzInfo[idx][bInterior] = strval(arrCoords[18]);
BizzInfo[idx][bProducts] = strval(arrCoords[19]);
BizzInfo[idx][bMaxProducts] = strval(arrCoords[20]);
BizzInfo[idx][bPriceProd] = strval(arrCoords[21]);
BizzInfo[idx][bDureeLoc] = strval(arrCoords[22]);
BizzInfo[idx][bLocRest] = strval(arrCoords[23]);
BizzInfo[idx][bVariableType] = strval(arrCoords[24]);
BizzInfo[idx][bProduitsType] = strval(arrCoords[25]);
BizzInfo[idx][bHaveBot] = strval(arrCoords[26]);
BizzInfo[idx][bBuyProd] = strval(arrCoords[27]);
memcpy(BizzInfo[idx][bBotId], "Aucun", 0, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4);
if(bizreload==1)
{
UpdateBizLabel(idx,true);
UpdateBizPickup(idx);
}
}
mysql_free_result();
}
print("Fin Boucle 311");
bizreload=1;
return 1;
}

And there the code for savesqlbizz

Quote:

public SaveSQLBizz(n)
{
new sql[512],owner[32],message[64];
new idx = n-1;
mysql_real_escape_string(BizzInfo[idx][bOwner], owner);
mysql_real_escape_string(BizzInfo[idx][bMessage], message);
format(sql, sizeof(sql), "UPDATE srp_players_bizz SET IDsamp=%d,variable=%d, owned=%d,owner='%s',message='%s',extortion='%s',en t_x=%f,ent_y=%f,ent_z=%f,ext_x=%f,ext_y=%f,ext_z=% f,level=%d,price=%d,ent_cost=%d,till=%d,locked=%d, interior=%d,products=%d,maxprod=%d,priceprod=%d,du reeloc=%d,locrestant=%d,variableType=%d,produitsTy pe=%d,havebot=%d,buyprods=%d WHERE id=%d",
BizzInfo[idx][bID],
BizzInfo[idx][bVar],
BizzInfo[idx][bOwned],
owner,
message,
BizzInfo[idx][bExtortion],
BizzInfo[idx][bEntranceX],
BizzInfo[idx][bEntranceY],
BizzInfo[idx][bEntranceZ],
BizzInfo[idx][bExitX],
BizzInfo[idx][bExitY],
BizzInfo[idx][bExitZ],
BizzInfo[idx][bLevelNeeded],
BizzInfo[idx][bBuyPrice],
BizzInfo[idx][bEntranceCost],
BizzInfo[idx][bTill],
BizzInfo[idx][bLocked],
BizzInfo[idx][bInterior],
BizzInfo[idx][bProducts],
BizzInfo[idx][bMaxProducts],
BizzInfo[idx][bPriceProd],
BizzInfo[idx][bDureeLoc],
BizzInfo[idx][bLocRest],
BizzInfo[idx][bVariableType],
BizzInfo[idx][bProduitsType],
BizzInfo[idx][bHaveBot],
BizzInfo[idx][bBuyProd],
n );
MySQLCheckconnexion();
mysql_query(sql);
//SQLLog(sql);

UpdateBizLabel(idx,false);
return 1;
}




Re: Mysql save problem - LilBob - 06.04.2013

anyone ?


Re: Mysql save problem - LilBob - 06.04.2013

up, please..


Re: Mysql save problem - LilBob - 07.04.2013

need help please..


Re: Mysql save problem - Arpatos - 07.04.2013

same problem help plz !