SA-MP Forums Archive
[Tutorial] Gang Zone Wars - 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: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Gang Zone Wars (/showthread.php?tid=276352)

Pages: 1 2


Respuesta: Gang Zone Wars - ||ponpon|| - 11.09.2011

I have these errors:
Quote:

(23) : error 017:error 017: undefined symbol "ZoneInfo"
(24) : error 017:undefined symbol "ZoneInfo"
(25) : error 017: undefined symbol "ZoneInfo"
(164) : error 001:expected token: ";", but found "forward"

Lines:

Line 23:
Code:
new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...};
Line 24:
Code:
new ZoneAttackTime[sizeof(ZoneInfo)];
Line 25:
Code:
new ZoneDeaths[sizeof(ZoneInfo)];
Line 164:
Code:
forward SetPlayerRandomSpawn(playerid);
Help me please :/


Re: Gang Zone Wars - R3dX - 12.11.2011

I have a problem.

I used the first method. I followed all the steps. Everything is ok until you start by war, going on rival territory but nothing happens.

Below is what I am introduced to GM for gang wars


1.
pawn Code:
AddPlayerClass(113, 1124.2415, -2037.1274, 69.8847, 269.15, 7, 1, 24, 60, 0, 0);
AddPlayerClass(120, -2192.3020, 646.8816, 49.4375, 269.15, 8, 1, 24, 60, 0, 0);
2.
Code:
#define TEAM_LCN 1 
#define TEAM_YAKUZA 2 
#define TAKEOVER_TIME 300 
#define MIN_MEMBERS_TO_START_WAR 1
3.
Code:
static gTeam[MAX_PLAYERS];
4.
Code:
public SetPlayerTeamFromClass(playerid,classid)
{
 	if (classid == 0)
	{
  		gTeam[playerid] = TEAM_LCN;
	}
	else
	{
  		gTeam[playerid] = TEAM_YAKUZA;
	}
}
5.
Code:
if (gTeam[playerid] == TEAM_LCN)
{
	SetPlayerColor(playerid, COLOR_LCN);
}
else if (gTeam[playerid] == TEAM_YAKUZA)
{
	SetPlayerColor(playerid, COLOR_YKZ);
}
6.
Code:
enum eZone
{
    Float:zMinX,
    Float:zMinY,
    Float:zMaxX,
    Float:zMaxY,
    zTeam
}
new ZoneInfo[][eZone] = {
    {-2263.0850,52.9664,-2355.4988,-178.6447,TEAM_LCN}, // Teritoriu factiunea 1 (LCN)
    {-2150.3877,313.4182,-2241.1433,102.3497,TEAM_YAKUZA} // Teritoriu factiunea 2 (Yakuza)
};
new ZoneID[sizeof(ZoneInfo)];
7.
Code:
for(new i=0; i < sizeof(ZoneInfo); i++)
{
	GangZoneShowForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
        if(ZoneAttacker[i] != -1) GangZoneFlashForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
}
8.
Code:
for(new i=0; i < sizeof(ZoneInfo); i++)
{
	ZoneID[i] = GangZoneCreate(ZoneInfo[i][zMinX], ZoneInfo[i][zMinY], ZoneInfo[i][zMaxX], ZoneInfo[i][zMaxY]);
}
9.
Code:
stock GetTeamZoneColor(teamid)
{
    switch(teamid)
    {
        case TEAM_LCN: return 0x00FF0088;
        case TEAM_YAKUZA: return 0xFF00FF88;
    }
    return -1;
}
10.
Code:
new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...};
new ZoneAttackTime[sizeof(ZoneInfo)];
11.
Code:
new Teams[] = {
    TEAM_LCN,
    TEAM_YAKUZA
};
12.
Code:
stock IsPlayerInZone(playerid, zoneid)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    return (x > ZoneInfo[zoneid][zMinX] && x < ZoneInfo[zoneid][zMaxX] && y > ZoneInfo[zoneid][zMinY] && y < ZoneInfo[zoneid][zMaxY]);
}

