Turfs not showing -
Nightkill - 05.01.2015
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:
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;
}
I've tried alot of things but nothing worked. Maybe you guys can please help me.
Re: Turfs not showing -
Divergent - 05.01.2015
Код:
mysql_format(mysql, sql, sizeof(sql), "SELECT * FROM turfs");
mysql_tquery(mysql, sql, "OnTurfsLoad", "");
Put that under OnGameModeInit (obviously after mysql_connect)
Re: Turfs not showing -
Nightkill - 05.01.2015
In main I also have the mysql connect and other queries for loading houses, cars and others so i don't think that this is the problem. The queries run but the turfs just won't appear.
Re: Turfs not showing -
Nightkill - 06.01.2015
Anyone? Some help please?
Re: Turfs not showing -
Nightkill - 08.01.2015
Come on guys, please, some help?
Re: Turfs not showing -
ball - 08.01.2015
Why are you showing zones at the same time as turfs loading? Player must be connected, otherwise he don't see zones. Use function GangZoneShowForPlayer in OnPlayerConnect callback.
Re: Turfs not showing -
Nightkill - 11.01.2015
I corrected that and tried to load the turfs onplayerconnect and after that onplayerspawn but still no results. Do you guys know any good and working method for loading turfs from a database?
Re: Turfs not showing -
bgedition - 11.01.2015
pawn Код:
mysql_format(mysql, sql, sizeof(sql), "SELECT * FROM `turfs`");
Re: Turfs not showing -
fatlirmorina - 11.01.2015
Can you paste the code of errors here please?
Re: Turfs not showing -
Nightkill - 11.01.2015
Well the thing is...I don't have any errors so I don't know what is the problem. The script can read my variables and the values correctly but the turfs just don't show. I think I'm doing something wrong. Maybe I don't put creategangzone and showgangzone in the right places or maybe I'm skipping something, I have no idea.