30.10.2011, 13:50
(
Последний раз редактировалось Webghost; 31.10.2011 в 16:40.
)
To fix the problem: http://pastebin.com/RPKQzz0j
________________________________________________
I am currently trying to rebuild a Housing system.
The system works very well except for 1 thing.
On filterscriptinit should load all the houses at once, then create them 1 by 1.
I have no clue on what to do on this issue, reading a table to expect only 1 row i know by heart, receiving multiple rows, there i am lost.
This is what i've got, it seems to read only 1 row:
>>> ERROR MESSAGE:
[14:44:55] Filterscript 'housesystem.amx' loaded.
[14:44:55] [MySQL] Error (0): Function: mysql_store_result called when no result stored.
[14:44:55] Number of created Houses: 1
>>> PASTEBIN VERSION: http://pastebin.com/ADCHrZfc
________________________________________________
I am currently trying to rebuild a Housing system.
The system works very well except for 1 thing.
On filterscriptinit should load all the houses at once, then create them 1 by 1.
I have no clue on what to do on this issue, reading a table to expect only 1 row i know by heart, receiving multiple rows, there i am lost.
This is what i've got, it seems to read only 1 row:
>>> ERROR MESSAGE:
[14:44:55] Filterscript 'housesystem.amx' loaded.
[14:44:55] [MySQL] Error (0): Function: mysql_store_result called when no result stored.
[14:44:55] Number of created Houses: 1
>>> PASTEBIN VERSION: http://pastebin.com/ADCHrZfc
pawn Код:
#define THREAD_LOADHOUSES 100
public OnFilterScriptInit()
{
//MySQL Connection
MySQLConnect(MySQL_Hostname, MySQL_Username, MySQL_Database, MySQL_Password, MySQL_Connection, true);
//Load Houses
mysql_query("SELECT * FROM `houses`", THREAD_LOADHOUSES, -1);
return 1;
}
public OnMysqlQuery(resultid, spareid, MySQL:handle)
{
switch(resultid)
{
case THREAD_LOADHOUSES:
{
mysql_store_result(handle);
new HouseCount = 0, MySQL_Load[150];
while(mysql_fetch_row(MySQL_Load, "|", handle))
{
new ID, Owner[24], HName[128], HPass[128], Float:X, Float:Y, Float:Z, Float:eX, Float:eY, Float:eZ, Float:eA, Doors, InteriorModel, Cost;
sscanf(MySQL_Load, "p<|>ds[24]s[128]s[128]fffffffddd",
ID,
Owner,
HName,
HPass,
X,
Y,
Z,
eX,
eY,
eZ,
eA,
Doors,
InteriorModel,
Cost);
CreateHouse(true, ID, Owner, HName, HPass, X, Y, Z, eX, eY, eZ, eA, Doors, InteriorModel, Cost);
HouseCount ++;
}
printf("Number of created Houses: %d", HouseCount);
mysql_free_result(handle);
}
}
return 1;
}