Mysql save problem
#6

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;
}

Reply


Messages In This Thread
Mysql save problem - by LilBob - 01.04.2013, 20:53
Re: Mysql save problem - by Hanger - 01.04.2013, 23:46
Re: Mysql save problem - by LilBob - 06.04.2013, 13:49
Re: Mysql save problem - by Smally - 06.04.2013, 14:03
Re: Mysql save problem - by Arpatos - 06.04.2013, 14:16
Re: Mysql save problem - by LilBob - 06.04.2013, 14:19
Re: Mysql save problem - by LilBob - 06.04.2013, 16:53
Re: Mysql save problem - by LilBob - 06.04.2013, 19:23
Re: Mysql save problem - by LilBob - 07.04.2013, 09:07
Re: Mysql save problem - by Arpatos - 07.04.2013, 12:33

Forum Jump:


Users browsing this thread: 1 Guest(s)