Finalizare war , help pls
#1

Nu stiu de ce nu se finalizeaza warul . . . . si timeleftul nu scate sub 1999 sec uitati sistemul :
pawn Code:
new ntimer[MAX_PLAYERS];
new wtimer[MAX_PLAYERS];
new acceptwar = 0;
new WarTimer;
new WarSecondEnd = 1200;
pawn Code:
//---------------------------------------startwar-------------------------------
    if(strcmp(cmd, "/startwar", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(wtimer[playerid] < 1)
            { }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You must wait 12 hours for every war");
                return 1;
            }
            if(PlayerInfo[playerid][pLeader] == 18 || PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pLeader] == 15)
            {
                acceptwar = 1;
                new x_nr[256];
                x_nr = strtok(cmdtext, idx);
                if(!strlen(x_nr))
                {
                        SendClientMessage(playerid, COLOR_WHITE, "USAGE: /startwar list , /startwar [locul]");
                        return 1;
                }
                if(strcmp(x_nr,"list",true) == 0)
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "_________Locuri_List_________");
                    SendClientMessage(playerid, COLOR_GRAD1, "1:GS/LS 2: BS/LS  3: Blue Berry");
                    return 1;
                }
                else if(strcmp(x_nr,"1",true) == 0)
                {
                    SendClientMessageToAll(COLOR_GREEN, "{00FA9A}[WAR]: {8B5A2B}Triads-{DBDB70}LSV{D3D3D3}-{66CD00}Grove {00FA9A}au declarat WAR , zona: {FFFFFF}GS/LS");
                    return 1;
                }
                else if(strcmp(x_nr,"2",true) == 0)
                {
                    SendClientMessageToAll(COLOR_GREEN, "{00FA9A}[WAR]: {8B5A2B}Triads-{DBDB70}LSV{D3D3D3}-{66CD00}Grove {00FA9A}au declarat WAR , zona: {FFFFFF}BS/LS");
                    return 1;
                }
                else if(strcmp(x_nr,"3",true) == 0)
                {
                    SendClientMessageToAll(COLOR_GREEN, "{00FA9A}[WAR]: {8B5A2B}Triads-{DBDB70}LSV{D3D3D3}-{66CD00}Grove {00FA9A}au declarat WAR , zona: {FFFFFF}Blue Berry");
                    return 1;
                }
            }
            else if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pLeader] == 17 || PlayerInfo[playerid][pLeader] == 16)
            {
                acceptwar = 1;
                new x_nr[256];
                x_nr = strtok(cmdtext, idx);
                if(!strlen(x_nr))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /startwar list , /startwar [locul]");
                    return 1;
                }
                if(strcmp(x_nr,"list",true) == 0)
                {
                    SendClientMessage(playerid, COLOR_YELLOW, "_________Locuri_List_________");
                    SendClientMessage(playerid, COLOR_GRAD1, "1: GS/LS 2: BS/LS 3: Blue Berry");
                    return 1;
                }
                else if(strcmp(x_nr,"1",true) == 0)
                {
                    SendClientMessageToAll(COLOR_GREEN, "{00FA9A}[WAR]: {EE2C2C}Mafia{D3D3D3}-{97FFFF}VLA{D3D3D3}-{CD3278}Ballas {00FA9A}au declarat WAR , zona: {FFFFFF}GS/LS");
                    return 1;
                }
                else if(strcmp(x_nr,"2",true) == 0)
                {
                    SendClientMessageToAll(COLOR_GREEN, "{00FA9A}[WAR]: {EE2C2C}Mafia{D3D3D3}-{97FFFF}VLA{D3D3D3}-{CD3278}Ballas {00FA9A}au declarat WAR , zona: {FFFFFF}BS/LS");
                    return 1;
                }
                else if(strcmp(x_nr,"3",true) == 0)
                {
                    SendClientMessageToAll(COLOR_GREEN, "{00FA9A}[WAR]: {EE2C2C}Mafia{D3D3D3}-{97FFFF}VLA{D3D3D3}-{CD3278}Ballas {00FA9A}au declarat WAR , zona: {FFFFFF}Blue Berry");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "You are not a gang / mafia leader!");
                return 1;
            }
            wtimer[playerid] = 300;
        }
        return 1;
    }
    if(strcmp(cmd, "/acceptwar", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(acceptwar == 1)
            {
                if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pLeader] == 17 || PlayerInfo[playerid][pLeader] == 16)
                {
                    acceptwar = 0;
                    SendClientMessageToAll(COLOR_BLUE,"{00FA9A}|________WAR Started________|");
                    SendClientMessageToAll(COLOR_BLUE,"{EE2C2C}Mafia{D3D3D3}-{97FFFF}VLA{D3D3D3}-{CD3278}Ballas {00FA9A}au acceptat WARUL!");
                    SendClientMessageToAll(COLOR_BLUE,"{00FA9A}Va rugam , evitati acea zona!");
                    SendClientMessageToAll(COLOR_BLUE,"{00FA9A}|_____WAR Started_____|");
                    SetTimer("WarEnded", 90000, 0);
                    for(new i;i < MAX_TEAMS;i++)
                    {
                        Killing[i] = 0;
                    }
                    IsWar = true;
                }
                else if(PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pLeader] == 15 || PlayerInfo[playerid][pLeader] == 18)
                {
                    acceptwar = 0;
                    SendClientMessageToAll(COLOR_BLUE,"{00FA9A}|________WAR Started________|");
                    SendClientMessageToAll(COLOR_BLUE,"{D3D3D3}Triads-{DBDB70}LSV{D3D3D3}-{66CD00}Grove {00FA9A}au acceptat WARUL!");
                    SendClientMessageToAll(COLOR_BLUE,"{00FA9A}Va rugam , evitati acea zona!");
                    SendClientMessageToAll(COLOR_BLUE,"{00FA9A}|________WAR Started________|");
                    SetTimer("WarEnded", 90000, 0);
                    for(new i;i < MAX_TEAMS;i++)
                    {
                        Killing[i] = 0;
                    }
                    IsWar = true;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY,"    you are not authorized to use this command(LEADERS ONLY)");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   there wasn't any war proposed");
            }
        }
        return 1;
    }
        if(strcmp(cmd, "/warscore", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsWar == false)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "{00FA9A}[War-Time] {2641FE}Waru este oprit .");
                return 1;
            }
            if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pLeader] == 15 || PlayerInfo[playerid][pLeader] == 16 || PlayerInfo[playerid][pLeader] == 17 || PlayerInfo[playerid][pLeader] == 18)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "{2641FE}|=======================| {00FA9A}War Scores{2641FE} |=======================|");
                if(Killing[18] + Killing[6] + Killing[15] > Killing[5] + Killing[16] + Killing[17])
                {
                    format(string, sizeof(string), "{2641FE}1.ST | {D3D3D3}Triads {00FA9A}+ {DBDB70}LSV {00FA9A}+ {66CD00}Grove {00FA9A}= %d .", Killing[18] + Killing[6] + Killing[15]);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                    format(string, sizeof(string), "{2641FE}2.ST | {EE2C2C}The Mafia {00FA9A}+ {97FFFF}VLA {00FA9A}+ {CD3278}Ballas {00FA9A}= %d .", Killing[5] + Killing[16] + Killing[17]);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                }
                else if(Killing[18] + Killing[6] + Killing[15] < Killing[5] + Killing[16] + Killing[17])
                {
                    format(string, sizeof(string), "{2641FE}1.ST | {EE2C2C}The Mafia {00FA9A}+ {97FFFF}VLA {00FA9A}+ {CD3278}Ballas {00FA9A}= %d .", Killing[5] + Killing[16] + Killing[17]);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                    format(string, sizeof(string), "{2641FE}2.ST | {D3D3D3}Triads {00FA9A}+ {DBDB70}LSV {00FA9A}+ {66CD00}Grove {00FA9A}= %d .", Killing[18] + Killing[6] + Killing[15]);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                }
                else if(Killing[18] + Killing[6] + Killing[15] == Killing[5] + Killing[16] + Killing[17])
                {
                    format(string, sizeof(string), "{2641FE}1.ST | {EE2C2C}The Mafia {00FA9A}+ {97FFFF}VLA {00FA9A}+ {CD3278}Ballas {00FA9A}= %d .", Killing[5] + Killing[16] + Killing[17]);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                    format(string, sizeof(string), "{2641FE}2.ST | {D3D3D3}Triads {00FA9A}+ {DBDB70}LSV {00FA9A}+ {66CD00}Grove {00FA9A}= %d .", Killing[18] + Killing[6] + Killing[15]);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                }
            }
            else if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pMember] == 18)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "{2641FE}|=======================| {00FA9A}War Scores{2641FE} |=======================|");
                if(Killing[18] + Killing[6] + Killing[15] > Killing[5] + Killing[16] + Killing[17])
                {
                    format(string, sizeof(string), "{2641FE}1.ST | {D3D3D3}Triads {00FA9A}+ {DBDB70}LSV {00FA9A}+ {66CD00}Grove {00FA9A}= %d .", Killing[18] + Killing[6] + Killing[15]);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                    format(string, sizeof(string), "{2641FE}2.ST | {EE2C2C}The Mafia {00FA9A}+ {97FFFF}VLA {00FA9A}+ {CD3278}Ballas {00FA9A}= %d .", Killing[5] + Killing[16] + Killing[17]);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                }
                else if(Killing[18] + Killing[6] + Killing[15] < Killing[5] + Killing[16] + Killing[17])
                {
                    format(string, sizeof(string), "{2641FE}1.ST | {EE2C2C}The Mafia {00FA9A}+ {97FFFF}VLA {00FA9A}+ {CD3278}Ballas {00FA9A}= %d .", Killing[5] + Killing[16] + Killing[17]);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                    format(string, sizeof(string), "{2641FE}2.ST | {D3D3D3}Triads {00FA9A}+ {DBDB70}LSV {00FA9A}+ {66CD00}Grove {00FA9A}= %d .", Killing[18] + Killing[6] + Killing[15]);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                }
                else if(Killing[18] + Killing[6] + Killing[15] == Killing[5] + Killing[16] + Killing[17])
                {
                    format(string, sizeof(string), "{2641FE}1.ST | {EE2C2C}The Mafia {00FA9A}+ {97FFFF}VLA {00FA9A}+ {CD3278}Ballas {00FA9A}= %d .", Killing[5] + Killing[16] + Killing[17]);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                    format(string, sizeof(string), "{2641FE}2.ST | {D3D3D3}Triads {00FA9A}+ {DBDB70}LSV {00FA9A}+ {66CD00}Grove {00FA9A}= %d .", Killing[18] + Killing[6] + Killing[15]);
                    SendClientMessage(playerid, COLOR_GRAD1, string);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "You are not a gang / mafia leader!");
                return 1;
            }
        }
        return 1;
    }
    if(strcmp(cmd, "/topwar", true) == 0)
    {
        new astr[128];
        format(astr,128,"{1B8106}|_______________ War Victorii _______________|",Alianta1Puncte);
        SendClientMessage(playerid,~0,astr);
        format(astr,128,"{FCFCFC}* {63380A}Triads {808000}LSV {008000}Grove {FCFCFC}au castigat : {FF0000}%d{FFFFFF} waruri",WarStats[pAlliance2Wins]);
        SendClientMessage(playerid,~0,astr);
        format(astr,128,"{FCFCFC}* {800000}Mafia {01FCFF}VLA {8117AE}Ballas {FCFCFC}au castigat : {FF0000}%d{FFFFFF} waruri",WarStats[pAlliance1Wins]);
        SendClientMessage(playerid,~0,astr);
        format(astr,128,"{1B8106}|_______________ War Victorii _______________|",Alianta2Puncte);
        SendClientMessage(playerid,~0,astr);
        return 1;
    }
    if(strcmp(cmd, "/wartimeleft", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsWar == false)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "{00FA9A}[War-Time] {2641FE}Waru este oprit .");
                return 1;
            }
            if(PlayerInfo[playerid][pLeader] == 5 || PlayerInfo[playerid][pLeader] == 6 || PlayerInfo[playerid][pLeader] == 15 || PlayerInfo[playerid][pLeader] == 16 || PlayerInfo[playerid][pLeader] == 17 || PlayerInfo[playerid][pLeader] == 18)
            {
                format(string, sizeof(string), "{00FA9A}[War-Time] {2641FE}Au mai ramas {66CD00}%d{2641FE} secunde .", WarSecondEnd);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
            else if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pMember] == 18)
            {
                format(string, sizeof(string), "{00FA9A}[War-Time] {2641FE}Au mai ramas {66CD00}%d{2641FE} secunde .", WarSecondEnd);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD2, "You are not a gang / mafia leader!");
                return 1;
            }
        }
        return 1;
    }
