[Ajuda] Criaзгo de GangZone
#1

Opa, pessoal eu criei varias e varias gangzones em meu antigo GameMode, mais agora estou com outro e quero aprender cada vez mais, sу que ja estou a 2dias tentando criar 1GZ e nгo estou conseguindo!!
Ai vai os dados!

Na figura 01 estб uma GZ que ja veio com o GM, observem que acima do mine-mapa aparece a mensagem e a barra dominando a GZ e la abaixo do mine-mapa aparece o nome do territуrio + o seu status que й desocupado!!



E na figura 02 й a GZ que eu criei, ela sу mostra o local da gz, mais nao mostra as informaзхes nem da pra dominar!!



Alguйm pode me ajudar a entender esse processo?

Aqui tem algumas informaзхes:

pawn Код:
#define MAX_TURFS   9

enum zInfo
{
    zName[24],
    Float:zMinX,
    Float:zMinY,
    Float:zMaxX,
    Float:zMaxY
};

new TurfsCoords[MAX_TURFS][zInfo] = {
{"Morro", 2117.333, -1069.962, 2261.841, -959.4252},
{"Skate", 1861.9410,-1450.6462,1976.5867,-1351.4069},
{"Cemiterio", 805.6504, -1067.6549, 949.6504, -1147.6549},
{"Shop", 1061.1545,-1566.9081,1190.9424,-1411.1282},
{"Aero", 1395.7454,-2368.6396,1566.4358,-2204.4346},
{"Farol", 133.1268, -1968.3923, 178.0602, -1880.1589},
{"Bangu", -200.0000,1650.0000,450.0000,2550.0000},
{"Usina", -907.0000,1365.0000,-480.0000,2148.0000},
{"Fabrica", -447.7593,-1535.479,-316.0,-1334.634}
};
//{"Pier", 318.0144, -2120.061, 437.1136, -1993.733},

new AllowedOrgs[MAX_TURFS][] = {
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Morro
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Skate
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Cemiterio
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Shop
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Aero
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Farol
{3, 22},//Bangu
{3, 22},//Usina
{2,16,17}//Fabrica
};

enum GangZonesEx
{
    ZoneOwner,                          //Zone owner
    bool:ZoneInWar,                     //Whether or not zone is in war
    bool:ZoneIsSpawn,
    bool:IsZoneGZ,
    bool:IsZoneVillage,

    ZoneWarPoints[MAX_ORGS],
    ZoneAttacker,                       //Gang who started war
    ZonePlayerCount[MAX_ORGS],
    ZonePlayerCountEx[MAX_ORGS],        //Players in zone
    ZoneWarKillCount[MAX_ORGS],         //Kill tracker for in war zone count
    ZoneKillCount[MAX_ORGS],        //Kill counter (for not in war)
    ZoneWarTimeLeft,                    //Time left before war ends
    ZonePlayerReqMet[MAX_ORGS],     //Number of times zone check passed the player requirement (gang-based)
    ZoneWarPlayers[MAX_ORGS],           //Players from each gang that participated in war (gang-based)
    ZoneWarCount,                       //Number of wars fought

}
new gZonesData[MAX_TURFS][GangZonesEx];
Reply
#2

Talvez isto te ajude
Reply
#3

Quote:
Originally Posted by 4LiSs0N
Посмотреть сообщение
Eu sei criar GZ, mais eu queria saber se alguem sabe o que ta faltando ai, eu to estudando esse sistema que й novo pra mim, eu usava o que vc mandou ai.

Essa gz nгo precisa de comando para dominar, й sу ficar parado nela e pronto
Reply
#4

Eu tambйm estou com o mesmo poblema que ele!!
Reply
#5

Nгo tenho certeza se й mais acho que vc tem que definir os TextDraw pros GZ que vc criou..
Reply
#6

Mais ja tem, olha sу os codigos:

pawn Код:
#define MAX_TURFS   9

enum zInfo
{
    zName[24],
    Float:zMinX,
    Float:zMinY,
    Float:zMaxX,
    Float:zMaxY
};

new TurfsCoords[MAX_TURFS][zInfo] = {
{"Morro", 2117.333, -1069.962, 2261.841, -959.4252},
{"Skate", 1861.9410,-1450.6462,1976.5867,-1351.4069},
{"Cemiterio", 805.6504, -1067.6549, 949.6504, -1147.6549},
{"Shop", 1061.1545,-1566.9081,1190.9424,-1411.1282},
{"Aero", 1395.7454,-2368.6396,1566.4358,-2204.4346},
{"Farol", 133.1268, -1968.3923, 178.0602, -1880.1589},
{"Bangu", -200.0000,1650.0000,450.0000,2550.0000},
{"Usina", -907.0000,1365.0000,-480.0000,2148.0000},
{"Fabrica", -447.7593,-1535.479,-316.0,-1334.634}
};
//{"Pier", 318.0144, -2120.061, 437.1136, -1993.733},

