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().
Код:
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;