Jump to content
Prosíme všetkých užívateľov, ktorý sa chcú opätovne pripojiť na discord aby znovu spárovali svoje účty kliknutím na "Discord" v navigácií a pripojili sa na server Read more... ×
  • 0
Mivčo

pomoc Gang Zona

Dotaz

Chlapci potrebujem jeden problem vyriešiť... mám gangy ktoré mi nechcú fungovať nejako 😕 neviem prečo a dopĺňam aj code,

Kode:

Spoiler

#include a_samp

#define MAX_GANGS 150

enum G_INFO
{
Float:Gang_X, Float:Gang_Y, Float:Gang_Xx, Float:Gang_Yy, GColor, GZona, GID, GFuck, GBordel, G10, G06
}

new ZonaVeci[MAX_GANGS][G_INFO];
new ZonaPridaj = 0;
new praca[MAX_PLAYERS]; //Job
new Vyplaty[MAX_PLAYERS];
new ZonaFarba[5] = {0x40FF00FF, 0xB700FFFF, 0x715E72FF};
new ZonaFunkce;

forward Float:AddZona(Float:minX, Float:minY, Float:maXX, Float:maXY, color, ID);
public Float:AddZona(Float:minX, Float:minY, Float:maXX, Float:maXY, color, ID)
{
    if(ZonaPridaj <= MAX_GANGS)
    {
        ZonaVeci[ZonaPridaj][GZona] = GangZoneCreate(minX, minY, maXX, maXY);
        ZonaVeci[ZonaPridaj][Gang_X] = minX;
        ZonaVeci[ZonaPridaj][Gang_Y] = minY;
        ZonaVeci[ZonaPridaj][Gang_Xx] = maXX;
        ZonaVeci[ZonaPridaj][Gang_Yy] = maXY;
        ZonaVeci[ZonaPridaj][GColor] = color;
        ZonaVeci[ZonaPridaj][GID] = ID;
        ZonaVeci[ZonaPridaj][GFuck] = 0;
        ZonaPridaj++;
    }
    else
    {
        printf("Kapacita gang zon byla prekrocena gang zona nebyla vytvorena");
    }
    return 0.0;
}

public OnFilterScriptInit()
{
    AddZona(1158.799749, 3300.656857, 1159.967977, 3298.716459, 0xF81414, 2);
    AddZona(1158.799749, 3302.694265, 1159.967977, 3300.656857, 0x715E72FF, 1);
    return 1;
}

public OnPlayerConnect(playerid)
{
    for(new axa = 0; axa < MAX_GANGS; axa++)
    {
        GangZoneShowForPlayer(playerid, ZonaVeci[axa][GZona], ZonaVeci[axa][GColor]);
    }
    return 1;
}

public OnPlayerDisconnect(playerid,reason)
{
    for(new xcxc = 0; xcxc < MAX_GANGS; xcxc++)
    {
        GangZoneHideForPlayer(playerid,ZonaVeci[xcxc][GZona]);
    }
}

