SA-MP Forums Archive
GangZone Show For All! - 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)
+--- Thread: GangZone Show For All! (/showthread.php?tid=362699)



GangZone Show For All! - nGen.SoNNy - 25.07.2012

Hi guys! I have this thing:

pawn Код:
for(new i=1; i<51; i++)
    {
         turf[i] = GangZoneCreate(TeritoriuInfo[i][tPozX1],TeritoriuInfo[i][tPozY1],TeritoriuInfo[i][tPozX2],TeritoriuInfo[i][tPozY2]);

    }

And i want to show All these gangzone for all players using this "turf" Have some ideas!?
I tried to include
pawn Код:
GangZoneShowForAll(turf[i], COLOR_RED);
in this loop but nothing happends!


Re: GangZone Show For All! - iggy1 - 25.07.2012

You have to show gangzones to players when they connect (or whenever you want to show them). But the player must be connected when the gangzone is shown.


Re: GangZone Show For All! - nGen.SoNNy - 25.07.2012

So i have to use this
pawn Код:
GangZoneShowForAll(turf[i], COLOR_RED);
at OnPlayerConnect ?


Re: GangZone Show For All! - iggy1 - 25.07.2012

GangZoneShowForPlayer Would be a better option. (might not be able to do it under OnPlayerConnect i'm not sure)


Re: GangZone Show For All! - nGen.SoNNy - 25.07.2012

but i have that turf[i] i can't use it outside of that loop with gangzonecreate..


Re: GangZone Show For All! - iggy1 - 25.07.2012

pawn Код:
public OnPlayerConnect(playerid)
{
    for(new i=1; i<51; i++)
    {
        GangZoneShowForPlayer(playerid, turf[i], color);
    }
    return 1;
}
EDIT: If it doesn't work under OnPlayerConnect try putting it under OnPlayerSpawn.


Re: GangZone Show For All! - nGen.SoNNy - 25.07.2012

ERRORS:

pawn Код:
[14:47:17] [debug] Run time error 4: "Array index out of bounds"
[14:47:17] [debug]   Accessing element at index 8 past array upper bound 7
[14:47:17] [debug] AMX backtrace:
[14:47:17] [debug] #0  0001ee78 in public S@@_OnPlayerConnect () from (SE).amx
[14:47:17] [debug] #1  native CallLocalFunction () [00472c00] from samp-server.exe
[14:47:17] [debug] #2  00013268 in public Itter_OnPlayerConnect () from (SE).amx
[14:47:17] [debug] #3  native CallLocalFunction () [00472c00] from samp-server.exe
[14:47:17] [debug] #4  00009f20 in public SSCANF_OnPlayerConnect () from (SE).amx
[14:47:17] [debug] #5  native CallLocalFunction () [00472c00] from samp-server.exe
[14:47:17] [debug] #6  00001a48 in public Streamer_OnPlayerConnect () from (SE).amx
[14:47:17] [debug] #7  native CallLocalFunction () [00472c00] from samp-server.exe
[14:47:17] [debug] #8  00000f6c in public OnPlayerConnect () from (SE).amx

for
pawn Код:
for(new i=1; i<18; i++)
    {
        GangZoneShowForPlayer(playerid, turf[i], GangColors[ TeritoriuInfo[i][tColor] ]);
    }
and
pawn Код:
for(new i=1; i<18; i++)
    {
         turf[i] = GangZoneCreate(TeritoriuInfo[i][tPozX1],TeritoriuInfo[i][tPozY1],TeritoriuInfo[i][tPozX2],TeritoriuInfo[i][tPozY2]);
    }



Re: GangZone Show For All! - iggy1 - 25.07.2012

Any of those arrays you use only 7 cells big? From the looks of the error your doing something similar to this.

pawn Код:
public OnPlayerConnect(playerid)
{
    new arr[7];
   
    arr[8] = 666;//actually arr[7] would be out of bounds but i used '8' for clarity.
    return 1;
}
I guess your looping one too many times.