Only the first GangZone gets shown - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Only the first GangZone gets shown (
/showthread.php?tid=139244)
Only the first GangZone gets shown -
Virtual1ty - 04.04.2010
I'm having problems showing up all of my gangzones, this is my complete code.
Ontop:
pawn Код:
#define MAX_ZONES 14
enum zInfo
{
zID,
zOwner[MAX_PLAYER_NAME],
zColor,
Float:zMinX,
Float:zMinY,
Float:zMaxX,
Float:zMaxY
};
new TurfInfo[MAX_ZONES][zInfo];
Under OnGameModeInit():
pawn Код:
LoadZones();
for(new i = 0; i < MAX_ZONES; i++)
{
TurfInfo[i][zID] = GangZoneCreate(TurfInfo[i][zMinX], TurfInfo[i][zMinY], TurfInfo[i][zMaxX], TurfInfo[i][zMaxY]);
}
Under OnPlayerSpawn:
pawn Код:
for(new i = 0; i < sizeof(TurfInfo); i++)
{
//GangZoneShowForPlayer(playerid, TurfInfo[i][zID], TurfInfo[i][zColor]);
GangZoneShowForAll(TurfInfo[i][zID], TurfInfo[i][zColor]);
return 1;
}
zones.cfg file:
Код:
0|Max_Pegaz|-16777046|1570.448|-1875.704|1690.448|-1739.704
1|Anthony_Dinozo|-16777046|1825.708|-1750.933|1937.708|-1622.934
2|Max_Pegaz|-16777046|2213.031|-1732.393|2621.031|-1580.393
As the topic says, when I go ingame, only the first gangzone shows up.
I've debugged the onplayerspawn thingie, and this showed up in server console:
Код:
[DEBUG]OnPlayerSpawn: turf id 0 shown. color -16777046
Seems the problem is in the loop, it only loops through the first zone id.
Help is appreciated.
Re: Only the first GangZone gets shown -
Beaver07 - 04.04.2010
you're stopping the loop after it's only shown 1 zone
Код:
for(new i = 0; i < sizeof(TurfInfo); i++)
{
//GangZoneShowForPlayer(playerid, TurfInfo[i][zID], TurfInfo[i][zColor]);
GangZoneShowForAll(TurfInfo[i][zID], TurfInfo[i][zColor]);
return 1;
}
just remove the return 1; and put it underneath
Код:
for(new i = 0; i < sizeof(TurfInfo); i++)
{
//GangZoneShowForPlayer(playerid, TurfInfo[i][zID], TurfInfo[i][zColor]);
GangZoneShowForAll(TurfInfo[i][zID], TurfInfo[i][zColor]);
}
return 1;
Re: Only the first GangZone gets shown -
Virtual1ty - 04.04.2010
Thanks!