stock ZbytocnaFunkcia(playerid, Float:XaX, Float:YaY, Float:ZaZ, Float:AaA)
{
    new Float:X = 0.0, Float:Y = 0.0, Float:Z = 0.0;
    GetPlayerPos(playerid, X, Y, Z);
    if(X > XaX && X < YaY && Y > ZaZ && Y < AaA)
    {
        return 1;
    }
    return 0;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerConnected(playerid))
    {
        if(newkeys == 4 || newkeys == 132)
        {
            if(praca[playerid] == 1 || praca[playerid] == 2 || praca[playerid] == 3 || praca[playerid] == 4)
            {
                if(!IsPlayerInAnyVehicle(playerid))
                {
                    if(GetPlayerWeapon(playerid))
                    {
                        new varujemta = 0;
                        while(++varujemta < MAX_GANGS)
                        {
                            if(ZbytocnaFunkcia(playerid, ZonaVeci[varujemta][Gang_X], ZonaVeci[varujemta][Gang_Xx], ZonaVeci[varujemta][Gang_Y], ZonaVeci[varujemta][Gang_Yy]))
                            {
                                ZonaVeci[varujemta][GBordel]++;
                                if(ZonaVeci[varujemta][GBordel] < 3)
                                {
                                    return 0;
                                }
                                ZonaVeci[varujemta][GBordel] = 0;
                                if(ZonaVeci[varujemta][GFuck])
                                {
                                    return 0;
                                }
                                if(ZonaVeci[varujemta][GID] == praca[playerid])
                                {
                                    SendClientMessage(playerid,-1, "Niečo jebnutého Teraz");
                                }
                                else if(ZonaVeci[praca[playerid]][G10])
                                {
                                    SendClientMessage(playerid,-1, "Niečo jebnutého Potom");
                                }
                                else
                                {
                                    GangZoneFlashForAll(ZonaVeci[varujemta][GZona], ZonaFarba[praca[playerid]]);
                                    ZonaVeci[varujemta][G06] = praca[playerid];
                                    ZonaVeci[praca[playerid]][G10] = 1;
                                    ZonaVeci[ZonaVeci[varujemta][GID]][G10] = 1;
                                    ZonaVeci[varujemta][GFuck] = 1;
                                    SetTimerEx("KonecBoje", 60000, false, "i", varujemta);
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return 1;
}
        
forward KonecBoje(playerid);
public KonecBoje(playerid)
{
    new varujemta = 0;
    for(new xcxc = 0; xcxc < MAX_GANGS; xcxc++)
    {
        if(IsPlayerConnected(xcxc))
        {
            if(praca[xcxc] == 1 || praca[xcxc] == 2 || praca[xcxc] == 3 || praca[xcxc] == 4)
            {
                if(praca[xcxc] == ZonaVeci[playerid][G06])
                {
                    ZonaVeci[praca[xcxc]][G10] = 0;
                    if(ZbytocnaFunkcia(xcxc, ZonaVeci[playerid][Gang_X], ZonaVeci[playerid][Gang_Xx], ZonaVeci[playerid][Gang_Y], ZonaVeci[playerid][Gang_Yy]))
                    {
                        varujemta++;
                        if(0 < varujemta)
                        {
                            ZonaVeci[ZonaVeci[playerid][G06]][G10] = 0;
                            ZonaVeci[ZonaVeci[playerid][GID]][G10] = 0;
                            ZonaVeci[playerid][GFuck] = 0;
                            GangZoneStopFlashForAll(ZonaVeci[playerid][GZona]);
                            GangZoneHideForAll(ZonaVeci[playerid][GZona]);
                            GangZoneShowForAll(ZonaVeci[playerid][GZona], ZonaFarba[praca[xcxc]]);
                            ZonaVeci[playerid][GColor] = ZonaFarba[praca[xcxc]];
                            ZonaVeci[playerid][GID] = praca[xcxc];
                            ZonaVeci[playerid][G06] = 0;
                            new var2[128];
                            Vyplaty[xcxc]++;
                            Vyplaty[xcxc] = Vyplaty[xcxc];
                            format(var2, 128, "~r~odmena~n~~w~%d$", 46488);
                            GameTextForPlayer(xcxc, var2, 4000, 4);
                            ZonaFunkce = ZonaFunkce - ZonaFunkce;
                        }
                    }
                }
            }
        }
    }
    if(!varujemta)
    {
        ZonaVeci[playerid][GFuck] = 0;
        ZonaVeci[ZonaVeci[playerid][G06]][G10] = 0;
        ZonaVeci[ZonaVeci[playerid][GID]][G10] = 0;
        GangZoneStopFlashForAll(ZonaVeci[playerid][GZona]);
    }
    return 1;
}

 

Edited by Mivčo

Sdílet tento příspěvek


Link to post
Share on other sites

5 odpovědí na tuto otázku

Recommended Posts

  • 0

Nelúštil som to úplne do detailov, pretože tie názvy premenných sú fakt mätúce.. Musel som si otvoriť deamxnutú rze, aby som videl, aká premenná má akú úlohu 😄 

Nastavuješ niekde hodnotu prvkov poľa praca?

Edited by DuFF

Sdílet tento příspěvek


Link to post
Share on other sites
  • 0

nenastavujem nič 😄 ta práca je joob 😄 ale zohnal som si niečo iné a porobil som to tak že mi ukazuje farby, mám všetky gangy biele 😄 a ked chcem bojovať tak nezačne blikat nič sa nedeje 😕

Moje:

#define FILTERSCRIPT

#include <a_samp>

#undef     MAX_PLAYERS
#define MAX_PLAYERS                 (200)
#define MAX_GANGS                    200
#include <gangzonesc>

#define TURF_STATE_NORMAL             (0)
#define TURF_STATE_ATTACKED         (1)
#define TURF_STATE_PROVOKED         (2)

#define TURF_REQUIRED_KILLS         (3)
#define TURF_REQUIRED_PLAYERS       (1)
#define TURF_REQUIRED_CAPTURETIME   (2 * 60 * 1000)
#define TURF_REQUIRED_PROVOKETIME   (10 * 1000)

#define COLOR_GREEN                    (0x00CC00FF)

enum P_INFO
{
Job
};

new PlayerInfo[MAX_PLAYERS][P_INFO];

enum e_TEAM
{
    teamName[35],
    teamColor
};

enum e_TURF
{
    turfName[35],
    turfOwner,
    turfAttacker,
    Float:turfPos[4],
    turfOwnerKills,
    turfAttackerKills,
    turfState,
    turfTimer,
    turfId
};

new g_Team[MAX_PLAYERS][e_TEAM];
new g_Turf[MAX_PLAYERS][e_TURF];
new g_MembersInTurf[sizeof(g_Turf)][sizeof(g_Team)], PlayerText: g_PlayerTurfTxt[MAX_PLAYERS][3], PlayerText: g_PlayerTurfNotifyTxt[MAX_PLAYERS][4], g_PlayerTurfNotifyTimer[MAX_PLAYERS][4];
new ZonaPridaj = 0;

forward Float:AddZona(Float:minX, Float:minY, Float:maXX, Float:maXY, color, ID);
public Float:AddZona(Float:minX, Float:minY, Float:maXX, Float:maXY, color, ID)
{
    if(ZonaPridaj <= MAX_GANGS)
    {
        g_Turf[ZonaPridaj][turfId] = GangZoneCreate(minX, minY, maXX, maXY);
        g_Turf[ZonaPridaj][turfPos][0] = minX;
        g_Turf[ZonaPridaj][turfPos][1] = minY;
        g_Turf[ZonaPridaj][turfPos][2] = maXX;
        g_Turf[ZonaPridaj][turfPos][3] = maXY;
        g_Team[g_Turf[ZonaPridaj][turfOwner]][teamColor] = color;
        g_Turf[ZonaPridaj][turfAttacker] = ID;
        ZonaPridaj++;
    }
    else
    {
        printf("Kapacita gang zon byla prekrocena gang zona nebyla vytvorena");
    }
    return 0.0;
}

public OnFilterScriptInit()
{
    AddZona(2317, 48.5, 2417, 148.5, 11152298, 10);
    AddZona(139, -37.5, 224, 32.5, 11152298, 10);
    AddZona(224, -156.5, 261, -18.5, 11152298, 10);
    AddZona(324, -209.5, 379, -102.5, 11152298, 10);
    AddZona(2190, -1631.5, 2442, -1530.5, 11152298, 10);
    AddZona(2441, -1624.5, 2630, -1524.5, 11152298, 10);
    AddZona(2441, -1724.5, 2544, -1624.5, 11152298, 10);
    AddZona(2253, -1724.5, 2441, -1630.5, 11152298, 10);
    AddZona(2544, -1817.5, 2635, -1624.5, 11152298, 10);
    AddZona(2467, -1837.5, 2544, -1724.5, 11152298, 10);
    AddZona(2367, -1824.5, 2467, -1724.5, 11152298, 10);
    AddZona(2267, -1822.5, 2367, -1722.5, 11152298, 10);
    AddZona(2190, -1821.5, 2253, -1630.5, 11152298, 10);
    AddZona(2544, -2041.5, 2677, -1817.5, 11152298, 10);
    AddZona(2677, -2055.5, 2875, -1860.5, 11152298, 10);
    AddZona(2190, -1976.5, 2317, -1821.5, 11152298, 10);
    AddZona(2317, -1917.5, 2467, -1824.5, 11152298, 10);
    AddZona(2467, -1954.5, 2545, -1837.5, 11152298, 10);
    AddZona(2190, -2040.5, 2544, -1976.5, 11152298, 10);
    AddZona(2317, -1976.5, 2467, -1917.5, 11152298, 10);
    AddZona(2467, -1977.5, 2544, -1954.5, 11152298, 10);
    //== Vagos
    AddZona(2317, -51.5, 2417, 48.5, 2147549098, 11);
    AddZona(55, -284.5, 185, -152.5, 2147549098, 11);
    AddZona(2277, -1530.5, 2377, -1430.5, 2147549098, 11);
    AddZona(2277, -1431.5, 2373, -1214.5, 2147549098, 11);
    AddZona(2277, -1213.5, 2370, -1037.5, 2147549098, 11);
    AddZona(2370, -1129.5, 2827, -1037.5, 2147549098, 11);
    AddZona(2370, -1213.5, 2515, -1129.5, 2147549098, 11);
    AddZona(2373, -1428.5, 2502, -1213.5, 2147549098, 11);
    AddZona(2515, -1213.5, 2728, -1129.5, 2147549098, 11);
    AddZona(2502, -1429.5, 2636, -1213.5, 2147549098, 11);
    AddZona(2377, -1523.5, 2636, -1428.5, 2147549098, 11);
    AddZona(2636, -1336.5, 2730, -1213.5, 2147549098, 11);
    AddZona(2636, -1518.5, 2731, -1336.5, 2147549098, 11);
    AddZona(2727, -1282.5, 2915, -1129.5, 2147549098, 11);
    AddZona(2731, -1517.5, 2940, -1282.5, 2147549098, 11);
    AddZona(2630, -1624.5, 2939, -1518.5, 2147549098, 11);
    //== Tuning Gang
    AddZona(1318, 284.5, 1422, 376.5, 0xFF7F00FF, 24);
    AddZona(1218, 276.5, 1318, 376.5, 0xFF7F00FF, 24);
    AddZona(1318, 176.5, 1423, 284.5, 0xFF7F00FF, 24);
    AddZona(1218, 176.5, 1318, 276.5, 0xFF7F00FF, 24);
    AddZona(1187, 178.5, 1221, 376.5, 0xFF7F00FF, 24);
    AddZona(2261, 19.5, 2361, 119.5, 0xFF7F00FF, 24);
    AddZona(324, -102.5, 379, 32.5, 0xFF7F00FF, 24);
    AddZona(224, -18.5, 324, 32.5, 0xFF7F00FF, 24);
    AddZona(261, -157.5, 324, -18.5, 0xFF7F00FF, 24);

    //== Gang Ballas:
    AddZona(2417, 0.5, 2517, 100.5, 4042260650, 25);
    AddZona(139, -78.5, 223, -37.5, 4042260650, 25);
    AddZona(139, -152.5, 224, -78.5, 4042260650, 25);
    AddZona(225, -202.5, 324, -152.5, 4042260650, 25);
    AddZona(2090, -1730.5, 2190, -1630.5, 4042260650, 25);
    AddZona(2090, -1630.5, 2190, -1530.5, 4042260650, 25);
    AddZona(2019, -1730.5, 2090, -1530.5, 4042260650, 25);
    AddZona(1919, -1730.5, 2020, -1530.5, 4042260650, 25);
    AddZona(1831, -1729.5, 1920, -1541.5, 4042260650, 25);
    AddZona(1856, -1263.5, 2065, -1137.5, 4042260650, 25);
    AddZona(1856, -1139.5, 2066, -1037.5, 4042260650, 25);
    AddZona(2065, -1262.5, 2169, -1037.5, 4042260650, 25);
    AddZona(1856, -1363.5, 1956, -1263.5, 4042260650, 25);
    AddZona(1956, -1324.5, 2168, -1263.5, 4042260650, 25);
    AddZona(2169, -1314.5, 2277, -1037.5, 4042260650, 25);
    AddZona(1856, -1037.5, 2277, -969.5, 4042260650, 25);
    AddZona(2168, -1531.5, 2277, -1314.5, 4042260650, 25);
    AddZona(2068, -1532.5, 2169, -1324.5, 4042260650, 25);
    AddZona(1856, -1532.5, 1959, -1363.5, 4042260650, 25);
    AddZona(1831, -1541.5, 1917, -1531.5, 4042260650, 25);

    //== Gang Los Aztecas
    AddZona(2217, -51.5, 2317, 48.5, 16777130, 26);
    AddZona(185, -219.5, 224, -152.5, 16777130, 26);
    AddZona(224, -238.5, 324, -202.5, 16777130, 26);
    AddZona(1831, -1831.5, 2020, -1729.5, 16777130, 26);
    AddZona(2019, -1844.5, 2189, -1730.5, 16777130, 26);
    AddZona(2092, -2039.5, 2190, -1844.5, 16777130, 26);
    AddZona(2019, -2012.5, 2092, -1844.5, 16777130, 26);
    AddZona(1831, -1911.5, 2019, -1831.5, 16777130, 26);
    AddZona(1831, -2060.5, 1896, -1911.5, 16777130, 26);
    AddZona(1896, -2060.5, 2018, -1911.5, 16777130, 26);
    AddZona(1677, -1958.5, 1831, -1861.5, 16777130, 26);
    AddZona(1677, -2084.5, 1831, -1958.5, 16777130, 26);
    AddZona(1831, -2160.5, 1931, -2060.5, 16777130, 26);
    AddZona(1632, -2161.5, 1831, -2084.5, 16777130, 26);
    AddZona(2018, -2060.5, 2092, -2012.5, 16777130, 26);
    AddZona(1931, -2160.5, 2119, -2060.5, 16777130, 26);
    AddZona(2119, -2160.5, 2258, -2038.5, 16777130, 26);
    return 1;
}

public OnFilterScriptExit() {
    for (new i, j = sizeof(g_Turf); i < j; i++) {
        GangZoneDestroy(g_Turf[turfId]);
        
        if (g_Turf[turfTimer] != -1) {
            KillTimer(g_Turf[turfTimer]);
        }
        g_Turf[turfTimer] = -1;
    }
    
    return 1;
}

public OnPlayerConnect(playerid) {
    g_PlayerTurfTxt[playerid][0] = CreatePlayerTextDraw(playerid,317.000000, 378.000000, "Turfwar in ~b~~h~~h~~h~Gangton");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfTxt[playerid][0], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfTxt[playerid][0], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfTxt[playerid][0], 2);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfTxt[playerid][0], 0.240000, 1.200000);
    PlayerTextDrawColor(playerid,g_PlayerTurfTxt[playerid][0], -1);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfTxt[playerid][0], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfTxt[playerid][0], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfTxt[playerid][0], 0);

    g_PlayerTurfTxt[playerid][1] = CreatePlayerTextDraw(playerid,317.000000, 389.000000, "Grove~w~~h~: ~r~13 ~w~~h~kills with ~r~4 ~w~~h~players");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfTxt[playerid][1], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfTxt[playerid][1], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfTxt[playerid][1], 2);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfTxt[playerid][1], 0.180000, 0.899999);
    PlayerTextDrawColor(playerid,g_PlayerTurfTxt[playerid][1], 16711935);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfTxt[playerid][1], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfTxt[playerid][1], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfTxt[playerid][1], 0);

    g_PlayerTurfTxt[playerid][2] = CreatePlayerTextDraw(playerid,317.000000, 397.000000, "Aztecas~w~~h~: ~r~16 ~w~~h~kills with ~r~7 ~w~~h~players");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfTxt[playerid][2], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfTxt[playerid][2], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfTxt[playerid][2], 2);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfTxt[playerid][2], 0.180000, 0.899999);
    PlayerTextDrawColor(playerid,g_PlayerTurfTxt[playerid][2], 16777215);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfTxt[playerid][2], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfTxt[playerid][2], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfTxt[playerid][2], 0);

    g_PlayerTurfNotifyTxt[playerid][0] = CreatePlayerTextDraw(playerid,317.000000, 348.000000, "~g~We have won the turfwar against the ~b~~h~~h~~h~Grove ~g~in ~b~~h~~h~~h~Gangton ~g~(/turfs)");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfNotifyTxt[playerid][0], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfNotifyTxt[playerid][0], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfNotifyTxt[playerid][0], 1);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfNotifyTxt[playerid][0], 0.180000, 0.799999);
    PlayerTextDrawColor(playerid,g_PlayerTurfNotifyTxt[playerid][0], -1);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfNotifyTxt[playerid][0], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfNotifyTxt[playerid][0], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfNotifyTxt[playerid][0], 0);

    g_PlayerTurfNotifyTxt[playerid][1] = CreatePlayerTextDraw(playerid,317.000000, 355.000000, "~r~We have lost the turfwar against the ~b~~h~~h~~h~Azetecas ~r~in ~b~~h~~h~~h~LS. Beach ~r~(/turfs)");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfNotifyTxt[playerid][1], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfNotifyTxt[playerid][1], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfNotifyTxt[playerid][1], 1);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfNotifyTxt[playerid][1], 0.180000, 0.799999);
    PlayerTextDrawColor(playerid,g_PlayerTurfNotifyTxt[playerid][1], -1);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfNotifyTxt[playerid][1], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfNotifyTxt[playerid][1], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfNotifyTxt[playerid][1], 0);

    g_PlayerTurfNotifyTxt[playerid][2] = CreatePlayerTextDraw(playerid,317.000000, 362.000000, "~y~We have provoked a turfwar again ~b~~h~~h~~h~Vagos ~y~in ~b~~h~~h~~h~Blueberry ~y~(/findwar)");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfNotifyTxt[playerid][2], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfNotifyTxt[playerid][2], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfNotifyTxt[playerid][2], 1);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfNotifyTxt[playerid][2], 0.180000, 0.799999);
    PlayerTextDrawColor(playerid,g_PlayerTurfNotifyTxt[playerid][2], -1);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfNotifyTxt[playerid][2], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfNotifyTxt[playerid][2], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfNotifyTxt[playerid][2], 0);

    g_PlayerTurfNotifyTxt[playerid][3] = CreatePlayerTextDraw(playerid,317.000000, 369.000000, "~y~We have got a turfwar again ~b~~h~~h~~h~Vagos ~y~in ~b~~h~~h~~h~Blueberry ~y~(/findwar)");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfNotifyTxt[playerid][3], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfNotifyTxt[playerid][3], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfNotifyTxt[playerid][3], 1);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfNotifyTxt[playerid][3], 0.180000, 0.799999);
    PlayerTextDrawColor(playerid,g_PlayerTurfNotifyTxt[playerid][3], -1);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfNotifyTxt[playerid][3], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfNotifyTxt[playerid][3], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfNotifyTxt[playerid][3], 0);
    
    ShowAllGangZonesForPlayer(playerid);
    
    return 1;
}

