Please help! 4$ if you help me to fix it :(
#1

It actually works when im capture the A51 territory, but when I try to capture ALL the other territories It doesnt change of color :S


I followed the tutorial of the capturing gangs, but it didnt worked...
https://sampforum.blast.hk/showthread.php?tid=276352
pawn Код:
///////////////////////////////////
//GANG SYSTEM
//////////////////////////////////

#define TEAM_USA 1
#define TEAM_CHINA 2
#define TEAM_RUSSIA 3
#define TEAM_JAPAN 4
#define TEAM_IRAQ 5
#define RANDOM 6



enum eZone
{
    Float:zMinX,
    Float:zMinY,
    Float:zMaxX,
    Float:zMaxY,
    zTeam,
    nTerritorio[256]
}


new ZoneInfo[][eZone] = {

   
    {443.3192,2405.9543,113.3581,2609.3821,TEAM_USA,"Abandoned Airfield"},
    {87.0319,1792.8086,398.4910,2090.4434,TEAM_CHINA,"Area 51"},
    {96.5220,982.0222,-275.3398,1238.0272,TEAM_RUSSIA,"Base de Russia"},
    {996.3851,2474.0288,1165.1940,2289.9304,TEAM_JAPAN,"Hospital Spawn"},
    {939.9236,1965.6492,885.5828,2148.2776,TEAM_IRAQ,"Cerca de Hosp. Spawn"},


    {1122.0129,2848.9912,1421.4556,2724.5840,RANDOM,"Golf"}, //Random
    {2501.7556,2855.2573,2697.4221,2673.2646,RANDOM,"KACC"},
    {-1205.7124,2675.1367,-969.6779,2726.5439,RANDOM,"Presa LV"} //Random

   
};
new ZoneAttackTime[sizeof(ZoneInfo)];
stock GetTeamZoneColor(teamid)
{
    switch(teamid)
    {
        case TEAM_USA: return COLOR_BLUE;
        case TEAM_CHINA: return COLOR_RED;
        case TEAM_RUSSIA: return COLOR_GREEN;
        case TEAM_JAPAN: return COLOR_WHITE;
        case TEAM_IRAQ: return COLOR_YELLOW;
        case RANDOM: return COLOR_PINK;
    }
    return -1;
}
new ZoneID[sizeof(ZoneInfo)];
new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...};

#define MIN_MEMBERS_TO_START_WAR 1 // how many team members needed in a zone to start a war
#define TAKEOVER_TIME 4 // how many seconds needed to take over the zone
#define MIN_DEATHS_TO_START_WAR 0 // how many team members must be killed in a zone to start a war

new Teams[] = {
    TEAM_USA,
    TEAM_CHINA,
    TEAM_RUSSIA,
    TEAM_JAPAN,
    TEAM_IRAQ
};

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) && GetPlayerTeam(i) == teamid && IsPlayerInZone(i, zoneid))
        {
            count++;
        }
    }
    return count;
}
forward ZoneTimer();
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
                {
                    new string[64];
                    format(string,sizeof string,"%s captured the territory of %s!",GetPlayerTeam(i),ZoneInfo[i][zTeam]);
                    SendClientMessageToAll(0xFFFFFFAA,string);
                    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;

                new string[64];
                format(string,sizeof string,"%s failed capturing %s!",Teams,ZoneInfo[i][zTeam]);
                SendClientMessageToAll(0xFFFFFFAA,string);
               
               
            }
        }
        else // check if somebody is attacking
        {
            for(new t=0; t < sizeof(Teams); t++) // loop all teams
            {
                    new str[256];
                    format(str, sizeof str, "2)%i ..... %f %f %f %f %s", t, ZoneInfo[i][zMinX], ZoneInfo[i][zMinY], ZoneInfo[i][zMaxX], ZoneInfo[i][zMaxY], ZoneInfo[i][nTerritorio] );
                    SendClientMessageToAll(0x0,str);
                   
                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]));

                    format(str, sizeof str, "1) %f %f %f %f %s", ZoneInfo[i][zMinX], ZoneInfo[i][zMinY], ZoneInfo[i][zMaxX], ZoneInfo[i][zMaxY], ZoneInfo[i][nTerritorio] );
                    SendClientMessageToAll(0xFF,str);
                }
            }
        }
    }
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_JUMP))
    {
        new
            Float:x,
            Float:y,
            Float:z;
        GetPlayerPos(playerid, x, y, z);
        SetPlayerPos(playerid, x, y, z + 10.0);
    }
    return 1;
}
stock GetPlayerZone(playerid)
{
    for(new i=0; i < sizeof(ZoneInfo); i++)
    {
        if(IsPlayerInZone(playerid, i))
        {
            return i;
        }
    }
    return -1;
}

////////////////////////////////////////////////////////////////////////////////////////////////
//==============================================================================================
///////////////////////////////////////////////////////////////////////////////////////////////
Reply
#2

Hmm Can you explain more please... i don't understang what do you mean, the Flashing or the Captured zone color?
Reply
#3

Well, Lets say Im TEAM_USA, and A51 is currently captured by China, so I go and capture it, It works and it turns to blue, so if i want to capture the territory of TEAM_JAPAN, it wont work, it will just let me capture A51.
Reply
#4

pm me.
I could help you tomorrow, what is your time zone?
Reply
#5

your
Код:
new ZoneInfo[][eZone] = {
    {443.3192,2405.9543,113.3581,2609.3821,TEAM_USA,"Abandoned Airfield"},
    {87.0319,1792.8086,398.4910,2090.4434,TEAM_CHINA,"Area 51"},
    {96.5220,982.0222,-275.3398,1238.0272,TEAM_RUSSIA,"Base de Russia"},
    {996.3851,2474.0288,1165.1940,2289.9304,TEAM_JAPAN,"Hospital Spawn"},
    {939.9236,1965.6492,885.5828,2148.2776,TEAM_IRAQ,"Cerca de Hosp. Spawn"},

    {1122.0129,2848.9912,1421.4556,2724.5840,RANDOM,"Golf"}, //Random
    {2501.7556,2855.2573,2697.4221,2673.2646,RANDOM,"KACC"},
    {-1205.7124,2675.1367,-969.6779,2726.5439,RANDOM,"Presa LV"} //Random    
};
is defined wrong. to be more precise: the coordinates. its defined as XMin,YMin,XMax,YMax, but for example the first zone (abadonned airport, aka Verdant Meadows), is using the coordinates wrong:
Код:
443.3192,2405.9543 as Min,and 113.3581,2609.3821 as Max. 443.3
here, XMin is not smaller than XMax, you "painted" the zone in the wrong order. by swapping the XMin with XMax, they are in ascending order (rising up):
Код:
113.3581,2405.9543 as Min,and 443.3192,2609.3821
best way to save a zone, go to its bottom left corner (south west, or -x,-y), and go up right to north-east, where th X and Y coordinate are bigger. then you already got 2 valid coordinates to use..
Reply
#6

Didnnґt worked..... :/
Reply
#7

Pm sent !
Reply
#8

add me on msn will help you stuffboy92@hotmail.com
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)