new AllowedOrgs[MAX_TURFS][] = {
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Morro
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Skate
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Cemiterio
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Shop
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Aero
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Farol
{3, 22},//Bangu
{3, 22},//Usina
{2,16,17}//Fabrica
};

enum GangZonesEx
{
    ZoneOwner,                          //Zone owner
    bool:ZoneInWar,                     //Whether or not zone is in war
    bool:ZoneIsSpawn,
    bool:IsZoneGZ,
    bool:IsZoneVillage,

    ZoneWarPoints[MAX_ORGS],
    ZoneAttacker,                       //Gang who started war
    ZonePlayerCount[MAX_ORGS],
    ZonePlayerCountEx[MAX_ORGS],        //Players in zone
    ZoneWarKillCount[MAX_ORGS],         //Kill tracker for in war zone count
    ZoneKillCount[MAX_ORGS],        //Kill counter (for not in war)
    ZoneWarTimeLeft,                    //Time left before war ends
    ZonePlayerReqMet[MAX_ORGS],     //Number of times zone check passed the player requirement (gang-based)
    ZoneWarPlayers[MAX_ORGS],           //Players from each gang that participated in war (gang-based)
    ZoneWarCount,                       //Number of wars fought

}
new gZonesData[MAX_TURFS][GangZonesEx];


new Turfs[MAX_TURFS];
pawn Код:
for(new i = 0; i < sizeof(TurfsCoords); i++)
        Turfs[i] = GangZoneCreate(TurfsCoords[i][zMinX],TurfsCoords[i][zMinY],TurfsCoords[i][zMaxX],TurfsCoords[i][zMaxY]);
pawn Код:
for(new i = 0; i < sizeof(TurfsCoords); i ++)
        GangZoneShowForPlayer(playerid, Turfs[i], OrgsColors[gZonesData[i][ZoneOwner]]);
pawn Код:
public IsPlayerInTurf(playerid, turfid)
{
    if(IsPlayerConnected(playerid))
    {
        if(turfid == -1)
            return 0;

        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid,x,y,z);
        if(x >= TurfsCoords[turfid][zMinX] && x < TurfsCoords[turfid][zMaxX] && y >= TurfsCoords[turfid][zMinY] && y < TurfsCoords[turfid][zMaxY])
            return 1;
    }
    return 0;
}
pawn Код:
public GranaTerritorios()
{
    new string[128];
    for(new i=0; i< sizeof(TurfsCoords); i++)
    {
        if(gZonesData[i][ZoneOwner] != TEAM_NONE)
        {
            for(new x = 0; x <= HighestID; x ++)
            {
                if(IsPlayerConnected(x))
                {
                    if(Player[x][pMember] == gZonesData[i][ZoneOwner])
                    {
                        if(Player[x][pMember] == 16 || Player[x][pMember] == 17)
                        {
                            format(string, sizeof(string), "[INFO] Vocк recebeu R$150,00 e 100 materiais, por manter a бrea %s sob controle.", TURF_PAYOUT, TurfsCoords[i][zName]);
                            Player[x][pMats] += 100;
                            GivePlayerGP(x, 150);
                        }
                        else
                        {
                            format(string, sizeof(string), "[INFO] Vocк recebeu R$%d,00 por manter a бrea %s sob controle.", TURF_PAYOUT, TurfsCoords[i][zName]);
                            GivePlayerGP(x, 100);
                        }
                        SendClientMessage(x, COLOR_GOLD, string);
                    }
                }
                GranaPix[x] = 0;
                NumPix[x] = 0;
            }
        }
    }

    for(new x = 0; x <= HighestID; x ++)
    {
        for(new i = 0; i < MAX_PIX; i ++)
        {
            if(IsPlayerConnected(x))
            {
                if(Player[x][pMember] == Pixacao[i][Dono] && Pixacao[i][Dono] != 0)
                {
                    GranaPix[x] += GRANA_PIX;
                    NumPix[x] ++;
                }
            }
        }
        if(NumPix[x] > 0)
        {
            format(string, sizeof(string), "[INFO] Vocк recebeu R$%d, por manter %d pixaзхes sob seu domнnio.", GranaPix[x], NumPix[x]);
            GivePlayerGP(x, GranaPix[x]);
            SendClientMessage(x, COLOR_GOLD, string);
        }
    }

}
@edit
Ainda tem mais... sу que ia ficar muito grande

Eu acho que tem algum lugar para por a id da gzone, nem sei oq й ja to maluco aki ja procurando como adicionar essa nova gz
Reply
#7

a algum sobre isso textdrawshowforplayer?
Reply
#8

Os crйditos vгo bem?
Reply
#9

Quote:
Originally Posted by StrondaXxT
Посмотреть сообщение
a algum sobre isso textdrawshowforplayer?
Ai vai:
pawn Код:
forward GangZonesCheck();
public GangZonesCheck()
{
    new string[128];
    for(new i = 0; HighestID+1 > i; i++)
    {
        if(IsPlayerConnected(i) && Player[i][Spawned] == true)
        {
            new pZone = GetPlayerZone(i);
            if(pZone != 999)
            {
                if(gZonesData[pZone][ZoneInWar] == true && (GetPlayerOrg(i) == gZonesData[pZone][ZoneOwner] ||GetPlayerOrg(i) == gZonesData[pZone][ZoneAttacker]))
                {
                    new score[256];
                    format(score,256,"Placar da Guerra ~n~~r~%s ~w~x ~b~%s ~n~~y~Pontos: ~r~%d  ~w~-  ~b~%d~n~~y~Kills: ~r~%d  ~w~-  ~b~%d~n~~n~~p~Tempo Restante: ~w~%s",
                    OrgsNamesSmall[gZonesData[pZone][ZoneAttacker]],OrgsNamesSmall[gZonesData[pZone][ZoneOwner]],
                    gZonesData[pZone][ZoneWarPoints][gZonesData[pZone][ZoneAttacker]], gZonesData[pZone][ZoneWarPoints][gZonesData[pZone][ZoneOwner]],
                    gZonesData[pZone][ZoneWarKillCount][gZonesData[pZone][ZoneAttacker]], gZonesData[pZone][ZoneWarKillCount][gZonesData[pZone][ZoneOwner]], ConvertSecondsToMins(gZonesData[pZone][ZoneWarTimeLeft]));
                    TextDrawSetString(WarPointsTD[i], score);

                    if(Player[i][SeePoints] == false)
                    {
                        TextDrawShowForPlayer(i, WarPointsTD[i]);
                        Player[i][SeePoints] = true;
                    }
                }
                else
                {
                    if(Player[i][SeePoints] == true)
                    {
                        TextDrawHideForPlayer(i, WarPointsTD[i]);
                        Player[i][SeePoints] = false;
                    }
                }

                format(string,128,"- %s -~n~~p~Territ¦rio: ~w~~h~%s", TurfsCoords[pZone][zName], GetZoneOwnerName(pZone));

                TextDrawSetString(ZoneName[i], string);
                if(Player[i][SeeName] == false && Player[i][Spawned] == true)
                {
                    TextDrawShowForPlayer(i, ZoneName[i]);
                    Player[i][SeeName] = true;
                }

                if(IsAGang(i))
                {
                    SetPlayerChatBubble( i, "GangZone", COLOR_RED, 50.0, 20000);
                    InGZ[i] = 60;
                }

                if(gZonesData[pZone][ZonePlayerReqMet][GetPlayerOrg(i)] > 0 && gZonesData[pZone][ZoneOwner] != GetPlayerOrg(i))
                {
                    new percent = 100;
                    percent = floatround((100*gZonesData[pZone][ZonePlayerReqMet][GetPlayerOrg(i)])/ZONE_CHECKS);

                    TextDrawShowForPlayer(i, ChecksBar[percent]);
                    TextDrawShowForPlayer(i, ChecksBar[100]);
                    TextDrawShowForPlayer(i, ChecksBar[101]);
                    TextDrawShowForPlayer(i, ChecksBar[102]);
                    Player[i][SeeChecksBar] = true;
                }
                else
                {
                    if(Player[i][SeeChecksBar] == true)
                    {
                        for(new x = 0; x < sizeof(ChecksBar); x ++)
                            TextDrawHideForPlayer(i, ChecksBar[x]);

                        Player[i][SeeChecksBar] = false;
                    }
                }
            }
            else
            {
                if(Player[i][SeeChecksBar] == true)
                {
                    for(new x = 0; x < sizeof(ChecksBar); x ++)
                        TextDrawHideForPlayer(i, ChecksBar[x]);

                    Player[i][SeeChecksBar] = false;
                }
                if(Player[i][SeePoints] == true)
                {
                    TextDrawHideForPlayer(i, WarPointsTD[i]);
                    Player[i][SeePoints] = false;
                }
                if(Player[i][SeeName] == true)
                {
                    Player[i][SeeName] = false;
                    TextDrawHideForPlayer(i, ZoneName[i]);
                }
            }
        }
    }
    return 1;
}
Outra parte:

