Problem sistem war
#1

I did a war system, this system includes "fail-site", ie when there is no one opposing mafia territory, the other mafia win territory. The problem is that when you give war and leaving the territory, did not stop nor gangzoneflashplayer Timmer your site, and I can not fail to have received the message.

public SetPlayerUnJail
pawn Код:
for(new i = 0; i < sizeof( GangInfo ); i++)
    {
       
        new count = 0;
        new att = WarInfo[ i ][ wAttacker ];
        new deff = WarInfo[ i ][ wFaction ];
        if( GangInfo[ i ][ gDeelay ] > 0 ) GangInfo[ i ][ gDeelay ]--;
       
        if(WarInfo[i][wTime] > 0)
        {
            WarInfo[i][wTime] -= 1;
            foreach(Player, x)
            {
                new pGroup = PlayerInfo[ x ][ pMember ] && PlayerInfo[ x ][ pLeader ];
                if( pGroup == WarInfo[ i ][ wAttacker ] )
                {
                    if( GetPlayerZone( x ) == i )
                    {
                        count ++;
                    }
                }

                if( GangInfo[ pGroup ][ gInWar ] == 0 )
                {
                    foreach(Player, a)
                    {
                        SetPlayerMarkerForPlayer( x, a, ( GetPlayerColor( a ) & 0xFFFFFF00 ) );
                    }
                }
               
                if( pGroup == WarInfo[i][wAttacker] || pGroup == WarInfo[ i ][ wFaction ] )
                {
                    new time = WarInfo[i][wTime];
                    TextDrawShowForPlayer(x, tTimer[x]);
                    format(string, sizeof(string), "Turf timer: ~y~%s ~w~", CalculeazaTimp(time));
                    TextDrawSetString(tTimer[x], string);
                    GangZoneFlashForPlayer(x, Turfs[i], COLOR_RED);
                    if( GetPlayerZone( x ) == i )
                    {
                        if(IsPlayerInAnyVehicle(x))
                        {
                            if(JustRemoved[x] == 0)
                            {
                                RemovePlayerFromVehicle(x);
                                SendClientMessage(x, COLOR_YELLOW, "Nu ai voie cu masini in zona de war.");
                                JustRemoved[x] = 1;
                            }
                        }
                    }

                    foreach(Player, a)
                    {
                        if((pGroup == WarInfo[i][wAttacker] || pGroup == WarInfo[i][wFaction]) && GangInfo[pGroup][gInWar] == 1 && (PlayerInfo[ a ][ pMember ] + PlayerInfo[ a ][ pLeader ] == WarInfo[i][wAttacker] || PlayerInfo[ a ][ pMember ] + PlayerInfo[ a ][ pLeader ] == WarInfo[i][wFaction]))
                        {
                            SetPlayerMarkerForPlayer(x, a, GetPlayerColor(a));
                        }
                    }

                    if( GetPlayerState(x) == PLAYER_STATE_ONFOOT )
                    {
                        JustRemoved[x] = 0;
                    }

                }
                else if( pGroup == 0)
                {
                    TextDrawHideForPlayer(x, tTimer[x]);
                    GangZoneStopFlashForPlayer(x, Turfs[i]);
                }
            }
            if(count == 0)
            {
                GangInfo[ WarInfo[ i ][ wFaction ] ][ gInWar ] = 0;
                GangInfo[ WarInfo[ i ][ wAttacker ] ][ gInWar ] = 0;
                GangInfo[ att ][ gDeelay ] = 600;
                new id = CalculateBestScore( i ), id2 = CalculateWorstScore( i );
                format(szMessage, sizeof(szMessage), "--------------------[war overview]-----------------");
                SendToGroup(att, COLOR_ATTACK, szMessage);
                SendToGroup(deff, COLOR_ATTACK, szMessage);
                format(szMessage, sizeof(szMessage), "Score: %s %d - %d %s", FactionName[ WarInfo[ i ][ wAttacker ] ], GangInfo[ WarInfo[ i ][ wAttacker ] ][ gScore ], GangInfo[ deff ][ gScore ], FactionName[ deff ] );
                SendToGroup(att, COLOR_ATTACK, szMessage);
                SendToGroup(deff, COLOR_ATTACK, szMessage);
                format(szMessage, sizeof(szMessage), "Best score: %s (%i). Worst score: %s (%i)", cleanName( id ), PlayerInfo[id][pWarScore] - PlayerInfo[id][pWarDeaths], cleanName( id2 ), PlayerInfo[id2][pWarScore] - PlayerInfo[id2][pWarDeaths]);
                SendToGroup(att, COLOR_ATTACK, szMessage);
                SendToGroup(deff, COLOR_ATTACK, szMessage);
                foreach(Player, z)
                {
                    TextDrawHideForPlayer(z, tTimer[z]);
                    if( PlayerInfo[ z ][ pMember ] && PlayerInfo[ z ][ pLeader ] == att || PlayerInfo[ z ][ pMember ] && PlayerInfo[ z ][ pLeader ] == deff )
                    {
                        foreach(Player, a)
                        {
                            SetPlayerMarkerForPlayer( z, a, ( GetPlayerColor( a ) & 0xFFFFFF00 ) );
                        }
                        TextDrawHideForPlayer(z, tTimer[z]);
                        format(szMessage, sizeof(szMessage), "Your personal score: %i", PlayerInfo[z][pWarScore] - PlayerInfo[z][pWarDeaths]);
                        SendClientMessage(z, COLOR_ATTACK, szMessage);
                        PlayerInfo[z][pWarScore] = 0;
                        PlayerInfo[z][pWarDeaths] = 0;
                        UpdateGangZones(z);
                        TextDrawHideForPlayer(z, War0[z]);
                        TextDrawHideForPlayer(z, War1[z]);
                        TextDrawHideForPlayer(z, War2[z]);
                        TextDrawHideForPlayer(z, War3[z]);
                        JustRemoved[z] = 0;
                    }
                }
                format(szMessage, sizeof(szMessage), "-------------------------------------");
                SendToGroup(att, COLOR_ATTACK, szMessage);
                SendToGroup(deff, COLOR_ATTACK, szMessage);
                format(szMessage, sizeof(szMessage), "[WAR] %s failed to win turf %i owned by %s because they left the turf.", FactionName[ att ], FactionName[ deff ] );
                SendToGroup(att, COLOR_ATTACK, szMessage);
                SendToGroup(deff, COLOR_ATTACK, szMessage);
                GangZoneStopFlashForAll(Turfs[i]);
                WarInfo[i][wTime] = 0;
                WarInfo[i][wAttacker] = 0;
                WarInfo[i][wFaction] = 0;
            }
            if(WarInfo[i][wTime] == 2)
            {
                if(GangInfo[WarInfo[i][wAttacker]][gScore] > GangInfo[WarInfo[i][wFaction]][gScore])
                {
                    GangInfo[ i ][ gFaction ] = WarInfo[i][wAttacker];
                    SaveTeritorii( );
                    format(szMessage, sizeof(szMessage), "War INFO: Gruparea mafiota %s a cucerit teritoriul #%i care era detinut de mafia %s.", FactionName[ att ], i, FactionName[ deff ] );
                    SendClientMessageToAll( -1, szMessage);
                    GangInfo[att][gDeelay] = 300;
                }
                else if(GangInfo[WarInfo[i][wAttacker]][gScore] < GangInfo[WarInfo[i][wFaction]][gScore])
                {
                    GangInfo[ i ][ gFaction ] = WarInfo[i][wFaction];
                    SaveTeritorii();
                    GangInfo[att][gDeelay] = 600;
                    format(szMessage, sizeof(szMessage), "[WAR] %s failed to win turf %i owned by %s.", FactionName[ att ], i, FactionName[ deff ]);
                    SendToGroup(att, COLOR_ATTACK, szMessage);
                    SendToGroup(deff, COLOR_ATTACK, szMessage);
                }
                else if(GangInfo[WarInfo[i][wAttacker]][gScore] == GangInfo[WarInfo[i][wFaction]][gScore])
                {
                    GangInfo[ i ][ gFaction ] = WarInfo[i][wFaction];
                    SaveTeritorii();
                    GangInfo[att][gDeelay] = 600;
                    format(szMessage, sizeof(szMessage), "[WAR] %s failed to win turf %i owned by %s.", FactionName[ att ], i, FactionName[ deff ]);
                    SendToGroup(att, COLOR_ATTACK, szMessage);
                    SendToGroup(deff, COLOR_ATTACK, szMessage);
                }
                GangInfo[ WarInfo[ i ][ wFaction ] ][ gInWar ] = 0;
                GangInfo[ WarInfo[ i ][ wAttacker ] ][ gInWar ] = 0;
                GangInfo[ att ][ gDeelay ] = 600;
                new id = CalculateBestScore( i ), id2 = CalculateWorstScore( i );
                format(szMessage, sizeof(szMessage), "--------------------[war overview]-----------------");
                SendToGroup(att, -1, szMessage);
                SendToGroup(deff, -1, szMessage);
                format(szMessage, sizeof(szMessage), "Score: %s %d - %d %s", FactionName[ WarInfo[ i ][ wAttacker ] ], GangInfo[ WarInfo[ i ][ wAttacker ] ][ gScore ], GangInfo[ deff ][ gScore ], FactionName[ deff ] );
                SendToGroup(att, -1, szMessage);
                SendToGroup(deff, -1, szMessage);
                format(szMessage, sizeof(szMessage), "Best score: %s (%i). Worst score: %s (%i)", cleanName( id ), PlayerInfo[id][pWarScore] - PlayerInfo[id][pWarDeaths], cleanName( id2 ), PlayerInfo[id2][pWarScore] - PlayerInfo[id2][pWarDeaths]);
                SendToGroup(att, -1, szMessage);
                SendToGroup(deff, -1, szMessage);
                foreach(Player, z)
                {
                    TextDrawHideForPlayer(z, tTimer[z]);
                    if( PlayerInfo[ z ][ pMember ] + PlayerInfo[ z ][ pLeader ] == att || PlayerInfo[ z ][ pMember ] + PlayerInfo[ z ][ pLeader ] == deff )
                    {
                        foreach(Player, a)
                        {
                            SetPlayerMarkerForPlayer( z, a, ( GetPlayerColor( a ) & 0xFFFFFF00 ) );
                        }
                        TextDrawHideForPlayer(z, tTimer[z]);
                        format(szMessage, sizeof(szMessage), "Your personal score: %i", PlayerInfo[z][pWarScore] - PlayerInfo[z][pWarDeaths]);
                        SendClientMessage(z, COLOR_ATTACK, szMessage);
                        PlayerInfo[z][pWarScore] = 0;
                        PlayerInfo[z][pWarDeaths] = 0;
                        UpdateGangZones(z);
                        TextDrawHideForPlayer(z, War0[z]);
                        TextDrawHideForPlayer(z, War1[z]);
                        TextDrawHideForPlayer(z, War2[z]);
                        TextDrawHideForPlayer(z, War3[z]);
                        JustRemoved[z] = 0;
                    }
                }
                format(szMessage, sizeof(szMessage), "-------------------------------------");
                SendToGroup(att, COLOR_ATTACK, szMessage);
                SendToGroup(deff, COLOR_ATTACK, szMessage);
                GangZoneStopFlashForAll(Turfs[i]);
                WarInfo[i][wTime] = 0;
                WarInfo[i][wAttacker] = 0;
                WarInfo[i][wFaction] = 0;
            }
        }
    }
