Turfs not showing
#1

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(mysqlsqlsizeof(sql), "SELECT * FROM turfs");
mysql_tquery(mysqlsql"OnTurfsLoad""");
// Finally
public OnTurfsLoad(playerid)
{
    new 
rowsfields;
    
cache_get_data(rowsfieldsmysql);
    if(
rows)
    {
        for (new 
i=0i<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], mysql16);
            
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");
            
GangZoneCreate(tInfo[i][tfminx], tInfo[i][tfminy], tInfo[i][tfmaxx], tInfo[i][tfmaxy]);
            
GangZoneShowForAll(itInfo[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.
Reply
#2

Код:
mysql_format(mysql, sql, sizeof(sql), "SELECT * FROM turfs"); 
mysql_tquery(mysql, sql, "OnTurfsLoad", "");
Put that under OnGameModeInit (obviously after mysql_connect)
Reply
#3

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.
Reply
#4

Anyone? Some help please?
Reply
#5

Come on guys, please, some help?
Reply
#6

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.
Reply
#7

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?
Reply
#8

pawn Код:
mysql_format(mysql, sql, sizeof(sql), "SELECT * FROM `turfs`");
Reply
#9

Can you paste the code of errors here please?
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)