public OnPlayerSpawn(playerid) {
    for (new i, j = sizeof(g_Turf); i < j; i++) {
        if (g_Turf[turfState] == TURF_STATE_ATTACKED) {
            GangZoneFlashForPlayer(playerid, g_Turf[turfId], g_Team[g_Turf[ZonaPridaj][turfOwner]][teamColor]);
        }
    }

    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][0]);
    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][1]);
    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][2]);

    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][0]);
    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][1]);
    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][2]);
    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][3]);
    
    return 1;
}

public OnPlayerRequestClass(playerid, classid) {
    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][0]);
    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][1]);
    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][2]);

    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][0]);
    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][1]);
    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][2]);
    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][3]);
    
    return 1;
}

NotifyTeam(team, type, text[]) {
    for (new i, j = GetPlayerPoolSize(); i <= j; i++) {
        if (IsPlayerConnected(i) && GetPlayerState(i) != PLAYER_STATE_WASTED && GetPlayerTeam(i) == team) {
            if (g_PlayerTurfNotifyTimer[type] != -1) {
                KillTimer(g_PlayerTurfNotifyTimer[type]);
            }
            g_PlayerTurfNotifyTimer[type] = SetTimerEx("OnTeamNotified", 5000, false, "ii", team, type);
            
            PlayerTextDrawSetString(i, g_PlayerTurfNotifyTxt[type], text);
            PlayerTextDrawShow(i, g_PlayerTurfNotifyTxt[type]);
        }
    }
}

forward OnTeamNotified(team, type);
public  OnTeamNotified(team, type) {
    for (new i, j = GetPlayerPoolSize(); i <= j; i++) {
        if (IsPlayerConnected(i) && GetPlayerTeam(i) == team) {
            g_PlayerTurfNotifyTimer[type] = -1;

            PlayerTextDrawHide(i, g_PlayerTurfNotifyTxt[type]);
        }
    }
}

public OnPlayerDeath(playerid, killerid, reason) {
    if (killerid != INVALID_PLAYER_ID) {
        if (0 <= GetPlayerTeam(playerid) < sizeof(g_Team) && 0 <= GetPlayerTeam(killerid) < sizeof(g_Team)) {
            for (new i, j = sizeof(g_Turf); i < j; i++) {
                if (IsPlayerInGangZone(playerid, g_Turf[turfId])) {
                    if (g_Turf[turfState] == TURF_STATE_NORMAL) {
                        if (GetPlayerTeam(killerid) != g_Turf[turfOwner]) {
                            g_Turf[turfAttackerKills]++;
                            
                            if (g_Turf[turfAttackerKills] >= TURF_REQUIRED_KILLS) {
                                g_Turf[turfState] = TURF_STATE_ATTACKED;
                                g_Turf[turfAttacker] = GetPlayerTeam(killerid);
                                g_Turf[turfTimer] = SetTimerEx("OnTurfwarEnd", TURF_REQUIRED_CAPTURETIME, false, "i", i);
                                
                                GangZoneFlashForAll(g_Turf[turfId], g_Team[g_Turf[ZonaPridaj][turfOwner]][teamColor]);
                                
                                for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                                    if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                        new
                                            szBuffer[156]
                                        ;
                                        strcat(szBuffer, "Turfwar in ~b~~h~~h~~h~");
                                        strcat(szBuffer, g_Turf[turfName]);
                                        PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][0], szBuffer);
                                        PlayerTextDrawShow(p, g_PlayerTurfTxt[p][0]);
                                        
                                        format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfOwner]][teamName], g_Turf[turfOwnerKills], g_MembersInTurf[g_Turf[turfOwner]]);
                                        PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
                                        PlayerTextDrawColor(p, g_PlayerTurfTxt[p][1], g_Team[g_Turf[turfOwner]][teamColor]);
                                        PlayerTextDrawShow(p, g_PlayerTurfTxt[p][1]);

                                        format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfAttacker]][teamName], g_Turf[turfAttackerKills], g_MembersInTurf[g_Turf[turfAttacker]]);
                                        PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][2], szBuffer);
                                        PlayerTextDrawColor(p, g_PlayerTurfTxt[p][2], g_Team[g_Turf[turfAttacker]][teamColor]);
                                        PlayerTextDrawShow(p, g_PlayerTurfTxt[p][2]);
                                    }
                                }
                                
                                new
                                    szText[156]
                                ;
                                strcat(szText, "~y~We have provoked a turfwar against ~b~~h~~h~~h~");
                                strcat(szText, g_Team[g_Turf[turfOwner]][teamName]);
                                strcat(szText, " ~y~in ~b~~h~~h~~h~");
                                strcat(szText, g_Turf[turfName]);
                                strcat(szText, " ~y~(/findwar)");
                                NotifyTeam(g_Turf[turfAttacker], 2, szText);
                                
                                szText[0] = EOS;
                                strcat(szText, "~y~We have been attacked by ~b~~h~~h~~h~");
                                strcat(szText, g_Team[g_Turf[turfAttacker]][teamName]);
                                strcat(szText, " ~y~in ~b~~h~~h~~h~");
                                strcat(szText, g_Turf[turfName]);
                                strcat(szText, " ~y~(/findwar)");
                                NotifyTeam(g_Turf[turfOwner], 3, szText);
                            }
                        }
                    }
                    else if (g_Turf[turfState] == TURF_STATE_ATTACKED) {
                        if (GetPlayerTeam(killerid) == g_Turf[turfOwner]) {
                            g_Turf[turfOwnerKills]++;

                            for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                                if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                    new
                                         szBuffer[156]
                                    ;
                                    format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfOwner]][teamName], g_Turf[turfOwnerKills], g_MembersInTurf[g_Turf[turfOwner]]);
                                    PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
                                    PlayerTextDrawColor(p, g_PlayerTurfTxt[p][1], g_Team[g_Turf[turfOwner]][teamColor]);
                                }
                            }
                        }
                        else if (GetPlayerTeam(killerid) == g_Turf[turfAttacker]) {
                            g_Turf[turfAttackerKills]++;

                            for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                                if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                    new
                                         szBuffer[156]
                                    ;
                                    format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfAttacker]][teamName], g_Turf[turfAttackerKills], g_MembersInTurf[g_Turf[turfAttacker]]);
                                    PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][2], szBuffer);
                                    PlayerTextDrawColor(p, g_PlayerTurfTxt[p][2], g_Team[g_Turf[turfAttacker]][teamColor]);
                                }
                            }
                        }
                    }

                    return 1;
                }
            }
        }
    }

    return 1;
}

