[Ajuda] /guerra (Mнnimo 3 online)
#1

Olб, bom dia!

Me venho a cabeзa de como fazer um sistema assim...
So pudesse dar o /guerra quando tivesse no mнnimo 2 player online de cada ORG. (Exercito, FARC e GI)

pawn Code:
if(strcmp(cmd, "/guerra", true) == 0)
    {
        if(PlayerInfo[playerid][pJailed] != 0)
        {
            SendClientMessage(playerid,CINZA," Vocк nгo pode criar guerra na cadeia!");
            return true;
        }
        if(TendoGuerra >= 1)
        {
            SendClientMessage(playerid, CINZA, "   Jб estб tendo uma guerra!");
            return true;
        }
        if(GetPlayerInterior(playerid) != 0)
        {
            SendClientMessage(playerid,CINZA," Vocк nгo pode criar guerra em um interior!");
            return true;
        }
        new Float:x,Float:y,Float:z;
        if(PlayerInfo[playerid][pMembro] == 3 || PlayerInfo[playerid][pLider] == 3)// EXE
        {
            GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
            format(string, sizeof(string), "%s e o Exйrcito iniciaram uma Guerra!",playername);
            SendClientMessageToAll(COLOR_EXE, string);
            GetPlayerPos(playerid,x,y,z);
            Territorio[MinX] = x-240;
            Territorio[MinY] = y-240;
            Territorio[MaxX] = x+240;
            Territorio[MaxY] = y+240;
            Territorio[exemortos] = 0;
            Territorio[talmortos] = 0;
            Territorio[almortos] = 0;
            GZGuerra = GangZoneCreate(x-240,y-240,x+240,y+240);
            GangZoneShowForAll(GZGuerra,COLORGZ_EXE);
            VisionInfo[playerid][InicioGuerra] = 1;
            TendoGuerra = 1;
            //TempoGuerra = SetTimerEx("GuerraTerrorista", 180000, 0, "i", playerid);
            return true;
        }
        if(PlayerInfo[playerid][pMembro] == 6 || PlayerInfo[playerid][pLider] == 6)// Guerrilheiros Israelitas
        {
            GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
            format(string, sizeof(string), "%s e o Guerrilheiros Israelitas iniciaram uma Guerra!",playername);
            SendClientMessageToAll(COR_GI, string);
            GetPlayerPos(playerid,x,y,z);
            Territorio[MinX] = x-240;
            Territorio[MinY] = y-240;
            Territorio[MaxX] = x+240;
            Territorio[MaxY] = y+240;
            Territorio[exemortos] = 0;
            Territorio[talmortos] = 0;
            Territorio[almortos] = 0;
            GZGuerra = GangZoneCreate(x-240,y-240,x+240,y+240);
            GangZoneShowForAll(GZGuerra,COLORGZ_GI);
            VisionInfo[playerid][InicioGuerra] = 1;
            TendoGuerra = 1;
            //TempoGuerra = SetTimerEx("GuerraTerrorista", 180000, 0, "i", playerid);
            return true;
        }
        if(PlayerInfo[playerid][pMembro] == 15 || PlayerInfo[playerid][pLider] == 15)// F.A.R.C
        {
            GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
            format(string, sizeof(string), "%s e a F.A.R.C iniciaram uma Guerra!",playername);
            SendClientMessageToAll(COR_FARC, string);
            GetPlayerPos(playerid,x,y,z);
            Territorio[MinX] = x-240;
            Territorio[MinY] = y-240;
            Territorio[MaxX] = x+240;
            Territorio[MaxY] = y+240;
            Territorio[exemortos] = 0;
            Territorio[talmortos] = 0;
            Territorio[almortos] = 0;
            GZGuerra = GangZoneCreate(x-240,y-240,x+240,y+240);
            GangZoneShowForAll(GZGuerra,COLORGZ_FARC);
            VisionInfo[playerid][InicioGuerra] = 1;
            TendoGuerra = 1;
            //TempoGuerra = SetTimerEx("GuerraTerrorista", 180000, 0, "i", playerid);
            return true;
        }
        return true;
    }
Vlw!
Reply
#2

