01.03.2018, 15:04
Hello guys, i am trying to create a simple business system.
But i got some problems. I am using MySql. It's loading everything fine just problem with interior load.
My code :
Selecting all from business :
OnBizLoad :
I had tested with format and sendclientmessage to check the interior is loading. it shows 0.00000
But i got some problems. I am using MySql. It's loading everything fine just problem with interior load.
My code :
Selecting all from business :
PHP код:
format(query, sizeof(query), "SELECT * FROM business");
mysql_function_query(dbhandle, query, true, "OnBizLoad", "");
PHP код:
public OnBizLoad()
{
new num_fields,num_rows;
cache_get_data(num_rows,num_fields,dbhandle);
if(!num_rows)return 1;
for(new i=0; i<num_rows; i++)
{
new id=GetFreeBizID();
bInfo[id][b_x]=cache_get_field_content_float(i, "b_x",dbhandle);
bInfo[id][b_y]=cache_get_field_content_float(i, "b_y",dbhandle);
bInfo[id][b_z]=cache_get_field_content_float(i, "b_z",dbhandle);
bInfo[id][b_intx]=cache_get_field_content_float(i, "b_intx",dbhandle);
bInfo[id][b_inty]=cache_get_field_content_float(i, "b_inty",dbhandle);
bInfo[id][b_intz]=cache_get_field_content_float(i, "b_intz",dbhandle);
bInfo[id][b_int]=cache_get_field_content_int(i, "b_int", dbhandle);
bInfo[id][b_entry]=cache_get_field_content_int(i, "b_entry", dbhandle);
bInfo[id][b_price]=cache_get_field_content_int(i, "b_price", dbhandle);
bInfo[id][b_selling]=cache_get_field_content_int(i, "b_selling", dbhandle);
new tmp_bname[128],tmp_type[20];
cache_get_field_content(i, "b_name", tmp_bname);
strmid(bInfo[id][b_name], tmp_bname, 0, sizeof(tmp_bname), sizeof(tmp_bname));
cache_get_field_content(i, "b_type", tmp_type);
strmid(bInfo[id][b_type], tmp_type, 0, sizeof(tmp_type), sizeof(tmp_type));
new tmp_name[MAX_PLAYER_NAME];
cache_get_field_content(i, "b_owner", tmp_name);
strmid(bInfo[id][b_owner], tmp_name, 0, sizeof(tmp_name), sizeof(tmp_name));
bInfo[id][b_id]=cache_get_field_content_int(i, "id", dbhandle);
bInfo[id][b_price]=cache_get_field_content_int(i, "b_price", dbhandle);
new m[126];
format(m, sizeof(m), "ICON POST : %f,%f,%f | Interiror : %f,%f,%f", bInfo[id][b_x],bInfo[id][b_y],bInfo[id][b_z],bInfo[id][b_intx],bInfo[id][b_inty],bInfo[id][b_intz]);
SendClientMessageToAll(-1, m);
UpdateBiz(id);
}
return 1;
}