public OnPlayerEnterGangZone(playerid, zone) {
    if (0 <= GetPlayerTeam(playerid) < sizeof(g_Team) && GetPlayerState(playerid) != PLAYER_STATE_WASTED && ! GetPlayerInterior(playerid) && ! GetPlayerVirtualWorld(playerid)) {
        for (new i, j = sizeof(g_Turf); i < j; i++) {
            if (zone == g_Turf[turfId]) {
                new
                      szTurfText[156]
                ;
                strcat(szTurfText, "~y~~h~");
                strcat(szTurfText, g_Team[g_Turf[turfOwner]][teamName]);
                strcat(szTurfText, "'s ");
                strcat(szTurfText, g_Turf[turfName]);
                GameTextForPlayer(playerid, szTurfText, 3000, 1);
                    
                g_MembersInTurf[GetPlayerTeam(playerid)]++;
                
                if (GetPlayerTeam(playerid) != g_Turf[turfOwner]) {
                    if (g_Turf[turfState] == TURF_STATE_NORMAL) {
                        if (g_MembersInTurf[GetPlayerTeam(playerid)] >= TURF_REQUIRED_PLAYERS) {
                            g_Turf[turfState] = TURF_STATE_PROVOKED;
                            g_Turf[turfAttacker] = GetPlayerTeam(playerid);
                            g_Turf[turfTimer] = SetTimerEx("OnTurfwarProvoked", TURF_REQUIRED_PROVOKETIME, false, "i", i);

                            return 1;
                        }
                    }
                }
                else if (g_Turf[turfState] == TURF_STATE_ATTACKED) {
                    new
                           szBuffer[156]
                    ;
                    strcat(szBuffer, "Turfwar in ~b~~h~~h~~h~");
                    strcat(szBuffer, g_Turf[turfName]);
                    PlayerTextDrawSetString(playerid, g_PlayerTurfTxt[playerid][0], szBuffer);
                    PlayerTextDrawShow(playerid, g_PlayerTurfTxt[0]);

                    PlayerTextDrawColor(playerid, g_PlayerTurfTxt[playerid][1], g_Team[g_Turf[turfOwner]][teamColor]);
                    PlayerTextDrawShow(playerid, g_PlayerTurfTxt[1]);

                    PlayerTextDrawColor(playerid, g_PlayerTurfTxt[playerid][2], g_Team[g_Turf[turfAttacker]][teamColor]);
                    PlayerTextDrawShow(playerid, g_PlayerTurfTxt[2]);
                    
                    if (GetPlayerTeam(playerid) == g_Turf[turfOwner]) {
                        for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                            if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfOwner]][teamName], g_Turf[turfOwnerKills], g_MembersInTurf[g_Turf[turfOwner]]);
                                PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
                            }
                        }
                    }
                    else if (GetPlayerTeam(playerid) == g_Turf[turfAttacker]) {
                        for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                            if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfOwner]][teamName], g_Turf[turfOwnerKills], g_MembersInTurf[g_Turf[turfOwner]]);
                                PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
                            }
                        }
                    }
                }

                return 1;
            }
        }
    }
    
    return 1;
}

forward OnTurfwarProvoked(turfid);
public  OnTurfwarProvoked(turfid) {
    g_Turf[turfid][turfState] = TURF_STATE_ATTACKED;
    g_Turf[turfid][turfTimer] = SetTimerEx("OnTurfwarEnd", TURF_REQUIRED_CAPTURETIME, false, "i", turfid);

    new
        szText[156]
    ;
    strcat(szText, "~y~We have provoked a turfwar against ~b~~h~~h~~h~");
    strcat(szText, g_Team[g_Turf[turfid][turfOwner]][teamName]);
    strcat(szText, " ~y~in ~b~~h~~h~~h~");
    strcat(szText, g_Turf[turfid][turfName]);
    strcat(szText, " ~y~(/findwar)");
    NotifyTeam(g_Turf[turfid][turfAttacker], 2, szText);

    szText[0] = EOS;
    strcat(szText, "~y~We have been attacked by ~b~~h~~h~~h~");
    strcat(szText, g_Team[g_Turf[turfid][turfAttacker]][teamName]);
    strcat(szText, " ~y~in ~b~~h~~h~~h~");
    strcat(szText, g_Turf[turfid][turfName]);
    strcat(szText, " ~y~(/findwar)");
    NotifyTeam(g_Turf[turfid][turfOwner], 3, szText);

    GangZoneFlashForAll(g_Turf[turfid][turfId], g_Team[g_Turf[ZonaPridaj][turfOwner]][teamColor]);
    
    for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
         if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfid][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
            new
                   szBuffer[156]
            ;
            strcat(szBuffer, "Turfwar in ~b~~h~~h~~h~");
            strcat(szBuffer, g_Turf[turfid][turfName]);
            PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][0], szBuffer);
            PlayerTextDrawShow(p, g_PlayerTurfTxt[p][0]);

            format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfid][turfOwner]][teamName], g_Turf[turfid][turfOwnerKills], g_MembersInTurf[turfid][g_Turf[turfid][turfOwner]]);
            PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
            PlayerTextDrawColor(p, g_PlayerTurfTxt[p][1], g_Team[g_Turf[turfid][turfOwner]][teamColor]);
            PlayerTextDrawShow(p, g_PlayerTurfTxt[p][1]);

            format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfid][turfAttacker]][teamName], g_Turf[turfid][turfAttackerKills], g_MembersInTurf[turfid][g_Turf[turfid][turfAttacker]]);
            PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][2], szBuffer);
               PlayerTextDrawColor(p, g_PlayerTurfTxt[p][2], g_Team[g_Turf[turfid][turfAttacker]][teamColor]);
            PlayerTextDrawShow(p, g_PlayerTurfTxt[p][2]);
           }
    }
}

forward OnTurfwarEnd(turfid);
public  OnTurfwarEnd(turfid) {
    g_Turf[turfid][turfTimer] = -1;
    
    new
        iScores[2],
        szText[156]
    ;
    iScores[0] = g_Turf[turfid][turfOwnerKills] + g_MembersInTurf[turfid][g_Turf[turfid][turfOwner]];
    iScores[1] = g_Turf[turfid][turfAttackerKills] + g_MembersInTurf[turfid][g_Turf[turfid][turfAttacker]];
    if (iScores[0] < iScores[1]) {
        strcat(szText, "~y~We have won the turfwar against ~b~~h~~h~~h~");
        strcat(szText, g_Team[g_Turf[turfid][turfOwner]][teamName]);
        strcat(szText, " ~y~in ~b~~h~~h~~h~");
        strcat(szText, g_Turf[turfid][turfName]);
        strcat(szText, " ~y~(/turfs)");
        NotifyTeam(g_Turf[turfid][turfAttacker], 1, szText);

        szText[0] = EOS;
        strcat(szText, "~y~We have lost the turfwar against ~b~~h~~h~~h~");
        strcat(szText, g_Team[g_Turf[turfid][turfAttacker]][teamName]);
        strcat(szText, " ~y~in ~b~~h~~h~~h~");
        strcat(szText, g_Turf[turfid][turfName]);
        strcat(szText, " ~y~(/turfs)");
        NotifyTeam(g_Turf[turfid][turfOwner], 0, szText);
        
        format(szText, sizeof(szText), "* The last turf scores for \"%s\" were: %s - %i, %s - %i.", g_Turf[turfid][turfName], g_Team[g_Turf[turfid][turfOwner]][teamName], iScores[0], g_Team[g_Turf[turfid][turfAttacker]][teamName], iScores[1]);
        for (new i, j = sizeof(g_Team); i < j; i++) {
            if (GetPlayerTeam(i) == g_Turf[turfid][turfOwner]) {
                SendClientMessage(i, COLOR_GREEN, szText);
            }
            else if (GetPlayerTeam(i) == g_Turf[turfid][turfAttacker]) {
                GivePlayerMoney(i, 7000);
                SetPlayerScore(i, GetPlayerScore(i) + 5);
                
                SendClientMessage(i, COLOR_GREEN, "Your team showed the opponenet team! [+$7000, +5 score]");
                SendClientMessage(i, COLOR_GREEN, szText);
            }
         }

        g_Turf[turfid][turfOwner] = g_Turf[turfid][turfAttacker];
    }
    else {
        strcat(szText, "~y~We have won the turfwar against ~b~~h~~h~~h~");
        strcat(szText, g_Team[g_Turf[turfid][turfAttacker]][teamName]);
        strcat(szText, " ~y~in ~b~~h~~h~~h~");
        strcat(szText, g_Turf[turfid][turfName]);
        strcat(szText, " ~y~(/turfs)");
        NotifyTeam(g_Turf[turfid][turfOwner], 1, szText);

        szText[0] = EOS;
        strcat(szText, "~y~We have lost the turfwar against ~b~~h~~h~~h~");
        strcat(szText, g_Team[g_Turf[turfid][turfOwner]][teamName]);
        strcat(szText, " ~y~in ~b~~h~~h~~h~");
        strcat(szText, g_Turf[turfid][turfName]);
        strcat(szText, " ~y~(/turfs)");
        NotifyTeam(g_Turf[turfid][turfAttacker], 0, szText);
        
        format(szText, sizeof(szText), "* The last turf scores for \"%s\" were: %s - %i, %s - %i.", g_Turf[turfid][turfName], g_Team[g_Turf[turfid][turfOwner]][teamName], iScores[0], g_Team[g_Turf[turfid][turfAttacker]][teamName], iScores[1]);
        for (new i, j = sizeof(g_Team); i < j; i++) {
            if (GetPlayerTeam(i) == g_Turf[turfid][turfOwner]) {
                GivePlayerMoney(i, 7000);
                SetPlayerScore(i, GetPlayerScore(i) + 5);
                
                SendClientMessage(i, COLOR_GREEN, "Your team showed the opponenet team! [+$7000, +5 score]");
                SendClientMessage(i, COLOR_GREEN, szText);
            }
            else if (GetPlayerTeam(i) == g_Turf[turfid][turfAttacker]) {
                SendClientMessage(i, COLOR_GREEN, szText);
            }
         }
    }

    g_Turf[turfid][turfState] = TURF_STATE_NORMAL;
    
    g_Turf[turfid][turfAttacker] = PlayerInfo[turfid][Job];

    g_Turf[turfid][turfAttackerKills] = 0;
    g_Turf[turfid][turfOwnerKills] = 0;
    
    GangZoneStopFlashForAll(g_Turf[turfid][turfId]);
    GangZoneShowForAll(g_Turf[turfid][turfId], g_Team[g_Turf[ZonaPridaj][turfOwner]][teamColor]);
    
    for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
         if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfid][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
            PlayerTextDrawHide(p, g_PlayerTurfTxt[p][0]);

            PlayerTextDrawHide(p, g_PlayerTurfTxt[p][1]);

            PlayerTextDrawHide(p, g_PlayerTurfTxt[p][2]);
           }
    }
}

