22.10.2012, 16:54
Hey with my house system I have it so a callback called OnHouseLoaded in this callback it should split the data into a enumerator which is stored in the variable: PlayerInfo. However I am not sure it is working as my text label is not being created which leads me to believe it is not storing the data for the X, Y and the Z co-ordinate.
Here is the code I am using:
Here is the code I am using:
pawn Код:
public OnHouseLoaded(playerid)
{
new
idx,
result[256];
mysql_store_result();
while(mysql_fetch_row_format(result, "|"))
{
sscanf(result, "e<is[30]iifffiis[200]>", HouseInfo[idx]);
new houselabel[200];
format(houselabel, sizeof(houselabel), "House ID: %i\nHouse Owner: %s\nHouse Price: $%i\nHouseLevel: %i\nUse /buy to buy this house!", HouseInfo[idx][houseid], HouseInfo[idx][howner], HouseInfo[idx][hprice], HouseInfo[idx][hlevel]);
HouseInfo[idx][hlabel] = Create3DTextLabel(houselabel, COLOR_LIGHTGREEN, HouseInfo[idx][HouseX], HouseInfo[idx][HouseY], HouseInfo[idx][HouseZ], 40.0, 0, 0);
new string[200], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "Admin: %s has created a new house with the ID: %i", name, HouseInfo[idx][houseid]);
SendAdminMessage(COLOR_GOLD, string);
idx++;
}
mysql_free_result();
printf("MySQL: Succesful. Fetched %i rows from the database.", idx+1);
return 1;
}