stock GetPlayersInZone(zoneid, teamid)
{
    new count;
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && IsALcn(i) == teamid && IsAYakuza(i) == teamid && IsPlayerInZone(i, zoneid))
        {
            count++;
        }
    }
    return count;
}
13.
Code:
SetTimer("ZoneTimer", 1000, true);
14.
Code:
public ZoneTimer()
{
    for(new i=0; i < sizeof(ZoneInfo); i++) // loop all zones
    {
        if(ZoneAttacker[i] != -1) // zone is being attacked
        {
            if(GetPlayersInZone(i, ZoneAttacker[i]) >= MIN_MEMBERS_TO_START_WAR) // team has enough members in the zone
            {
                ZoneAttackTime[i]++;
                if(ZoneAttackTime[i] == TAKEOVER_TIME) // zone has been under attack for enough time and attackers take over the zone
                {
                    GangZoneStopFlashForAll(ZoneID[i]);
                    ZoneInfo[i][zTeam] = ZoneAttacker[i];
                    GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam])); // update the zone color for new team
                    ZoneAttacker[i] = -1;
                }
            }
            else // attackers failed to take over the zone
            {
                GangZoneStopFlashForAll(ZoneID[i]);
                ZoneAttacker[i] = -1;
            }
        }
        else // check if somebody is attacking
        {
            for(new t=0; t < sizeof(Teams); t++) // loop all teams
            {
                if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR) // if there are enough enemies in the zone
                {
                    ZoneAttacker[i] = Teams[t];
                    ZoneAttackTime[i] = 0;
                    GangZoneFlashForAll(ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
                }
            }
        }
    }
}



Re: Gang Zone Wars - MadeMan - 12.11.2011

Quote:
Originally Posted by R3dX
View Post
I have a problem.

I used the first method. I followed all the steps. Everything is ok until you start by war, going on rival territory but nothing happens.

Below is what I am introduced to GM for gang wars


...
6.
Code:
enum eZone
{
    Float:zMinX,
    Float:zMinY,
    Float:zMaxX,
    Float:zMaxY,
    zTeam
}
new ZoneInfo[][eZone] = {
    {-2263.0850,52.9664,-2355.4988,-178.6447,TEAM_LCN}, // Teritoriu factiunea 1 (LCN)
    {-2150.3877,313.4182,-2241.1433,102.3497,TEAM_YAKUZA} // Teritoriu factiunea 2 (Yakuza)
};
new ZoneID[sizeof(ZoneInfo)];
...
zMin must be smaller than zMax.

Your zMinX is -2263.0850 but zMaxX is -2355.4988

-2263.0850 is not smaller than -2355.4988


Re: Gang Zone Wars - Naruto_Emilio - 18.11.2011

pawn Code:
new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...};
pawn Code:
error 018: initialization data exceeds declared size



Re: Gang Zone Wars - Astralis - 18.11.2011

good tut but need fix some errors.


Re: Gang Zone Wars - DawioX - 24.01.2012

Hello

I have a problem I want to do in order to view this information when the gang attacked a gang of 2
for example:

Code:
format (str, sizeof (str), "Zone:% s is attacked by a gang:% s, the remaining 2 minutes.");
SendClientMessageToAll (RED, str);
I do not know what to put a name to fetch the zone under attack
and the name of the gang attacker.

Please help.


Re: Gang Zone Wars - dickyodie - 01.02.2012

I get an error and 2 warning please tell me how to fix it

Code:
C:\Documents and Settings\xp\Desktop\LZGS Adventure World\gamemodes\MMORPG.pwn(34) : error 017: undefined symbol "ZoneInfo"
C:\Documents and Settings\xp\Desktop\LZGS Adventure World\gamemodes\MMORPG.pwn(1162) : warning 235: public function lacks forward declaration (symbol "ZoneTimer")
C:\Documents and Settings\xp\Desktop\LZGS Adventure World\gamemodes\MMORPG.pwn(1612) : warning 203: symbol is never used: "Teams"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase



Re: Respuesta: Gang Zone Wars - Dustly - 01.03.2012

Quote:
Originally Posted by ||ponpon||
View Post
I have these errors:

Lines:

Line 23:
Code:
new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...};
Line 24:
Code:
new ZoneAttackTime[sizeof(ZoneInfo)];
Line 25:
Code:
new ZoneDeaths[sizeof(ZoneInfo)];
Line 164:
Code:
forward SetPlayerRandomSpawn(playerid);
Help me please :/
FFS I AM HAVING SAME PROBLEM!!! HELP!!!!!!


Re: Gang Zone Wars - GNGification - 03.03.2012

Edit: got all fixed


Re: Gang Zone Wars - susuke97 - 16.08.2012

C:\Documents and Settings\RaduFabian\Desktop\samp03\gamemodes\eGame r.pwn(139) : warning 201: redefinition of constant/macro (symbol "MAX_PLAYER_ATTACHED_OBJECTS")
C:\Documents and Settings\RaduFabian\Desktop\samp03\gamemodes\eGame r.pwn(12250) : error 017: undefined symbol "ZoneID"
C:\Documents and Settings\RaduFabian\Desktop\samp03\gamemodes\eGame r.pwn(12250) : warning 215: expression has no effect
C:\Documents and Settings\RaduFabian\Desktop\samp03\gamemodes\eGame r.pwn(12250) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\RaduFabian\Desktop\samp03\gamemodes\eGame r.pwn(12250) : error 029: invalid expression, assumed zero
C:\Documents and Settings\RaduFabian\Desktop\samp03\gamemodes\eGame r.pwn(12250) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.




Line : ZoneID[i] = GangZoneCreate(ZoneInfo[i][zMinX], ZoneInfo[i][zMinY], ZoneInfo[i][zMaxX], ZoneInfo[i][zMaxY]);

Plz help fast


Re: Gang Zone Wars - Arxalan - 04.01.2015

I made new command /war and added ZoneTimer(); in that command lines . Now when i use / war it begins to start flashing the zone but the timer don't ends and the zone still flashed even i get out of there.
EDIT: I used the first type of Zone Attack (#1)


Re: Gang Zone Wars - Cr3dO - 07.02.2015

Dont working and capture alll zones
help


Re: Gang Zone Wars - Tookapack - 26.02.2015

Can anyone guide me in the right direction with this. Im trying to use it with a DM script where you make your own gangs and use the gang that you made to capture the zones, not the tdm gang wars. If anyone gets me write me back or pm me please


Re: Gang Zone Wars - Ugaustin - 24.06.2015

I put zoneattack 1 and 2??I don't understand how..


Re: Gang Zone Wars - Ugaustin - 24.06.2015

yes but the gangzones don't get saved..


Re: Gang Zone Wars - Ugaustin - 25.06.2015

but if civilian kills gang?


Re: Gang Zone Wars - TonyCan - 06.06.2016

Quote:

(40904) : error 035: argument type mismatch (argument 2)
(40915) : error 035: argument type mismatch (argument 2)

40904
Quote:

stock GetPlayersInZone(zoneid, teamid)
{
new count;
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && GetPlayerTeam(i) == teamid && IsPlayerInZone(i, zoneid)) // 40904
{
count++;
}
}
return count;
}

40915
Quote:

stock GetPlayerZone(playerid)
{
for(new i=0; i < sizeof(ZoneInfo); i++)
{
if(IsPlayerInZone(playerid, i)) // 40915
{
return i;
}
}
return -1;
}



Help Me!!


Re: Gang Zone Wars - iamjems - 14.10.2016

can anyone help me format i.e. "East side ballas are trying to capture Los Santos Vagos' hood, they will own it in 5 minutes." ? Thanks


Re: Gang Zone Wars - Oxygenated - 30.04.2017

Thanks was Very Helpful to me