public OnPlayerLeaveGangZone(playerid, zone) {
    if (0 <= GetPlayerTeam(playerid) < sizeof(g_Team)) {
        for (new i, j = sizeof(g_Turf); i < j; i++) {
            if (zone == g_Turf[turfId]) {
                g_MembersInTurf[GetPlayerTeam(playerid)]--;
                
                if (g_Turf[turfState] == TURF_STATE_PROVOKED) {
                    if (g_MembersInTurf[GetPlayerTeam(playerid)] < TURF_REQUIRED_PLAYERS) {
                        g_Turf[turfState] = TURF_STATE_NORMAL;
                        g_Turf[turfAttacker] = PlayerInfo[Job];
                        KillTimer(g_Turf[turfTimer]);
                        g_Turf[turfTimer] = -1;

                        return 1;
                    }
                }
                else if (g_Turf[turfState] == TURF_STATE_ATTACKED) {
                    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][0]);

                    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][1]);

                    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][2]);
                
                    if (g_MembersInTurf[GetPlayerTeam(playerid)] < TURF_REQUIRED_PLAYERS) {
                        OnTurfwarEnd(i);
                        
                        KillTimer(g_Turf[turfTimer]);
                        g_Turf[turfTimer] = -1;

                        g_Turf[turfState] = TURF_STATE_NORMAL;

                        g_Turf[turfAttacker] = PlayerInfo[Job];

                        g_Turf[turfAttackerKills] = 0;
                        g_Turf[turfOwnerKills] = 0;

                        GangZoneStopFlashForAll(g_Turf[turfId]);
                        GangZoneShowForAll(g_Turf[turfId], g_Team[g_Turf[ZonaPridaj][turfOwner]][teamColor]);

                        for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                            if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId])) {
                                PlayerTextDrawHide(p, g_PlayerTurfTxt[p][0]);

                                PlayerTextDrawHide(p, g_PlayerTurfTxt[p][1]);

                                PlayerTextDrawHide(p, g_PlayerTurfTxt[p][2]);
                            }
                        }

                        return 1;
                    }
                    else {
                        if (GetPlayerTeam(playerid) == g_Turf[turfOwner]) {
                            for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                                if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                    new
                                        szBuffer[156]
                                    ;
                                    format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfOwner]][teamName], g_Turf[turfOwnerKills], g_MembersInTurf[g_Turf[turfOwner]]);
                                    PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
                                       PlayerTextDrawColor(p, g_PlayerTurfTxt[p][1], g_Team[g_Turf[turfOwner]][teamColor]);
                                }
                            }
                        }
                        else if (GetPlayerTeam(playerid) == g_Turf[turfAttacker]) {
                            for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                                if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                    new
                                        szBuffer[156]
                                    ;
                                    format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfOwner]][teamName], g_Turf[turfOwnerKills], g_MembersInTurf[g_Turf[turfOwner]]);
                                    PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][2], szBuffer);
                                       PlayerTextDrawColor(p, g_PlayerTurfTxt[p][2], g_Team[g_Turf[turfAttacker]][teamColor]);
                                }
                            }
                        }
                        
                        return 1;
                    }
                }
            }
        }
    }
    
    return 1;
}

Sdílet tento příspěvek


Link to post
Share on other sites
  • 0

Original:

 


#define FILTERSCRIPT

#include <a_samp>

#undef     MAX_PLAYERS
#define MAX_PLAYERS                 (200)

#include <gangzonesc>

#define TURF_STATE_NORMAL             (0)
#define TURF_STATE_ATTACKED         (1)
#define TURF_STATE_PROVOKED         (2)

#define TURF_REQUIRED_KILLS         (3)
#define TURF_REQUIRED_PLAYERS       (1)
#define TURF_REQUIRED_CAPTURETIME   (2 * 60 * 1000)
#define TURF_REQUIRED_PROVOKETIME   (10 * 1000)

#define COLOR_GREEN                    (0x00CC00FF)

#define COLOR_CHANGE_ALPHA(%1)         ((%1 & ~0xFF) | (clamp(100, 0x00, 0xFF)))

enum e_TEAM {
            teamName[35],
            teamColor
};

enum e_TURF {
            turfName[35],
            turfOwner,
            turfAttacker,
    Float:    turfPos[4],
            turfOwnerKills,
            turfAttackerKills,
            turfState,
            turfTimer,
            turfId
};

new const g_Team[][e_TEAM] = {
    {"Groves",    0x00FF00FF},
    {"Ballas",    0x800080FF},
    {"Cops",    0x0080FFFF},
    {"Vagos",    0xFFFF00FF},
    {"Aztecas",    0x00FFFFFF},
    {"Bikers",    0xFF4B00FF},
    {"Barbers",    0xA52A2AFF}
};

new const g_Turf[][e_TURF] = {
    {"Ganton",            0,     NO_TEAM,    {2222.50, -1852.80, 2632.80, -1722.30}},
    {"Ganton",          0,     NO_TEAM,    {2222.50, -1722.30, 2632.80, -1628.50}},
    {"Idlewood",        0,     NO_TEAM,    {2124.60, -1742.30, 2222.50, -1494.00}},
    {"Idlewood",        0,     NO_TEAM,    {1971.60, -1852.80, 2222.50, -1742.30}},
    {"Willow Field",    0,     NO_TEAM,    {2324.00, -2059.20, 2541.70, -1852.80}},
    {"East Los Santos", 0,     NO_TEAM,    {2421.00, -1628.50, 2632.80, -1454.30}},
    {"East Los Santos", 0,     NO_TEAM,    {2222.50, -1628.50, 2421.00, -1494.00}},
    
    {"Jefferson",       1,     NO_TEAM,    {2056.80, -1372.00, 2281.40, -1210.70}},
    {"Jefferson",       1,     NO_TEAM,    {2056.80, -1210.70, 2185.30, -1126.30}},
    {"Jefferson",       1,     NO_TEAM,    {2056.80, -1449.60, 2266.20, -1372.00}},
    {"Las Colinas",     1,     NO_TEAM,    {1994.30, -1100.80, 2056.80,  -920.80}},
    {"Las Colinas",     1,     NO_TEAM,    {2056.80, -1126.30, 2126.80,  -920.80}},
    {"Las Colinas",     1,     NO_TEAM,    {2185.30, -1154.50, 2281.40,  -934.40}},
    {"Las Colinas",     1,     NO_TEAM,    {2126.80, -1126.30, 2185.30,  -934.40}},
    {"Las Colinas",     1,     NO_TEAM,    {2632.70, -1135.00, 2747.70,  -945.00}},
    {"Glen Park",       1,     NO_TEAM,    {1812.60, -1350.70, 2056.80, -1100.80}},
    
    {"Idlewood",        2,     NO_TEAM,    {1812.60, -1852.80, 1971.60, -1742.30}},
    {"Idlewood",        2,     NO_TEAM,    {1951.60, -1742.30, 2124.60, -1602.30}},
    {"Idlewood",        2,     NO_TEAM,    {1812.60, -1602.30, 2124.60, -1449.60}},
    {"Idlewood",        2,     NO_TEAM,    {1812.60, -1742.30, 1951.60, -1602.30}},
    {"Pershing Square", 2,     NO_TEAM,    {1327.8929,-1729.3352,1821.7725,-1573.5878}},

    {"East Beach",      3,     NO_TEAM,    {2747.70, -1498.60, 2959.30, -1120.00}},
    {"Los Flores",      3,     NO_TEAM,    {2581.70, -1393.40, 2747.70, -1135.00}},
    {"Las Colinas",     3,     NO_TEAM,    {2281.40, -1135.00, 2632.70,  -945.00}},
    {"East Los Santos", 3,     NO_TEAM,    {2266.20, -1494.00, 2381.60, -1372.00}},
    {"East Los Santos", 3,     NO_TEAM,    {2281.60, -1372.00, 2381.60, -1135.00}},
    {"East Los Santos", 3,     NO_TEAM,    {2381.60, -1454.30, 2462.10, -1135.00}},
    {"East Los Santos", 3,     NO_TEAM,    {2462.10, -1454.30, 2581.70, -1135.00}},

    {"Willow Field",    5,     NO_TEAM,    {1970.60, -2179.20, 2089.00, -1852.80}},
    {"Willow Field",    5,     NO_TEAM,    {2089.00, -1989.90, 2324.00, -1852.80}},
    {"Willow Field",    5,     NO_TEAM,    {2089.00, -2235.80, 2201.80, -1989.90}},
    {"El Corona",       5,     NO_TEAM,    {1812.60, -2179.20, 1970.60, -1852.80}},
    {"El Corona",       5,     NO_TEAM,    {1692.60, -2179.20, 1812.60, -1842.20}},
    {"Rodeo",            5,     NO_TEAM,    {-187.7, -1596.76, 17.0632, -1276.6}},
    {"Rodeo",            5,     NO_TEAM,    {422.68, -1570.2, 466.223, -1406.05}},
    {"Rodeo",            5,     NO_TEAM,    {466.223, -1570.2, 558.099, -1385.07}},
    {"Rodeo",            5,     NO_TEAM,    {558.099, -1684.65, 647.522, -1384.93}},
    {"Rodeo",            5,     NO_TEAM,    {422.68, -1684.65, 558.099, -1570.2}},
    {"Rodeo",            5,     NO_TEAM,    {312.803, -1684.65, 422.68, -1501.95}},
    {"Rodeo",            5,     NO_TEAM,    {334.503, -1501.95, 422.68, -1406.05}},
    {"Rodeo",            5,     NO_TEAM,    {647.712, -1804.21, 851.449, -1577.59}},

    {"Market",          6,     NO_TEAM,    {1252.33, -926.999, 1357.0, -910.17}},
       {"Market",          6,     NO_TEAM,    {1252.33, -1026.33, 1391.05, -926.999}},
    {"Market",          6,     NO_TEAM,    {1252.33, -1130.85, 1378.33, -1026.33}},
    {"Market",          6,     NO_TEAM,    {1072.66, -1416.25, 1370.85, -1130.85}},
    {"Temple",          6,     NO_TEAM,    {1391.05, -1026.33, 1463.9, -926.999}},
    {"Temple",          6,     NO_TEAM,    {1378.33, -1130.85, 1463.9, -1026.33}},
    {"Downtown LS.",    6,     NO_TEAM,    {1370.85, -1170.87, 1463.9, -1130.85}},
    {"Downtown LS.",    6,     NO_TEAM,    {1370.85, -1384.95, 1463.9, -1170.87}}
};