Command:
pawn Код:
CMD:attack( playerid, params[ ] )
{
    if( !IsAGang( playerid ) ) return SendClientMessage( playerid, -1, "Nu faci parte dintr-o mafie." );
    if( PlayerInfo[ playerid ][ pRank ] > 4 ) {} else return SendClientMessage( playerid, -1, "Nu ai rankul necesar pentru a folosi aceasta comanda." );
    new samp[256], faction = PlayerInfo[ playerid ][ pLeader ] + PlayerInfo[ playerid ][ pMember ];
    format(samp, sizeof(samp), "Mafia ta mai poate ataca dupa %s minute.", CalculeazaTimp( GangInfo[ faction ][ gDeelay ] ) );
    if( GangInfo[ faction ][ gDeelay ] > 0 ) return SendClientMessage( playerid, -1, samp );
    new hour,minute,second;
    gettime( hour, minute, second);
    if( ( hour >= 20 ) && ( hour <= 22 ) )
    {
        new sendername[MAX_PLAYER_NAME];
        new turf = GetPlayerZone( playerid ), string[256];
        if( turf == 0 ) return SCM( playerid, COLOR_WHITE, "You aren't in a turf!" );
        if( WarInfo[ turf ][ wAttacker ] != 0 ) return SCM( playerid, COLOR_WHITE, "This turf is already attacked!" );
        if( GangInfo[ turf ][ gFaction ] == faction ) return SCM(playerid, COLOR_WHITE, "You can't attack your turf");
        if( GangInfo[ faction ][ gInWar ] == 1 ) return SCM(playerid, COLOR_WHITE, "This faction is already in a war!");
        GetPlayerName(playerid, sendername, sizeof(sendername));

        WarInfo[turf][wAttacker] = faction;
        WarInfo[turf][wFaction] = GangInfo[ turf ][ gFaction ];
        WarInfo[turf][wTime] = 600;

        format(string, sizeof(string),"{FF0000}[TURF] %s from your group attacked turf %d (owned by %s).",sendername, turf, FactionName[ GangInfo[ turf ][ gFaction ] ] );
        SendToGroup( faction, -1, string);

        format(string, sizeof(string),"{FF0000}[TURF] %s from %s attacked turf %i owned by you.",sendername, FactionName[ faction ], turf );
        SendToGroup( GangInfo[ turf ][ gFaction ], -1, string);

        GangInfo[ WarInfo[ turf ][ wFaction ] ][ gScore ] = 0;
        GangInfo[ WarInfo[ turf ][ wAttacker ] ][ gScore ] = 1;

        GangInfo[ WarInfo[ turf ][ wFaction ] ][ gInWar ] = 1;
        GangInfo[ WarInfo[ turf ][ wAttacker ] ][ gInWar ] = 1;

        foreach(Player, i)
        {
            if( PlayerInfo[ i ][ pMember ] + PlayerInfo[ i ][ pLeader ] == WarInfo[ turf ][ wAttacker ] || PlayerInfo[ i ][ pMember ] + PlayerInfo[ i ][ pLeader ] == WarInfo[ turf ][ wFaction ] )
            {
                format( string, sizeof( string ), "Turf timer: ~y~%s ~w~", CalculeazaTimp( WarInfo[ turf ][ wTime ] ) );
                TextDrawSetString( tTimer[ i ], string );
                TextDrawShowForPlayer( i, tTimer[ i ] );
                PlayerInfo[ i ][ pWarScore ] = 0;
                PlayerInfo[ i ][ pWarDeaths ] = 0;
                GangZoneFlashForPlayer( i, Turfs[turf], 0xFF000080 );

            }
        }
    }
    else return SCM(playerid, COLOR_TEAL,"Poti ataca doar intre 20-22.");
    return 1;
}
Reply
#2

Needless this loop...

Use:
GangZoneFlashForAll(ZONE, COLOR); and GangZoneStopFlashForAll(ZONE);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)