SA-MP Forums Archive
More mysql issues - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: More mysql issues (/showthread.php?tid=196778)



More mysql issues - hanzen - 06.12.2010

Hello,

I'm trying to build a dynamic interior system/building system.

Loading the interiors and making Pickups + 3Dlabel is not a problem, but when you are going to enter. I use IsPlayerInRangeOfPoint. Then the problem occurs, how to retrieve the correct interior from the DB? (To enter you press shift so it has to be run underneath public OnPlayerKeyStateChange().

Public LoadInts()
Код:
	new intdata[255];
	format(query, sizeof(query), "SELECT * FROM `interiors` WHERE 1;");
	mysql_query(query);mysql_store_result();
	
	while(mysql_fetch_row(intdata,"|"))
	{
		mysql_fetch_field("id",  intdata); InteriorInfo[iID] = strval(intdata);
		mysql_fetch_field("int",  intdata); InteriorInfo[iInt] = strval(intdata);
		mysql_fetch_field("virtual",  intdata); InteriorInfo[iVirtual] = strval(intdata);
		mysql_fetch_field("pickup",  intdata); InteriorInfo[iPickup] = strval(intdata);
		mysql_fetch_field("x",  intdata); InteriorInfo[iX] = strval(intdata);
		mysql_fetch_field("y",  intdata); InteriorInfo[iY] = strval(intdata);
		mysql_fetch_field("z",  intdata); InteriorInfo[iZ] = strval(intdata);
		mysql_fetch_field("ex",  intdata); InteriorInfo[iEx] = strval(intdata);
		mysql_fetch_field("ey",  intdata); InteriorInfo[iEy] = strval(intdata);
		mysql_fetch_field("ez",  intdata); InteriorInfo[iEz] = strval(intdata);
		
		new string[255];
		format(string, sizeof(string), "[MySQL] Loaded interior with the ID %d", InteriorInfo[iID]);
		printf(string);
		
    	AddStaticPickup(InteriorInfo[iPickup], 1, InteriorInfo[iX], InteriorInfo[iY], InteriorInfo[iZ], 0);
		Create3DTextLabel("Press {D22121}shift{FFFFFF} to enter!",COLOR_WHITE,InteriorInfo[iX], InteriorInfo[iY], InteriorInfo[iZ],40.0,0);
	}
	
	return 1;
Would appreciate suggestions.