Starting a turf war
#1

I'm having some problem when I try to start a war by using /war command.I want the command to read the gangzone that I am on, so it should know which is the gangzone where the war was started at.

I'm typing /war and it starts the war at gangzone number 1.

PHP код:
if(strcmp(cmd, "/war", true) == 0)
    {
        if(
IsAMafia(playerid))
        {
            new 
rhour, rminute, rsecond, zone[MAX_ZONE_NAME];
            
GetPlayer2DRadarZone(playerid, zone, sizeof(zone));
            
gettime(rhour, rminute, rsecond);
            if(
rhour < 6) return SendClientMessage(playerid, COLOR_WHITE, "(( "COL_OOC"War System"COL_WHITE" )) You cannot start a war at this time.");
           for(new 
ward = 1;ward<=51; ward++)
            {
                new 
side[MAX_PLAYERS], ncount=0;
                if(
PlayerInfo[playerid][pLeader] != 0) side[playerid] = PlayerInfo[playerid][pLeader]; else if(PlayerInfo[playerid][pMember] != 0) side[playerid] = PlayerInfo[playerid][pMember];
                for(new 
n=1; n<sizeof(GangInfo); n++)
                {
                    if(
GangInfo[n][gFaction] == side[playerid]) ncount++;
                }
                if(
PlayerInfo[playerid][pRank] >= 5) {} else return SendClientMessage(playerid, COLOR_WHITE, "(( "COL_OOC"War System"COL_WHITE" )) You are not allowed to use this command.");
                if(
GetPlayerInterior(playerid) != 0) return 1;
                if(
War != 0) return SendClientMessage(playerid, COLOR_WHITE, "(( "COL_OOC"War System"COL_WHITE" )) There's already a war in progress.");
                if(
Warallowed == 0) return SendClientMessage(playerid, COLOR_WHITE, "(( "COL_OOC"War System"COL_WHITE" )) Wars are currently turned off.");
                
GetPlayerName(playerid, sendername, sizeof(sendername));
                
format(string, sizeof(string), "(( "COL_OOC"War System"COL_WHITE" )) This is your turf, you cannot attack it.", GangInfo[ward][gHours]);
                if(
GangInfo[ward][gFaction] == PlayerInfo[playerid][pLeader]) return SendClientMessage(playerid, COLOR_WHITE, string);
                new 
ftext[60], ftext1[60];
                if(
PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5) format(ftext, sizeof(ftext), ""COL_MAFIA"The Mafia{FFFFFF}");
                if(
PlayerInfo[playerid][pMember] == 6 || PlayerInfo[playerid][pLeader] == 6) format(ftext, sizeof(ftext), ""COL_TRIADS"The Triads{FFFFFF}");
                if(
PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12) format(ftext, sizeof(ftext), ""COL_GROVE"Grove Street{FFFFFF}");
                if(
PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13) format(ftext, sizeof(ftext), ""COL_BALLAS"Ballas{FFFFFF}");
                if(
PlayerInfo[playerid][pMember] == 14 || PlayerInfo[playerid][pLeader] == 14) format(ftext, sizeof(ftext), ""COL_LSV"Los Santos Vagos{FFFFFF}");
                if(
PlayerInfo[playerid][pMember] == 15 || PlayerInfo[playerid][pLeader] == 15) format(ftext, sizeof(ftext), ""COL_VLA"Varrios Los Aztecas{FFFFFF}");
                if(
GangInfo[ward][gFaction] == 5) format(ftext1, sizeof(ftext1), ""COL_MAFIA"The Mafia{FFFFFF}");
                if(
GangInfo[ward][gFaction] == 6) format(ftext1, sizeof(ftext1), ""COL_TRIADS"The Triads{FFFFFF}");
                if(
GangInfo[ward][gFaction] == 12) format(ftext1, sizeof(ftext1), ""COL_GROVE"Grove Street{FFFFFF}");
                if(
GangInfo[ward][gFaction] == 13) format(ftext1, sizeof(ftext1), ""COL_BALLAS"Ballas{FFFFFF}");
                if(
GangInfo[ward][gFaction] == 14) format(ftext1, sizeof(ftext1), ""COL_LSV"Los Santos Vagos{FFFFFF}");
                if(
GangInfo[ward][gFaction] == 15) format(ftext1, sizeof(ftext1), ""COL_VLA"Varrios Los Aztecas{FFFFFF}");
                
format(string, sizeof(string), "(( "COL_OOC"War System"COL_WHITE" )) %s has started a war against %s!", ftext, ftext1);
                
BroadCast(COLOR_WHITE,string);
                
format(string, sizeof(string), "(( "COL_OOC"War System"COL_WHITE" )) The war is taking place at "COL_RED"%s"COL_WHITE".", zone);
                
BroadCast(COLOR_WHITE,string);
                
GangZoneFlashForAll(turf[ward], COLOR_WHITE);
                
WarStarted=1;
                
WarF = side[playerid];
                
WarF1 = GangInfo[ward][gFaction];
                
WarZone = ward;
                for(new 
w = 0; w < sizeof(GangInfo); w++)
                {
                    
WarPoints[w] = 0;
                }
                if(
side[playerid] == 5 || side[playerid] == 13 || side[playerid] == 14) WarAttack1 = 1; else WarAttack1 = 2;
                if(
GangInfo[ward][gFaction] == 5 || GangInfo[ward][gFaction] == 13 || GangInfo[ward][gFaction] == 14) WarAttack2 = 1; else WarAttack2 = 2;
                if(
IsAIAlliance(playerid)) War = 1; else if(IsAAAlliance(playerid)) War = 2;
                
WarMan1 = 999;
                
WarMan2 = 999;
                
WarScore1 = 0;
                
WarScore2 = 0;
                
SetTimer("EndWar", 60000, 1);
                for(new 
i=0; i<MAX_PLAYERS; i++)
                {
                    
WarStats1[i] = 0;
                    
WarStats2[i] = 0;
                    if(
IsAIAlliance(i) || IsAAAlliance(i))
                    {
                        
format(string, sizeof(string), "(( "COL_OOC"War System"COL_WHITE" )) "COL_BLUE"%s "COL_WHITE"from %s has started a war, you have to do your best in next 15 minutes in order to win.", sendername, ftext);
                        
SendClientMessage(i, COLOR_WHITE, string);
                    }
                }
            }
        }
    } 
Reply
#2

Any idea?
Reply


Forum Jump:


Users browsing this thread: