Gangwar Help! [+REP]
#8

Quote:
Originally Posted by F1aw1ess
View Post
Do what AiRaLoKa said but in the include itself.

It should work
PHP Code:
#define FILTERSCRIPT
#define TEAM_GROVE 1
#define TEAM_BALLAS 2
#define TEAM_VAGOS 3
new ZoneDeaths[sizeof(ZoneInfo)];
new 
ZoneInfo[][eZone] = {
    {
2337.9004,-1808.8383,2590.2043,-1610.3673,TEAM_GROVE},
    {
2084.7,-1808.8383,2337.9004,-1610.3673,TEAM_BALLAS},
    {
2590.2043,-1808.8383,2842.3,-1610.3673,TEAM_VAGOS}
};
new 
ZoneID[sizeof(ZoneInfo)];
#define TAKEOVER_TIME 120 // how many seconds needed to take over the zone
#define MIN_MEMBERS_TO_START_WAR 2
#define TAKEOVER_TIME 120 // how many seconds needed to take over the zone
#define MIN_DEATHS_TO_START_WAR 2 // how many team members must be killed in a zone to start a war
new Teams[] = {
    
TEAM_GROVE,
    
TEAM_BALLAS,
    
TEAM_VAGOS
};// how many team members needed in a zone to start a war
new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...};
new 
ZoneAttackTime[sizeof(ZoneInfo)];
#include <a_samp>
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Gangwar by Deadly");
    print(
"--------------------------------------\n");
    for(new 
i=0sizeof(ZoneInfo); i++)
{
    
ZoneID[i] = GangZoneCreate(ZoneInfo[i][zMinX], ZoneInfo[i][zMinY], ZoneInfo[i][zMaxX], ZoneInfo[i][zMaxY]);
    
SetTimer("ZoneTimer"1000true);
    
SetTimer("ZoneTimer"1000true);
}
    return 
1;
}
stock IsPlayerInZone(playeridzoneid)
{
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    return (
ZoneInfo[zoneid][zMinX] && ZoneInfo[zoneid][zMaxX] && ZoneInfo[zoneid][zMinY] && ZoneInfo[zoneid][zMaxY]);
}
stock GetPlayersInZone(zoneidteamid)
{
    new 
count;
    for(new 
i=0MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i) && GetPlayerTeam(i) == teamid && IsPlayerInZone(izoneid))
        {
            
count++;
        }
    }
    return 
