09.05.2014, 07:08
Hello guys,
I tried to create a dynamic GangZone system but it doesn't work ...
That is why today i ask you to resolve my problem. I specify that i use the plugin mysql R-5 of BlueG.
First, i created this enum :
Then, during " OnGameModeInit() ", i call this function :
Finally, during the " OnPlayerSpawn() ", i call this function :
With the all printf, i note there are no problems, but the gangzones don't displayed in game ...
Would you suggest me solutions to solve this problem ? I can of course give you any logs if you want or any other information.
PS : Sorry for my bad english, and sorry for the french messages.
I tried to create a dynamic GangZone system but it doesn't work ...
That is why today i ask you to resolve my problem. I specify that i use the plugin mysql R-5 of BlueG.
First, i created this enum :
PHP код:
new cZone, nbZones;
enum zinfo
{
idZone,
Float:minx,
Float:miny,
Float:maxx,
Float:maxy,
zCouleur[32],
};
new zoneInfo[1024][zinfo];
PHP код:
forward LoadZones();
public LoadZones()
{
new string[1028];
F(string, sizeof(string), "SELECT * FROM zones");
mysql_query(string);
mysql_store_result();
new row = mysql_num_rows();
if(!row)
{
print("Impossible de rйcuperer les informations de la table \"zones\", raison: Erreur requкte ou table vide...");
mysql_free_result();
return 0;
}
new data[1024], field[6][128];
while(mysql_fetch_row(data))
{
split(data, field, '|');
zoneInfo[cZone][minx] = floatstr(field[1]);
zoneInfo[cZone][miny] = floatstr(field[2]);
zoneInfo[cZone][maxx] = floatstr(field[3]);
zoneInfo[cZone][maxy] = floatstr(field[4]);
F(zoneInfo[cZone][zCouleur], 32, "%s", field[5]);
zoneInfo[cZone][idZone] = GangZoneCreate(zoneInfo[cZone][minx], zoneInfo[cZone][miny], zoneInfo[cZone][maxx], zoneInfo[cZone][maxy]);
printf("Zone ID %i chargйe - Min X : %f - Min Y : %f - Max X : %f - Max Y : %f", zoneInfo[cZone][idZone], zoneInfo[cZone][minx], zoneInfo[cZone][miny], zoneInfo[cZone][maxx], zoneInfo[cZone][maxy]);
cZone++;
}
mysql_free_result();
nbZones = cZone;
printf("Nombre de zones : %i", nbZones);
return 1;
}
PHP код:
forward showGangZone(playerid);
public showGangZone(playerid)
{
for(new i=0; i<nbZones; i++)
{
GangZoneShowForPlayer(playerid, zoneInfo[i][idZone], zoneInfo[i][zCouleur]);
printf("Joueur %i - Zone montrйe ID %i - Couleur : %s", playerid, zoneInfo[i][idZone], zoneInfo[i][zCouleur]);
F(prvMsg, sizeof(prvMsg), "Zone ID %i montrйe.", zoneInfo[i][idZone]);
SCM(playerid, ORANGE, prvMsg);
}
return 1;
}
Would you suggest me solutions to solve this problem ? I can of course give you any logs if you want or any other information.
PS : Sorry for my bad english, and sorry for the french messages.