SA-MP Forums Archive
Max Ganglockers 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: Max Ganglockers Problem (/showthread.php?tid=645163)



Max Ganglockers Problem - PierreMarley - 21.11.2017

Hello, I have gang locker system on my script and was Max 30 locker but i adjusted it to 80 and when i create locker from id 30+ Not saving in the database why?, only i have ID from 1 to 30 in the db how i can add more?

I made it like that
Код:
#define 		MAX_GANGLOCKER 				(80)
This is Screenshot of database
http://prntscr.com/hdaytw


Re: Max Ganglockers Problem - pollo97 - 21.11.2017

Can you paste the query?


Re: Max Ganglockers Problem - PierreMarley - 21.11.2017

query of?


Re: Max Ganglockers Problem - Twizted - 21.11.2017

The query of adding new locker IDs.


Re: Max Ganglockers Problem - PierreMarley - 21.11.2017

Код:
stock SaveGangLocker(id)
{
	new string[1024];
	format(string, sizeof(string), "UPDATE `ganglockers` SET \
		`PosX`=%f, \
		`PosY`=%f, \
		`PosZ`=%f, \
		`VW`=%d, \
		`Int`=%d, \
		`Type`=%d, \
		`Family`=%d WHERE `id`=%d",
		GangLockers[id][glockerPosX],
		GangLockers[id][glockerPosY],
		GangLockers[id][glockerPosZ],
		GangLockers[id][glockerVW],
		GangLockers[id][glockerInt],
		GangLockers[id][glockerType],
		GangLockers[id][glockerFamily],
		id+1
	);

	mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
}
Idk if this help too
Код:
stock SaveGangLockers()
{
	for(new i = 0; i < MAX_GANGLOCKER; i++)
	{
		SaveGangLocker(i);
	}
	return 1;
}

stock RehashGangLocker(id)
{
	DestroyDynamic3DTextLabel(GangLockers[id][glockerTextID]);
	GangLockers[id][glockerSQLId] = 1;
	GangLockers[id][glockerPosX] = 0.0;
	GangLockers[id][glockerPosY] = 0.0;
	GangLockers[id][glockerPosZ] = 0.0;
	GangLockers[id][glockerVW] = 0;
	GangLockers[id][glockerInt] = 0;
	GangLockers[id][glockerType] = 0;
	GangLockers[id][glockerFamily] = 0;
	LoadGangLocker(id);
}

stock RehashGangLockers()
{
	printf("[RehashGangLockers] Deleting Gang Lockers from server...");
	for(new i = 0; i < MAX_GANGLOCKER; i++)
	{
		RehashGangLocker(i);
	}
	LoadGangLockers();
}

stock LoadGangLocker(id)
{
	new string[128];
	format(string, sizeof(string), "SELECT * FROM `ganglockers` WHERE `id`=%d", id);
	mysql_function_query(MainPipeline, string, true, "OnLoadGangLocker", "i", id);
}

stock LoadGangLockers()
{
	printf("[LoadGangLockers] Loading data from database...");
	mysql_function_query(MainPipeline, "SELECT * FROM `ganglockers`", true, "OnLoadGangLockers", "");
}



Re: Max Ganglockers Problem - mirou123 - 21.11.2017

Post your SaveGangLocker code


Re: Max Ganglockers Problem - PierreMarley - 21.11.2017

I already did

Код:
stock SaveGangLocker(id)
{
	new string[1024];
	format(string, sizeof(string), "UPDATE `ganglockers` SET \
		`PosX`=%f, \
		`PosY`=%f, \
		`PosZ`=%f, \
		`VW`=%d, \
		`Int`=%d, \
		`Type`=%d, \
		`Family`=%d WHERE `id`=%d",
		GangLockers[id][glockerPosX],
		GangLockers[id][glockerPosY],
		GangLockers[id][glockerPosZ],
		GangLockers[id][glockerVW],
		GangLockers[id][glockerInt],
		GangLockers[id][glockerType],
		GangLockers[id][glockerFamily],
		id+1
	);

	mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
}



Re: Max Ganglockers Problem - Meller - 21.11.2017

This code doesn't help a lot, show us debugs of mysql logs, mysql insert ids, the code where you create the "gang locker" etc.