new
                g_MembersInTurf[sizeof(g_Turf)][sizeof(g_Team)],
    PlayerText: g_PlayerTurfTxt[MAX_PLAYERS][3],
    PlayerText: g_PlayerTurfNotifyTxt[MAX_PLAYERS][4],
                g_PlayerTurfNotifyTimer[MAX_PLAYERS][4]
;

public OnFilterScriptInit() {
    new
        iTeamTurfs[sizeof(g_Team)]
    ;
    for (new i, j = sizeof(g_Turf); i < j; i++) {
        g_Turf[turfId] = GangZoneCreate(g_Turf[turfPos][0], g_Turf[turfPos][1], g_Turf[turfPos][2], g_Turf[turfPos][3], COLOR_CHANGE_ALPHA(g_Team[g_Turf[turfOwner]][teamColor]), 1.8);
        
        g_Turf[turfTimer] = -1;
        
        for (new k, l = sizeof(g_Team); k < l; k++) {
            g_MembersInTurf[k] = 0;
        }
        
        iTeamTurfs[g_Turf[turfOwner]]++;
    }

    print(" ");
    print("_________________| Turfwar Script |_________________");
    print("Attempting to initialize ''turfs.amx''...");
    print(" ");
    for (new i, j = sizeof(g_Team); i < j; i++) {
        printf("Loaded %i turfs for team %s", iTeamTurfs, g_Team[teamName]);
     }
    print(" ");
    printf("Total %i turfs loaded", sizeof(g_Turf));
    print("_________________________________________________");
    print(" ");
    
    return 1;
}

public OnFilterScriptExit() {
    for (new i, j = sizeof(g_Turf); i < j; i++) {
        GangZoneDestroy(g_Turf[turfId]);
        
        if (g_Turf[turfTimer] != -1) {
            KillTimer(g_Turf[turfTimer]);
        }
        g_Turf[turfTimer] = -1;
    }
    
    return 1;
}

public OnPlayerConnect(playerid) {
    g_PlayerTurfTxt[playerid][0] = CreatePlayerTextDraw(playerid,317.000000, 378.000000, "Turfwar in ~b~~h~~h~~h~Gangton");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfTxt[playerid][0], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfTxt[playerid][0], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfTxt[playerid][0], 2);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfTxt[playerid][0], 0.240000, 1.200000);
    PlayerTextDrawColor(playerid,g_PlayerTurfTxt[playerid][0], -1);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfTxt[playerid][0], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfTxt[playerid][0], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfTxt[playerid][0], 0);

    g_PlayerTurfTxt[playerid][1] = CreatePlayerTextDraw(playerid,317.000000, 389.000000, "Grove~w~~h~: ~r~13 ~w~~h~kills with ~r~4 ~w~~h~players");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfTxt[playerid][1], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfTxt[playerid][1], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfTxt[playerid][1], 2);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfTxt[playerid][1], 0.180000, 0.899999);
    PlayerTextDrawColor(playerid,g_PlayerTurfTxt[playerid][1], 16711935);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfTxt[playerid][1], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfTxt[playerid][1], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfTxt[playerid][1], 0);

    g_PlayerTurfTxt[playerid][2] = CreatePlayerTextDraw(playerid,317.000000, 397.000000, "Aztecas~w~~h~: ~r~16 ~w~~h~kills with ~r~7 ~w~~h~players");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfTxt[playerid][2], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfTxt[playerid][2], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfTxt[playerid][2], 2);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfTxt[playerid][2], 0.180000, 0.899999);
    PlayerTextDrawColor(playerid,g_PlayerTurfTxt[playerid][2], 16777215);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfTxt[playerid][2], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfTxt[playerid][2], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfTxt[playerid][2], 0);

    g_PlayerTurfNotifyTxt[playerid][0] = CreatePlayerTextDraw(playerid,317.000000, 348.000000, "~g~We have won the turfwar against the ~b~~h~~h~~h~Grove ~g~in ~b~~h~~h~~h~Gangton ~g~(/turfs)");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfNotifyTxt[playerid][0], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfNotifyTxt[playerid][0], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfNotifyTxt[playerid][0], 1);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfNotifyTxt[playerid][0], 0.180000, 0.799999);
    PlayerTextDrawColor(playerid,g_PlayerTurfNotifyTxt[playerid][0], -1);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfNotifyTxt[playerid][0], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfNotifyTxt[playerid][0], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfNotifyTxt[playerid][0], 0);

    g_PlayerTurfNotifyTxt[playerid][1] = CreatePlayerTextDraw(playerid,317.000000, 355.000000, "~r~We have lost the turfwar against the ~b~~h~~h~~h~Azetecas ~r~in ~b~~h~~h~~h~LS. Beach ~r~(/turfs)");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfNotifyTxt[playerid][1], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfNotifyTxt[playerid][1], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfNotifyTxt[playerid][1], 1);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfNotifyTxt[playerid][1], 0.180000, 0.799999);
    PlayerTextDrawColor(playerid,g_PlayerTurfNotifyTxt[playerid][1], -1);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfNotifyTxt[playerid][1], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfNotifyTxt[playerid][1], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfNotifyTxt[playerid][1], 0);

    g_PlayerTurfNotifyTxt[playerid][2] = CreatePlayerTextDraw(playerid,317.000000, 362.000000, "~y~We have provoked a turfwar again ~b~~h~~h~~h~Vagos ~y~in ~b~~h~~h~~h~Blueberry ~y~(/findwar)");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfNotifyTxt[playerid][2], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfNotifyTxt[playerid][2], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfNotifyTxt[playerid][2], 1);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfNotifyTxt[playerid][2], 0.180000, 0.799999);
    PlayerTextDrawColor(playerid,g_PlayerTurfNotifyTxt[playerid][2], -1);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfNotifyTxt[playerid][2], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfNotifyTxt[playerid][2], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfNotifyTxt[playerid][2], 0);

    g_PlayerTurfNotifyTxt[playerid][3] = CreatePlayerTextDraw(playerid,317.000000, 369.000000, "~y~We have got a turfwar again ~b~~h~~h~~h~Vagos ~y~in ~b~~h~~h~~h~Blueberry ~y~(/findwar)");
    PlayerTextDrawAlignment(playerid,g_PlayerTurfNotifyTxt[playerid][3], 2);
    PlayerTextDrawBackgroundColor(playerid,g_PlayerTurfNotifyTxt[playerid][3], 255);
    PlayerTextDrawFont(playerid,g_PlayerTurfNotifyTxt[playerid][3], 1);
    PlayerTextDrawLetterSize(playerid,g_PlayerTurfNotifyTxt[playerid][3], 0.180000, 0.799999);
    PlayerTextDrawColor(playerid,g_PlayerTurfNotifyTxt[playerid][3], -1);
    PlayerTextDrawSetOutline(playerid,g_PlayerTurfNotifyTxt[playerid][3], 1);
    PlayerTextDrawSetProportional(playerid,g_PlayerTurfNotifyTxt[playerid][3], 1);
    PlayerTextDrawSetSelectable(playerid,g_PlayerTurfNotifyTxt[playerid][3], 0);
    
    ShowAllGangZonesForPlayer(playerid);
    
    return 1;
}

public OnPlayerSpawn(playerid) {
    for (new i, j = sizeof(g_Turf); i < j; i++) {
        if (g_Turf[turfState] == TURF_STATE_ATTACKED) {
            GangZoneFlashForPlayer(playerid, g_Turf[turfId], COLOR_CHANGE_ALPHA(g_Team[g_Turf[turfAttacker]][teamColor]));
        }
    }

    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][0]);
    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][1]);
    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][2]);

    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][0]);
    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][1]);
    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][2]);
    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][3]);
    
    return 1;
}

public OnPlayerRequestClass(playerid, classid) {
    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][0]);
    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][1]);
    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][2]);

    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][0]);
    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][1]);
    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][2]);
    PlayerTextDrawHide(playerid, g_PlayerTurfNotifyTxt[playerid][3]);
    
    return 1;
}

NotifyTeam(team, type, text[]) {
    for (new i, j = GetPlayerPoolSize(); i <= j; i++) {
        if (IsPlayerConnected(i) && GetPlayerState(i) != PLAYER_STATE_WASTED && GetPlayerTeam(i) == team) {
            if (g_PlayerTurfNotifyTimer[type] != -1) {
                KillTimer(g_PlayerTurfNotifyTimer[type]);
            }
            g_PlayerTurfNotifyTimer[type] = SetTimerEx("OnTeamNotified", 5000, false, "ii", team, type);
            
            PlayerTextDrawSetString(i, g_PlayerTurfNotifyTxt[type], text);
            PlayerTextDrawShow(i, g_PlayerTurfNotifyTxt[type]);
        }
    }
}