mai am astea deaspura la onplayerdeath :
pawn Code:
forward WarEnded();
public WarEnded()
{
    if(WarSecondEnd == 0)
    {
        new str[128];
        IsWar = false;
        format(str, 128,"{FFFFFF}[WAR OVER]:The Triads-LSV-Grove: %d kills ||| The Mafia-VLA-Ballas: %d kills,",Killing[18] + Killing[6] + Killing[15], Killing[5] + Killing[17] + Killing[16]);
        SendClientMessageToAll(COLOR_WHITE,str);
        if(Killing[18] + Killing[6] + Killing[15] > Killing[5] + Killing[16] + Killing[17])
        {
            for(new a; a<MAX_PLAYERS;a++)
            {
                if(PlayerInfo[a][pLeader] == 18 || PlayerInfo[a][pLeader] == 6 || PlayerInfo[a][pLeader] == 15 || PlayerInfo[a][pMember] == 18 || PlayerInfo[a][pMember] == 6 || PlayerInfo[a][pMember] == 16)
                {
                    PlayerInfo[a][pMats] += 5000;
                    PlayerInfo[a][pDrugs] += 500;
                    GivePlayerMoney(a, 50000);
                }
            }
            SendClientMessageToAll(COLOR_WHITE,"Triads-LSV-Grove Win the war");
            SendClientMessageToAll(COLOR_WHITE,"{00FA9A}Membrii aliantei castigatoare au primit 15000 mats, 5500 drugs si $50.000 pentru castigarea warului!");
        }
        else
        {
            for(new k; k<MAX_PLAYERS;k++)
            {
                if(PlayerInfo[k][pLeader] == 5 || PlayerInfo[k][pLeader] == 16 || PlayerInfo[k][pLeader] == 17 || PlayerInfo[k][pMember] == 5 || PlayerInfo[k][pMember] == 16 || PlayerInfo[k][pMember] == 17)
                {
                    PlayerInfo[k][pMats] += 5000;
                    PlayerInfo[k][pDrugs] += 500;
                    GivePlayerMoney(k, 50000);
                }
            }
            SendClientMessageToAll(COLOR_WHITE,"Mafia-VLA-Ballas Win the war");
            SendClientMessageToAll(COLOR_WHITE,"{00FA9A}Membrii aliantei castigatoare au primit 15000 mats, 5500 drugs si $50.000 pentru castigarea warului!");
        }
        for(new i;i<MAX_TEAMS;i++)
        {
            Killing[i] = 0;
        }
        KillTimer(WarTimer);
        WarSecondEnd = 1200;
    }
    else
    {
        WarSecondEnd--;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)