count;
}
enum eZone
{
    
Float:zMinX,
    
Float:zMinY,
    
Float:zMaxX,
    
Float:zMaxY,
    
zTeam
}
public 
OnFilterScriptExit()
{
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    for(new 
i=0sizeof(ZoneInfo); i++)
{
    
GangZoneShowForPlayer(playeridZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
}
for(new 
i=0sizeof(ZoneInfo); i++)
{
    
GangZoneShowForPlayer(playeridZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
    if(
ZoneAttacker[i] != -1GangZoneFlashForPlayer(playeridZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
}
    return 
1;
}
stock GetTeamZoneColor(teamid)
{
    switch(
teamid)
    {
        case 
TEAM_GROVE: return 0x00FF0088;
        case 
TEAM_BALLAS: return 0xFF00FF88;
        case 
TEAM_VAGOS: return 0xFFFF0088;
    }
    return -
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    if(
IsPlayerConnected(killerid) && GetPlayerTeam(playerid) != GetPlayerTeam(killerid)) // not a suicide or team kill
{
    new 
zoneid GetPlayerZone(playerid);
    if(
zoneid != -&& ZoneInfo[zoneid][zTeam] == GetPlayerTeam(playerid)) // zone member has been killed in the zone
    
{
        
ZoneDeaths[zoneid]++;
        if(
ZoneDeaths[zoneid] == MIN_DEATHS_TO_START_WAR)
        {
            
ZoneDeaths[zoneid] = 0;
            
ZoneAttacker[zoneid] = GetPlayerTeam(killerid);
            
ZoneAttackTime[zoneid] = 0;
            
GangZoneFlashForAll(ZoneID[zoneid], GetTeamZoneColor(ZoneAttacker[zoneid]));
        }
    }
}
    return 
1;
}
public 
OnVehicleSpawn(vehicleid)
{
    return 
1;
}
public 
OnVehicleDeath(vehicleidkillerid)
{
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/mycommand"cmdtexttrue10) == 0)
    {
        
// Do something here
        
return 1;
    }
    return 
0;
}
public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    return 
1;
}
public 
OnPlayerEnterCheckpoint(playerid)
{
    return 
1;
}
public 
OnPlayerLeaveCheckpoint(playerid)
{
    return 
1;
}
public 
OnPlayerEnterRaceCheckpoint(playerid)
{
    return 
1;
}
public 
OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 
1;
}
public 
OnRconCommand(cmd[])
{
    return 
1;
}
public 
OnPlayerRequestSpawn(playerid)
{
    return 
1;
}
public 
OnObjectMoved(objectid)
{
    return 
1;
}
public 
OnPlayerObjectMoved(playeridobjectid)
{
    return 
1;
}
public 
OnPlayerPickUpPickup(playeridpickupid)
{
    return 
1;
}
public 
OnVehicleMod(playeridvehicleidcomponentid)
{
    return 
1;
}
public 
OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
    return 
1;
}
public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
    return 
1;
}
public 
OnPlayerSelectedMenuRow(playeridrow)
{
    return 
1;
}
public 
OnPlayerExitedMenu(playerid)
{
    return 
1;
}
public 
OnPlayerInteriorChange(playeridnewinterioridoldinteriorid)
{
    return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    return 
1;
}
public 
OnRconLoginAttempt(ip[], password[], success)
{
    return 
1;
}
public 
OnPlayerUpdate(playerid)
{
    return 
1;
}
public 
OnPlayerStreamIn(playeridforplayerid)
{
    return 
1;
}
public 
OnPlayerStreamOut(playeridforplayerid)
{
    return 
1;
}
public 
OnVehicleStreamIn(vehicleidforplayerid)
{
    return 
1;
}
public 
OnVehicleStreamOut(vehicleidforplayerid)
{
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    return 
1;
}
public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    return 
1;
}
public 
ZoneTimer()
{
    for(new 
i=0sizeof(ZoneInfo); i++) // loop all zones
    
{
        if(
ZoneAttacker[i] != -1// zone is being attacked
        
{
            if(
GetPlayersInZone(iZoneAttacker[i]) >= MIN_MEMBERS_TO_START_WAR// team has enough members in the zone
            
{
                
ZoneAttackTime[i]++;
                if(
ZoneAttackTime[i] == TAKEOVER_TIME// zone has been under attack for enough time and attackers take over the zone
                
{
                    
GangZoneStopFlashForAll(ZoneID[i]);
                    
ZoneInfo[i][zTeam] = ZoneAttacker[i];
                    
GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam])); // update the zone color for new team
                    
ZoneAttacker[i] = -1;
                }
            }
            else 
// attackers failed to take over the zone
            
{
                
GangZoneStopFlashForAll(ZoneID[i]);
                
ZoneAttacker[i] = -1;
            }
        }
        else 
// check if somebody is attacking
        
{
            for(new 
t=0sizeof(Teams); t++) // loop all teams
            
{
                if(
Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(iTeams[t]) >= MIN_MEMBERS_TO_START_WAR// if there are enough enemies in the zone
                
{
                    
ZoneAttacker[i] = Teams[t];
                    
ZoneAttackTime[i] = 0;
                    
GangZoneFlashForAll(ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
                }
            }
        }
    }
}
public 
ZoneTimer()
{
    for(new 
i=0sizeof(ZoneInfo); i++) // loop all zones
    
{
        if(
ZoneAttacker[i] != -1// zone is being attacked
        
{
            if(
GetPlayersInZone(iZoneAttacker[i]) >= 1// there must be at least 1 attacker left
            
{
                
ZoneAttackTime[i]++;
                if(
ZoneAttackTime[i] == TAKEOVER_TIME// zone has been under attack for enough time and attackers take over the zone
                
{
                    
GangZoneStopFlashForAll(ZoneID[i]);
                    
ZoneInfo[i][zTeam] = ZoneAttacker[i];
                    
GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam])); // update the zone color for new team
                    
ZoneAttacker[i] = -1;
                }
            }
            else 
// attackers failed to take over the zone
            
{
                
GangZoneStopFlashForAll(ZoneID[i]);
                
ZoneAttacker[i] = -1;
            }
        }
    }
}
stock GetPlayerZone(playerid)
{
    for(new 
i=0sizeof(ZoneInfo); i++)
    {
        if(
IsPlayerInZone(playeridi))
        {
            return 
i;
        }
    }
    return -
1;

Made it into a filterscript now i got these errors?
Code:
F:\IS\gamemodes\GIS.pwn(5) : error 017: undefined symbol "ZoneInfo"
F:\IS\gamemodes\GIS.pwn(6) : error 017: undefined symbol "eZone"
F:\IS\gamemodes\GIS.pwn(32) : error 017: undefined symbol "zMinX"
F:\IS\gamemodes\GIS.pwn(42) : error 017: undefined symbol "zMinX"
F:\IS\gamemodes\GIS.pwn(94) : warning 217: loose indentation
F:\IS\gamemodes\GIS.pwn(99) : warning 217: loose indentation
F:\IS\gamemodes\GIS.pwn(290) : warning 235: public function lacks forward declaration (symbol "ZoneTimer")
F:\IS\gamemodes\GIS.pwn(327) : warning 235: public function lacks forward declaration (symbol "ZoneTimer")
F:\IS\gamemodes\GIS.pwn(328) : error 021: symbol already defined: "ZoneTimer"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Reply


Messages In This Thread
Gangwar Help! [+REP] - by Iloveimpulse - 25.08.2014, 05:15
Re: Gangwar Help! [+REP] - by Thogy - 25.08.2014, 06:46
Re: Gangwar Help! [+REP] - by Iloveimpulse - 25.08.2014, 07:02
Re: Gangwar Help! [+REP] - by Spanes - 25.08.2014, 08:57
Re: Gangwar Help! [+REP] - by AiRaLoKa - 25.08.2014, 09:33
Re: Gangwar Help! [+REP] - by Iloveimpulse - 25.08.2014, 12:12
Re: Gangwar Help! [+REP] - by F1aw1ess - 25.08.2014, 12:14
Re: Gangwar Help! [+REP] - by Iloveimpulse - 25.08.2014, 12:18
Re: Gangwar Help! [+REP] - by F1aw1ess - 25.08.2014, 12:32
Re: Gangwar Help! [+REP] - by AiRaLoKa - 25.08.2014, 12:49

Forum Jump:


Users browsing this thread: 1 Guest(s)