More MySQL(?) problems. - 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(?) problems. (
/showthread.php?tid=150880)
More MySQL(?) problems. -
hanzen - 28.05.2010
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.
Код:
enum bInterior
{
bID,
bInt,
bVirtual,
bPickup,
Float:bX,
Float:bY,
Float:bZ,
Float:bEX,
Float:bEY,
Float:bEZ
};
new Interior[bInterior];
OnQueryFinish
Код:
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);
}
OnPlayerCommandText
Код:
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;
}
Re: More MySQL(?) problems. -
hanzen - 28.05.2010
Does anyone even have a clue that what may be wrong?
All help would be appreciated.