pawn Код:
forward ShowScreenTextForGang(gangid);
public ShowScreenTextForGang(gangid)
{
    for(new i = 0; i <= HighestID; i ++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerOrg(i) == gangid)
            {
                TextDrawShowForPlayer(i, ServerLogo1);
                TextDrawShowForPlayer(i, ServerLogo2);
            //  Player[i][SeeName] = true;
                TextDrawShowForPlayer(i, ZoneName[i]);
            }
        }
    }
}

forward HideScreenTextForGang(gangid, time);
public HideScreenTextForGang(gangid, time)
{
    SetTimerEx("ShowScreenTextForGang", time, 0, "i", gangid);
    for(new i = 0; i <= HighestID; i ++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerOrg(i) == gangid)
            {
                TextDrawHideForPlayer(i, ServerLogo1);
                TextDrawHideForPlayer(i, ServerLogo2);
                   // Player[i][SeeName] = false;
                TextDrawHideForPlayer(i, ZoneName[i]);
            }
        }
    }
}

stock SendMessageToGang(gangid, color, message[])
{
    for(new i = 0; i <= HighestID; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerOrg(i) == gangid)
            {
                PlaySoundForPlayer(i, 1052);
                SendClientMessage(i, color, message);
            }
        }
    }
    return 1;
}

stock TimeTextForGang(gangid, Text:textdraw, time)
{
    for (new i=0;i<= HighestID;i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerOrg(i) == gangid)
            {
                TimeTextForPlayer(i, textdraw, time);
            }
        }
    }

}

forward TimeTextForPlayer(playerid, Text:text, time);
public TimeTextForPlayer(playerid, Text:text, time)
{
    TextDrawShowForPlayer(playerid,text);
    SetTimerEx("HideTextTimer",time,0,"ii",playerid, _:text); // _: from Simon
}

forward HideTextTimer(playerid, Text:text);
public HideTextTimer(playerid, Text:text)
{
    TextDrawHideForPlayer(playerid, text);
}

//>-=-=-=-=-=-=-=-=-=-=-=-=-=-<//
//    War Points Functions     //
//>-=-=-=-=-=-=-=-=-=-=-=-=-=-<//
stock AddWarPoints(playerid, points)
{
    Player[playerid][WarPoints] += points;
}

stock RemoveWarPoints(playerid, points)
{
    Player[playerid][WarPoints] -= points;
}


stock GetWarPoints(playerid)
{
    return Player[playerid][WarPoints];
}




Crйditos ao Viniborn pela criaзгo do GAMEMODE
Reply
#10

pawn Код:
#define MAX_TURFS   9//aumente conforme a quantidade de gz q deseja aumentar

new TurfsCoords[MAX_TURFS][zInfo] = {
{"Morro", 2117.333, -1069.962, 2261.841, -959.4252},
{"Skate", 1861.9410,-1450.6462,1976.5867,-1351.4069},
{"Cemiterio", 805.6504, -1067.6549, 949.6504, -1147.6549},
{"Shop", 1061.1545,-1566.9081,1190.9424,-1411.1282},
{"Aero", 1395.7454,-2368.6396,1566.4358,-2204.4346},
{"Farol", 133.1268, -1968.3923, 178.0602, -1880.1589},
{"Bangu", -200.0000,1650.0000,450.0000,2550.0000},
{"Usina", -907.0000,1365.0000,-480.0000,2148.0000},
{"Fabrica", -447.7593,-1535.479,-316.0,-1334.634},
{"NomeGz", MinX, MinY, MaxX, MaxY}//Aki sгo as coords da gz q sгo formadas por MinimoX, MinimoY, MaximoX, MaximoY. Fora desses pradroes nгo iram funcionar!
};

new AllowedOrgs[MAX_TURFS][] = {
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Morro
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Skate
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Cemiterio
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Shop
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Aero
{1, 5, 6, 10, 11, 12, 13, 15, 18, 19, 20, 24},//Farol
{3, 22},//Bangu
{3, 22},//Usina
{2,16,17},//Fabrica
{1, 5, 6, 10...}//Aki sгo as orgs q pode atacar essa gz!
};

forward StartWar(zoneid, defend_gang, attack_gang);
public StartWar(zoneid, defend_gang, attack_gang)
{
    new lol = 0, sd;
    if(zoneid <= 4) sd = 12;
    else if(zoneid == 5 || zoneid == 6 || zoneid == 7) sd = 4;
    else if(zoneid == 8) sd = 5;
    else if(zoneid == 9) sd = 12;// sd tem q ser igual a numero de orgs q podem dominar.
   
......
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)