28.05.2010, 14:18
The thing is that I want to create dynamic interiors, from MySQL. I threw something together and it seems like some of it works. The pickups displays but you can't enter the interiors. This is my code, I dont think it's anything wrong with the MySQL query as the pickups show up.
OnQueryFinish
OnPlayerCommandText
Код:
enum bInterior
{
bID,
bInt,
bVirtual,
bPickup,
Float:bX,
Float:bY,
Float:bZ,
Float:bEX,
Float:bEY,
Float:bEZ
};
new Interior[bInterior];
Код:
mysql_store_result(SQLPtr);
if(extraid == 444)
{
printf("MySQL interior rows: %d", mysql_num_rows(SQLPtr));
for(new c = 1; c < mysql_num_rows(SQLPtr); c++)
{
format(string, sizeof(string), "SELECT * FROM ints WHERE id = '%d'", c);
mysql_query(string, INTERIOR_LOAD);
}
}
new idx;
mysql_fetch_row_format(string, " ", SQLPtr);
Interior[bID] = strval(strtok(string, idx));
Interior[bInt] = strval(strtok(string, idx));
Interior[bVirtual] = strval(strtok(string, idx));
Interior[bPickup] = strval(strtok(string, idx));
Interior[bX] = strval(strtok(string, idx));
Interior[bY] = strval(strtok(string, idx));
Interior[bZ] = strval(strtok(string, idx));
Interior[bEX] = strval(strtok(string, idx));
Interior[bEZ] = strval(strtok(string, idx));
Interior[bEY] = strval(strtok(string, idx));
CreatePickup(Interior[bPickup], 1, Interior[bX],Interior[bY],Interior[bZ], -1);
}
Код:
if(strcmp(cmd, "/enter", true) == 0)
{
if(PlayerToPoint(3, playerid, Interior[bX], Interior[bY], Interior[bZ]))
{
SetPlayerPos(playerid, Interior[bX], Interior[bY], Interior[bZ]);r
SetPlayerInterior(playerid, Interior[bInt]);
PlayerInfo[playerid][pInt] = Interior[bInt];
SetPlayerVirtualWorld(playerid, Interior[bVirtual]);
PlayerInfo[playerid][pVirtual] = Interior[bVirtual];
format(string, sizeof(string), "Int: %d, X: %d, Y: %d, Z: %d", Interior[bInt], Interior[bX], Interior[bY], Interior[bZ]);
SendClientMessageToAll(COLOR_LIGHTRED, string);
return 1;
}
return 1;
}

