05.01.2015, 20:02
Hi guys.
I'm working on a dynamic faction system and it's all ok. I can create a faction, the turf appears but if I restart the server the turfs are not showing anymore. In my table I'm storing the coords, min x, min y, max x, max y and also the color for the turf but for some reason it does not show.
Here is the code I use for this thing:
I've tried alot of things but nothing worked. Maybe you guys can please help me.
I'm working on a dynamic faction system and it's all ok. I can create a faction, the turf appears but if I restart the server the turfs are not showing anymore. In my table I'm storing the coords, min x, min y, max x, max y and also the color for the turf but for some reason it does not show.
Here is the code I use for this thing:
PHP код:
forward OnTurfsLoad(playerid);
enum TDATA
{
tid,
tfaction,
tcolor[16],
Float:tfminx,
Float:tfminy,
Float:tfmaxx,
Float:tfmaxy
}
new tInfo[MAX_PLAYERS][TDATA];
// Under main()
mysql_format(mysql, sql, sizeof(sql), "SELECT * FROM turfs");
mysql_tquery(mysql, sql, "OnTurfsLoad", "");
// Finally
public OnTurfsLoad(playerid)
{
new rows, fields;
cache_get_data(rows, fields, mysql);
if(rows)
{
for (new i=0; i<cache_get_row_count(); i++)
{
tInfo[i][tid] = cache_get_field_content_int(i, "id");
tInfo[i][tfaction] = cache_get_field_content_int(i, "faction");
cache_get_field_content(i, "color", tInfo[i][tcolor], mysql, 16);
tInfo[i][tfminx] = cache_get_field_content_float(i, "tfminx");
tInfo[i][tfminy] = cache_get_field_content_float(i, "tfminy");
tInfo[i][tfmaxx] = cache_get_field_content_float(i, "tfmaxx");
tInfo[i][tfmaxy] = cache_get_field_content_float(i, "tfmaxy");
i = GangZoneCreate(tInfo[i][tfminx], tInfo[i][tfminy], tInfo[i][tfmaxx], tInfo[i][tfmaxy]);
GangZoneShowForAll(i, tInfo[i][tcolor]);
}
}
printf("Number of existing turfs: %d", cache_get_row_count());
return 1;
}