12.06.2012, 15:12
Hello,
Today I decided to convert my script to MySQL Plugin R7 (BlueG). As you know I had to change all queries to the new ones. After doing this, the script compiled fine. But nothing loads. No houses. No map icons. Nothing! I'll post my house loading as an example.
The stock in OnGameModeInit
The public LoadHouses_PerID
Anything wrong in this: Answers appreciated.
Jochem
Edit: I found out the problem if in mysql_fetch_row. I'd like to have an alternative to get the whole line! I do not want each single field apart
Today I decided to convert my script to MySQL Plugin R7 (BlueG). As you know I had to change all queries to the new ones. After doing this, the script compiled fine. But nothing loads. No houses. No map icons. Nothing! I'll post my house loading as an example.
The stock in OnGameModeInit
pawn Код:
stock LoadHouses()
{
for(new h; h < MAX_HOUSES; h ++)
{
mysql_format(1,QueryString,"SELECT * FROM `HouseInfo` WHERE `ID` = %d",h);
mysql_function_query(1,QueryString,true,"LoadHouses_PerID","i",h);
}
}
pawn Код:
public LoadHouses_PerID(h)
{
new rows,fields;
cache_get_data(rows,fields);
if(rows)
{
new Line[200],IDHolder,string[70];
if(mysql_fetch_row(Line))
{
new ss = sscanf(Line,"p<|>dffffffffffffffddds[24]",IDHolder,HouseInfo[h][PickupOutsidePosX],HouseInfo[h][PickupOutsidePosY],HouseInfo[h][PickupOutsidePosZ],HouseInfo[h][PickupInsidePosX],HouseInfo[h][PickupInsidePosY],HouseInfo[h][PickupInsidePosZ],HouseInfo[h][SpawnOutsideX],HouseInfo[h][SpawnOutsideY],HouseInfo[h][SpawnOutsideZ],HouseInfo[h][SpawnOutsideAngle],
HouseInfo[h][SpawnInsideX],HouseInfo[h][SpawnInsideY],HouseInfo[h][SpawnInsideZ],HouseInfo[h][SpawnInsideAngle],HouseInfo[h][InteriorID],HouseInfo[h][Locked],HouseInfo[h][Price],HouseInfo[h][Owner]);
if(!ss)
{
if(!strcmp(HouseInfo[h][Owner],"NULL",true)) format(HouseInfo[h][Owner],MAX_PLAYER_NAME,"%s","\0");
if(isnull(HouseInfo[h][Owner]))
{
HouseInfo[h][PickupID] = CreateDynamicPickup(1273,23,HouseInfo[h][PickupOutsidePosX],HouseInfo[h][PickupOutsidePosY],HouseInfo[h][PickupOutsidePosZ]);
format(string,sizeof(string),"[House for sale]\r\n{FFFF00}Price: {FFFFFF}$%d",HouseInfo[h][Price]);
}
else
{
HouseInfo[h][PickupID] = CreateDynamicPickup(1272,23,HouseInfo[h][PickupOutsidePosX],HouseInfo[h][PickupOutsidePosY],HouseInfo[h][PickupOutsidePosZ]);
format(string,sizeof(string),"[House NOT for sale]\r\n{FFFF00}Owner: {FFFFFF}%s",HouseInfo[h][Owner]);
}
HouseInfo[h][Label] = CreateDynamic3DTextLabel(string,COLOR_LIGHTGREEN,HouseInfo[h][PickupOutsidePosX],HouseInfo[h][PickupOutsidePosY],HouseInfo[h][PickupOutsidePosZ],20.0);
GlobalInfo[HousesCreated] ++ ;
printf("- HOUSE %d: X: %f || Y: %f || Z: %f",h,HouseInfo[h][PickupOutsidePosX],HouseInfo[h][PickupOutsidePosY],HouseInfo[h][PickupOutsidePosZ]);
}
}
}
return 1;
}
Jochem
Edit: I found out the problem if in mysql_fetch_row. I'd like to have an alternative to get the whole line! I do not want each single field apart