forward OnTeamNotified(team, type);
public  OnTeamNotified(team, type) {
    for (new i, j = GetPlayerPoolSize(); i <= j; i++) {
        if (IsPlayerConnected(i) && GetPlayerTeam(i) == team) {
            g_PlayerTurfNotifyTimer[type] = -1;

            PlayerTextDrawHide(i, g_PlayerTurfNotifyTxt[type]);
        }
    }
}

public OnPlayerDeath(playerid, killerid, reason) {
    if (killerid != INVALID_PLAYER_ID) {
        if (0 <= GetPlayerTeam(playerid) < sizeof(g_Team) && 0 <= GetPlayerTeam(killerid) < sizeof(g_Team)) {
            for (new i, j = sizeof(g_Turf); i < j; i++) {
                if (IsPlayerInGangZone(playerid, g_Turf[turfId])) {
                    if (g_Turf[turfState] == TURF_STATE_NORMAL) {
                        if (GetPlayerTeam(killerid) != g_Turf[turfOwner]) {
                            g_Turf[turfAttackerKills]++;
                            
                            if (g_Turf[turfAttackerKills] >= TURF_REQUIRED_KILLS) {
                                g_Turf[turfState] = TURF_STATE_ATTACKED;
                                g_Turf[turfAttacker] = GetPlayerTeam(killerid);
                                g_Turf[turfTimer] = SetTimerEx("OnTurfwarEnd", TURF_REQUIRED_CAPTURETIME, false, "i", i);
                                
                                GangZoneFlashForAll(g_Turf[turfId], COLOR_CHANGE_ALPHA(g_Team[GetPlayerTeam(killerid)][teamColor]));
                                
                                for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                                    if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                        new
                                            szBuffer[156]
                                        ;
                                        strcat(szBuffer, "Turfwar in ~b~~h~~h~~h~");
                                        strcat(szBuffer, g_Turf[turfName]);
                                        PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][0], szBuffer);
                                        PlayerTextDrawShow(p, g_PlayerTurfTxt[p][0]);
                                        
                                        format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfOwner]][teamName], g_Turf[turfOwnerKills], g_MembersInTurf[g_Turf[turfOwner]]);
                                        PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
                                        PlayerTextDrawColor(p, g_PlayerTurfTxt[p][1], g_Team[g_Turf[turfOwner]][teamColor]);
                                        PlayerTextDrawShow(p, g_PlayerTurfTxt[p][1]);

                                        format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfAttacker]][teamName], g_Turf[turfAttackerKills], g_MembersInTurf[g_Turf[turfAttacker]]);
                                        PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][2], szBuffer);
                                        PlayerTextDrawColor(p, g_PlayerTurfTxt[p][2], g_Team[g_Turf[turfAttacker]][teamColor]);
                                        PlayerTextDrawShow(p, g_PlayerTurfTxt[p][2]);
                                    }
                                }
                                
                                new
                                    szText[156]
                                ;
                                strcat(szText, "~y~We have provoked a turfwar against ~b~~h~~h~~h~");
                                strcat(szText, g_Team[g_Turf[turfOwner]][teamName]);
                                strcat(szText, " ~y~in ~b~~h~~h~~h~");
                                strcat(szText, g_Turf[turfName]);
                                strcat(szText, " ~y~(/findwar)");
                                NotifyTeam(g_Turf[turfAttacker], 2, szText);
                                
                                szText[0] = EOS;
                                strcat(szText, "~y~We have been attacked by ~b~~h~~h~~h~");
                                strcat(szText, g_Team[g_Turf[turfAttacker]][teamName]);
                                strcat(szText, " ~y~in ~b~~h~~h~~h~");
                                strcat(szText, g_Turf[turfName]);
                                strcat(szText, " ~y~(/findwar)");
                                NotifyTeam(g_Turf[turfOwner], 3, szText);
                            }
                        }
                    }
                    else if (g_Turf[turfState] == TURF_STATE_ATTACKED) {
                        if (GetPlayerTeam(killerid) == g_Turf[turfOwner]) {
                            g_Turf[turfOwnerKills]++;

                            for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                                if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                    new
                                         szBuffer[156]
                                    ;
                                    format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfOwner]][teamName], g_Turf[turfOwnerKills], g_MembersInTurf[g_Turf[turfOwner]]);
                                    PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
                                    PlayerTextDrawColor(p, g_PlayerTurfTxt[p][1], g_Team[g_Turf[turfOwner]][teamColor]);
                                }
                            }
                        }
                        else if (GetPlayerTeam(killerid) == g_Turf[turfAttacker]) {
                            g_Turf[turfAttackerKills]++;

                            for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                                if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                    new
                                         szBuffer[156]
                                    ;
                                    format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfAttacker]][teamName], g_Turf[turfAttackerKills], g_MembersInTurf[g_Turf[turfAttacker]]);
                                    PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][2], szBuffer);
                                    PlayerTextDrawColor(p, g_PlayerTurfTxt[p][2], g_Team[g_Turf[turfAttacker]][teamColor]);
                                }
                            }
                        }
                    }

                    return 1;
                }
            }
        }
    }

    return 1;
}

public OnPlayerEnterGangZone(playerid, zone) {
    if (0 <= GetPlayerTeam(playerid) < sizeof(g_Team) && GetPlayerState(playerid) != PLAYER_STATE_WASTED && ! GetPlayerInterior(playerid) && ! GetPlayerVirtualWorld(playerid)) {
        for (new i, j = sizeof(g_Turf); i < j; i++) {
            if (zone == g_Turf[turfId]) {
                new
                      szTurfText[156]
                ;
                strcat(szTurfText, "~y~~h~");
                strcat(szTurfText, g_Team[g_Turf[turfOwner]][teamName]);
                strcat(szTurfText, "'s ");
                strcat(szTurfText, g_Turf[turfName]);
                GameTextForPlayer(playerid, szTurfText, 3000, 1);
                    
                g_MembersInTurf[GetPlayerTeam(playerid)]++;
                
                if (GetPlayerTeam(playerid) != g_Turf[turfOwner]) {
                    if (g_Turf[turfState] == TURF_STATE_NORMAL) {
                        if (g_MembersInTurf[GetPlayerTeam(playerid)] >= TURF_REQUIRED_PLAYERS) {
                            g_Turf[turfState] = TURF_STATE_PROVOKED;
                            g_Turf[turfAttacker] = GetPlayerTeam(playerid);
                            g_Turf[turfTimer] = SetTimerEx("OnTurfwarProvoked", TURF_REQUIRED_PROVOKETIME, false, "i", i);

                            return 1;
                        }
                    }
                }
                else if (g_Turf[turfState] == TURF_STATE_ATTACKED) {
                    new
                           szBuffer[156]
                    ;
                    strcat(szBuffer, "Turfwar in ~b~~h~~h~~h~");
                    strcat(szBuffer, g_Turf[turfName]);
                    PlayerTextDrawSetString(playerid, g_PlayerTurfTxt[playerid][0], szBuffer);
                    PlayerTextDrawShow(playerid, g_PlayerTurfTxt[0]);

                    PlayerTextDrawColor(playerid, g_PlayerTurfTxt[playerid][1], g_Team[g_Turf[turfOwner]][teamColor]);
                    PlayerTextDrawShow(playerid, g_PlayerTurfTxt[1]);

                    PlayerTextDrawColor(playerid, g_PlayerTurfTxt[playerid][2], g_Team[g_Turf[turfAttacker]][teamColor]);
                    PlayerTextDrawShow(playerid, g_PlayerTurfTxt[2]);
                    
                    if (GetPlayerTeam(playerid) == g_Turf[turfOwner]) {
                        for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                            if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfOwner]][teamName], g_Turf[turfOwnerKills], g_MembersInTurf[g_Turf[turfOwner]]);
                                PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
                            }
                        }
                    }
                    else if (GetPlayerTeam(playerid) == g_Turf[turfAttacker]) {
                        for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                            if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfOwner]][teamName], g_Turf[turfOwnerKills], g_MembersInTurf[g_Turf[turfOwner]]);
                                PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
                            }
                        }
                    }
                }

                return 1;
            }
        }
    }
    
    return 1;
}

forward OnTurfwarProvoked(turfid);
public  OnTurfwarProvoked(turfid) {
    g_Turf[turfid][turfState] = TURF_STATE_ATTACKED;
    g_Turf[turfid][turfTimer] = SetTimerEx("OnTurfwarEnd", TURF_REQUIRED_CAPTURETIME, false, "i", turfid);

    new
        szText[156]
    ;
    strcat(szText, "~y~We have provoked a turfwar against ~b~~h~~h~~h~");
    strcat(szText, g_Team[g_Turf[turfid][turfOwner]][teamName]);
    strcat(szText, " ~y~in ~b~~h~~h~~h~");
    strcat(szText, g_Turf[turfid][turfName]);
    strcat(szText, " ~y~(/findwar)");
    NotifyTeam(g_Turf[turfid][turfAttacker], 2, szText);

    szText[0] = EOS;
    strcat(szText, "~y~We have been attacked by ~b~~h~~h~~h~");
    strcat(szText, g_Team[g_Turf[turfid][turfAttacker]][teamName]);
    strcat(szText, " ~y~in ~b~~h~~h~~h~");
    strcat(szText, g_Turf[turfid][turfName]);
    strcat(szText, " ~y~(/findwar)");
    NotifyTeam(g_Turf[turfid][turfOwner], 3, szText);

    GangZoneFlashForAll(g_Turf[turfid][turfId], COLOR_CHANGE_ALPHA(g_Team[g_Turf[turfid][turfAttacker]][teamColor]));
    
    for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
         if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfid][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
            new
                   szBuffer[156]
            ;
            strcat(szBuffer, "Turfwar in ~b~~h~~h~~h~");
            strcat(szBuffer, g_Turf[turfid][turfName]);
            PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][0], szBuffer);
            PlayerTextDrawShow(p, g_PlayerTurfTxt[p][0]);

            format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfid][turfOwner]][teamName], g_Turf[turfid][turfOwnerKills], g_MembersInTurf[turfid][g_Turf[turfid][turfOwner]]);
            PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
            PlayerTextDrawColor(p, g_PlayerTurfTxt[p][1], g_Team[g_Turf[turfid][turfOwner]][teamColor]);
            PlayerTextDrawShow(p, g_PlayerTurfTxt[p][1]);

            format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfid][turfAttacker]][teamName], g_Turf[turfid][turfAttackerKills], g_MembersInTurf[turfid][g_Turf[turfid][turfAttacker]]);
            PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][2], szBuffer);
               PlayerTextDrawColor(p, g_PlayerTurfTxt[p][2], g_Team[g_Turf[turfid][turfAttacker]][teamColor]);
            PlayerTextDrawShow(p, g_PlayerTurfTxt[p][2]);
           }
    }
}

