SA-MP Forums Archive
Problem with INSERT - 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: Problem with INSERT (/showthread.php?tid=630970)



Problem with INSERT - Hackzzzz - 20.03.2017

Hey guys, i have a problem with BlueG (R40) native "mysql_tquery".This function doesn't insert into the database.

Код:
stock OnPlayerBuyFurniture(houseid, interior, world, furnitureslot, model, price, name[], Float:x, Float:y, Float:z)
{
	mysql_format(dbHandle, query, sizeof(query), "INSERT INTO `furnitures` (model, name, houseid, interior, virworld, marketprice, posx, posy, posz) VALUES (%d, '%s', %d, %d, %d, %d, %f, %f, %f)",
	model, name, HouseInfo[houseid][hID], interior, world, price, x, y ,z);
	mysql_tquery(dbHandle, query,"OnFurnitureInsert", "iiiiiis[128]fff", houseid, interior, world, furnitureslot, model, price, name, x, y, z);
	return 1;
}

public OnFurnitureInsert(houseid, interior, world, furnitureslot, model, price, name[], Float:x, Float:y, Float:z)
{
	FurnitureInfo[houseid][furnitureslot][fID] = cache_insert_id();
	FurnitureInfo[houseid][furnitureslot][fHouseID] = houseid;
	FurnitureInfo[houseid][furnitureslot][fInterior] = interior;
	FurnitureInfo[houseid][furnitureslot][fVirtualWorld] = world;
	FurnitureInfo[houseid][furnitureslot][fMarketPrice] = price;
	FurnitureInfo[houseid][furnitureslot][fModel] = model;
	FurnitureInfo[houseid][furnitureslot][fPosX] = x;
	FurnitureInfo[houseid][furnitureslot][fPosY] = y;
	FurnitureInfo[houseid][furnitureslot][fPosZ] = z;
	FurnitureInfo[houseid][furnitureslot][fPosRX] = 0.0;
	FurnitureInfo[houseid][furnitureslot][fPosRY] = 0.0;
	FurnitureInfo[houseid][furnitureslot][fPosRZ] = 0.0;
	format(FurnitureInfo[houseid][furnitureslot][fName], 128, "%s", name);
	FurnitureInfo[houseid][furnitureslot][fOn] = 1;
	return 1;
}



Re: Problem with INSERT - X337 - 21.03.2017

Is there any errors/warnings in your mysql log?


Re: Problem with INSERT - Hackzzzz - 21.03.2017

No, nothing


Re: Problem with INSERT - X337 - 21.03.2017

Try this, i removed [128] in the format specifier. As far as i know, you don't need to provide string length for that.
Код:
mysql_tquery(dbHandle, query,"OnFurnitureInsert", "iiiiiisfff", houseid, interior, world, furnitureslot, model, price, name, x, y, z);



Re: Problem with INSERT - Hackzzzz - 21.03.2017

Work. Thanks buddy. +Rep