pawn Code:
if(strcmp(cmd, "/guerra", true) == 0)
    {
        if(PlayerInfo[playerid][pJailed] != 0)
        {
            SendClientMessage(playerid,CINZA," Vocк nгo pode criar guerra na cadeia!");
            return true;
        }
        if(TendoGuerra >= 1)
        {
            SendClientMessage(playerid, CINZA, "   Jб estб tendo uma guerra!");
            return true;
        }
        if(GetPlayerInterior(playerid) != 0)
        {
            SendClientMessage(playerid,CINZA," Vocк nгo pode criar guerra em um interior!");
            return true;
        }
        new p[3];
        for(new i = GetMaxPlayers(); i > -1; --i) {
            if(IsPlayerConnected(i)) {
                switch(PlayerInfo[i][pMembro]) {
                    case 3: p[0]++;
                    case 6: p[1]++;
                    case 15: p[2]++;
                }
            }
        }
        if(!(p[0] > 1 && p[1] > 1 && p[2] > 1)) return SendClientMessage(playerid,CINZA," Й necessбrio no mнnimo 2 players online do Ex, FARC e GI para iniciar a guerra!");
        new Float:x,Float:y,Float:z;
        if(PlayerInfo[playerid][pMembro] == 3 || PlayerInfo[playerid][pLider] == 3)// EXE
        {
            GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
            format(string, sizeof(string), "%s e o Exйrcito iniciaram uma Guerra!",playername);
            SendClientMessageToAll(COLOR_EXE, string);
            GetPlayerPos(playerid,x,y,z);
            Territorio[MinX] = x-240;
            Territorio[MinY] = y-240;
            Territorio[MaxX] = x+240;
            Territorio[MaxY] = y+240;
            Territorio[exemortos] = 0;
            Territorio[talmortos] = 0;
            Territorio[almortos] = 0;
            GZGuerra = GangZoneCreate(x-240,y-240,x+240,y+240);
            GangZoneShowForAll(GZGuerra,COLORGZ_EXE);
            VisionInfo[playerid][InicioGuerra] = 1;
            TendoGuerra = 1;
            //TempoGuerra = SetTimerEx("GuerraTerrorista", 180000, 0, "i", playerid);
            return true;
        }
        if(PlayerInfo[playerid][pMembro] == 6 || PlayerInfo[playerid][pLider] == 6)// Guerrilheiros Israelitas
        {
            GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
            format(string, sizeof(string), "%s e o Guerrilheiros Israelitas iniciaram uma Guerra!",playername);
            SendClientMessageToAll(COR_GI, string);
            GetPlayerPos(playerid,x,y,z);
            Territorio[MinX] = x-240;
            Territorio[MinY] = y-240;
            Territorio[MaxX] = x+240;
            Territorio[MaxY] = y+240;
            Territorio[exemortos] = 0;
            Territorio[talmortos] = 0;
            Territorio[almortos] = 0;
            GZGuerra = GangZoneCreate(x-240,y-240,x+240,y+240);
            GangZoneShowForAll(GZGuerra,COLORGZ_GI);
            VisionInfo[playerid][InicioGuerra] = 1;
            TendoGuerra = 1;
            //TempoGuerra = SetTimerEx("GuerraTerrorista", 180000, 0, "i", playerid);
            return true;
        }
        if(PlayerInfo[playerid][pMembro] == 15 || PlayerInfo[playerid][pLider] == 15)// F.A.R.C
        {
            GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
            format(string, sizeof(string), "%s e a F.A.R.C iniciaram uma Guerra!",playername);
            SendClientMessageToAll(COR_FARC, string);
            GetPlayerPos(playerid,x,y,z);
            Territorio[MinX] = x-240;
            Territorio[MinY] = y-240;
            Territorio[MaxX] = x+240;
            Territorio[MaxY] = y+240;
            Territorio[exemortos] = 0;
            Territorio[talmortos] = 0;
            Territorio[almortos] = 0;
            GZGuerra = GangZoneCreate(x-240,y-240,x+240,y+240);
            GangZoneShowForAll(GZGuerra,COLORGZ_FARC);
            VisionInfo[playerid][InicioGuerra] = 1;
            TendoGuerra = 1;
            //TempoGuerra = SetTimerEx("GuerraTerrorista", 180000, 0, "i", playerid);
            return true;
        }
        return true;
    }
Reply
#3

.. ..
Reply
#4

Olб, boa noite!

paulor, o seu funcionou perfeitamente. Obrigado!

Shadoww5, nгo precisei de testar. Obrigado!

Vlw!
Reply
#5

De boa mano, tamo ae para isso..
Reply
#6

Olб, boa tarde!

paulor, o seu й com no mнnimo 2 ou com 3 ?!

Shadoww5, o seu й com quantos ?! poderia fornecer o cуdigo novamente ?!

Vlw!
Reply
#7

sei que a pergunta nao foi para mim mas fica a resposta

pawn Code:
if(!(p[0] > 1 && p[1] > 1 && p[2] > 1)) return SendClientMessage(playerid,CINZA," Й necessбrio no mнnimo 2 players online do Ex, FARC e GI para iniciar a guerra!");
tipo, tem de ser > 1 (maior que um) ou seja, minimo 2!
Reply
#8

Olб, boa tarde!

DartakousLien, funcionou.

Obrigado!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)