forward OnTurfwarEnd(turfid);
public  OnTurfwarEnd(turfid) {
    g_Turf[turfid][turfTimer] = -1;
    
    new
        iScores[2],
        szText[156]
    ;
    iScores[0] = g_Turf[turfid][turfOwnerKills] + g_MembersInTurf[turfid][g_Turf[turfid][turfOwner]];
    iScores[1] = g_Turf[turfid][turfAttackerKills] + g_MembersInTurf[turfid][g_Turf[turfid][turfAttacker]];
    if (iScores[0] < iScores[1]) {
        strcat(szText, "~y~We have won the turfwar against ~b~~h~~h~~h~");
        strcat(szText, g_Team[g_Turf[turfid][turfOwner]][teamName]);
        strcat(szText, " ~y~in ~b~~h~~h~~h~");
        strcat(szText, g_Turf[turfid][turfName]);
        strcat(szText, " ~y~(/turfs)");
        NotifyTeam(g_Turf[turfid][turfAttacker], 1, szText);

        szText[0] = EOS;
        strcat(szText, "~y~We have lost the turfwar against ~b~~h~~h~~h~");
        strcat(szText, g_Team[g_Turf[turfid][turfAttacker]][teamName]);
        strcat(szText, " ~y~in ~b~~h~~h~~h~");
        strcat(szText, g_Turf[turfid][turfName]);
        strcat(szText, " ~y~(/turfs)");
        NotifyTeam(g_Turf[turfid][turfOwner], 0, szText);
        
        format(szText, sizeof(szText), "* The last turf scores for \"%s\" were: %s - %i, %s - %i.", g_Turf[turfid][turfName], g_Team[g_Turf[turfid][turfOwner]][teamName], iScores[0], g_Team[g_Turf[turfid][turfAttacker]][teamName], iScores[1]);
        for (new i, j = sizeof(g_Team); i < j; i++) {
            if (GetPlayerTeam(i) == g_Turf[turfid][turfOwner]) {
                SendClientMessage(i, COLOR_GREEN, szText);
            }
            else if (GetPlayerTeam(i) == g_Turf[turfid][turfAttacker]) {
                GivePlayerMoney(i, 7000);
                SetPlayerScore(i, GetPlayerScore(i) + 5);
                
                SendClientMessage(i, COLOR_GREEN, "Your team showed the opponenet team! [+$7000, +5 score]");
                SendClientMessage(i, COLOR_GREEN, szText);
            }
         }

        g_Turf[turfid][turfOwner] = g_Turf[turfid][turfAttacker];
    }
    else {
        strcat(szText, "~y~We have won the turfwar against ~b~~h~~h~~h~");
        strcat(szText, g_Team[g_Turf[turfid][turfAttacker]][teamName]);
        strcat(szText, " ~y~in ~b~~h~~h~~h~");
        strcat(szText, g_Turf[turfid][turfName]);
        strcat(szText, " ~y~(/turfs)");
        NotifyTeam(g_Turf[turfid][turfOwner], 1, szText);

        szText[0] = EOS;
        strcat(szText, "~y~We have lost the turfwar against ~b~~h~~h~~h~");
        strcat(szText, g_Team[g_Turf[turfid][turfOwner]][teamName]);
        strcat(szText, " ~y~in ~b~~h~~h~~h~");
        strcat(szText, g_Turf[turfid][turfName]);
        strcat(szText, " ~y~(/turfs)");
        NotifyTeam(g_Turf[turfid][turfAttacker], 0, szText);
        
        format(szText, sizeof(szText), "* The last turf scores for \"%s\" were: %s - %i, %s - %i.", g_Turf[turfid][turfName], g_Team[g_Turf[turfid][turfOwner]][teamName], iScores[0], g_Team[g_Turf[turfid][turfAttacker]][teamName], iScores[1]);
        for (new i, j = sizeof(g_Team); i < j; i++) {
            if (GetPlayerTeam(i) == g_Turf[turfid][turfOwner]) {
                GivePlayerMoney(i, 7000);
                SetPlayerScore(i, GetPlayerScore(i) + 5);
                
                SendClientMessage(i, COLOR_GREEN, "Your team showed the opponenet team! [+$7000, +5 score]");
                SendClientMessage(i, COLOR_GREEN, szText);
            }
            else if (GetPlayerTeam(i) == g_Turf[turfid][turfAttacker]) {
                SendClientMessage(i, COLOR_GREEN, szText);
            }
         }
    }

    g_Turf[turfid][turfState] = TURF_STATE_NORMAL;
    
    g_Turf[turfid][turfAttacker] = NO_TEAM;

    g_Turf[turfid][turfAttackerKills] = 0;
    g_Turf[turfid][turfOwnerKills] = 0;
    
    GangZoneStopFlashForAll(g_Turf[turfid][turfId]);
    GangZoneShowForAll(g_Turf[turfid][turfId], COLOR_CHANGE_ALPHA(g_Team[g_Turf[turfid][turfOwner]][teamColor]));
    
    for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
         if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfid][turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
            PlayerTextDrawHide(p, g_PlayerTurfTxt[p][0]);

            PlayerTextDrawHide(p, g_PlayerTurfTxt[p][1]);

            PlayerTextDrawHide(p, g_PlayerTurfTxt[p][2]);
           }
    }
}

public OnPlayerLeaveGangZone(playerid, zone) {
    if (0 <= GetPlayerTeam(playerid) < sizeof(g_Team)) {
        for (new i, j = sizeof(g_Turf); i < j; i++) {
            if (zone == g_Turf[turfId]) {
                g_MembersInTurf[GetPlayerTeam(playerid)]--;
                
                if (g_Turf[turfState] == TURF_STATE_PROVOKED) {
                    if (g_MembersInTurf[GetPlayerTeam(playerid)] < TURF_REQUIRED_PLAYERS) {
                        g_Turf[turfState] = TURF_STATE_NORMAL;
                        g_Turf[turfAttacker] = NO_TEAM;
                        KillTimer(g_Turf[turfTimer]);
                        g_Turf[turfTimer] = -1;

                        return 1;
                    }
                }
                else if (g_Turf[turfState] == TURF_STATE_ATTACKED) {
                    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][0]);

                    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][1]);

                    PlayerTextDrawHide(playerid, g_PlayerTurfTxt[playerid][2]);
                
                    if (g_MembersInTurf[GetPlayerTeam(playerid)] < TURF_REQUIRED_PLAYERS) {
                        OnTurfwarEnd(i);
                        
                        KillTimer(g_Turf[turfTimer]);
                        g_Turf[turfTimer] = -1;

                        g_Turf[turfState] = TURF_STATE_NORMAL;

                        g_Turf[turfAttacker] = NO_TEAM;

                        g_Turf[turfAttackerKills] = 0;
                        g_Turf[turfOwnerKills] = 0;

                        GangZoneStopFlashForAll(g_Turf[turfId]);
                        GangZoneShowForAll(g_Turf[turfId], COLOR_CHANGE_ALPHA(g_Team[g_Turf[turfOwner]][teamColor]));

                        for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                            if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId])) {
                                PlayerTextDrawHide(p, g_PlayerTurfTxt[p][0]);

                                PlayerTextDrawHide(p, g_PlayerTurfTxt[p][1]);

                                PlayerTextDrawHide(p, g_PlayerTurfTxt[p][2]);
                            }
                        }

                        return 1;
                    }
                    else {
                        if (GetPlayerTeam(playerid) == g_Turf[turfOwner]) {
                            for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                                if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                    new
                                        szBuffer[156]
                                    ;
                                    format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfOwner]][teamName], g_Turf[turfOwnerKills], g_MembersInTurf[g_Turf[turfOwner]]);
                                    PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][1], szBuffer);
                                       PlayerTextDrawColor(p, g_PlayerTurfTxt[p][1], g_Team[g_Turf[turfOwner]][teamColor]);
                                }
                            }
                        }
                        else if (GetPlayerTeam(playerid) == g_Turf[turfAttacker]) {
                            for (new p, q = GetPlayerPoolSize(); p <= q; p++) {
                                if (IsPlayerConnected(p) && IsPlayerInGangZone(p, g_Turf[turfId]) && GetPlayerState(p) != PLAYER_STATE_WASTED && ! GetPlayerInterior(p) && ! GetPlayerVirtualWorld(p)) {
                                    new
                                        szBuffer[156]
                                    ;
                                    format(szBuffer, sizeof(szBuffer), "%s~w~~h~: ~r~%i ~w~~h~kills with ~r~%i ~w~~h~players", g_Team[g_Turf[turfOwner]][teamName], g_Turf[turfOwnerKills], g_MembersInTurf[g_Turf[turfOwner]]);
                                    PlayerTextDrawSetString(p, g_PlayerTurfTxt[p][2], szBuffer);
                                       PlayerTextDrawColor(p, g_PlayerTurfTxt[p][2], g_Team[g_Turf[turfAttacker]][teamColor]);
                                }
                            }
                        }
                        
                        return 1;
                    }
                }
            }
        }
    }
    
    return 1;
}

 

 

  • Zmatený 1

Sdílet tento příspěvek


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×