[help] It won't take over gang zones.. -
ivanVU - 23.06.2012
I worked with this tutorial:
https://sampforum.blast.hk/showthread.php?tid=276352
Код:
new ZoneInfo[][eZone] = {
{-992.6194, 1903.494, -373.692, 2195.441,NICIJA}, // brana
{233.5575, 677.3168, 992.6194, 1039.331,NICIJA}, // kamenolom
{-2826.046, 2183.763, -2137.051, 2674.233,NICIJA}, // marina
{-163.4902, 2370.609, 490.4708, 2639.2,NICIJA}, // stari aero
{-105.1009, 1623.225, 432.0814, 2148.729,NICIJA}, // area51
{-1669.936, 443.7593, -712.3504, 1424.701,NICIJA} // mostovi
};
Creation of zones
Код:
for(new i=0; i < sizeof(ZoneInfo); i++)
{
ZoneID[i] = GangZoneCreate(ZoneInfo[i][zMinX], ZoneInfo[i][zMinY], ZoneInfo[i][zMaxX], ZoneInfo[i][zMaxY]);
}
Zone Showing
Код:
for(new i=0; i < sizeof(ZoneInfo); i++)
{
GangZoneShowForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
if(ZoneAttacker[i] != -1) GangZoneFlashForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
}
OnGameModeInIt
Код:
SetTimer("ZoneTimer", 1000, true);
callback ZoneTimer
Код:
forward ZoneTimer();
public ZoneTimer()
{
for(new i=0; i < sizeof(ZoneInfo); i++) // loop all zones
{
if(ZoneAttacker[i] != -1) // zone is being attacked
{
if(GetPlayersInZone(i, ZoneAttacker[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=0; t < sizeof(Teams); t++) // loop all teams
{
if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[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]));
}
}
}
}
}
I want to make that players can take over gang zones!
Re: [help] It won't take over gang zones.. - Jarnu - 23.06.2012
What exactly you want?
Re: [help] It won't take over gang zones.. -
ivanVU - 23.06.2012
ok, i fix that, but it becamed bugged again.
Код:
case 0:// The first item listed
{
if(PlayerInfo[playerid][pJezik] == 1)
{
if(PlayerInfo[playerid][pTeam] == 1) { usa--; }
if(PlayerInfo[playerid][pTeam] == 2) { euro--; }
if(PlayerInfo[playerid][pTeam] == 3) { rus--; }
if(PlayerInfo[playerid][pTeam] == 4) { jap--; }
if(PlayerInfo[playerid][pTeam] == 5) { aust--; }
if(usa < 1) { usa = 0; }
if(euro < 1) { euro = 0; }
if(rus < 1) { rus = 0; }
if(jap < 1) { jap = 0; }
if(aust < 1) { aust = 0; }
SendClientMessage(playerid, -1, "Odabrali ste Sjedinjene Americke Drzave kao svoj team!");
ShowPlayerDialog(playerid, 300, DIALOG_STYLE_LIST, "Odaberite klasu u kojoj zelite biti!", "Vojnik\nAnti-Tenk & Tenk\nSnajper\nPilot\nBolnicar\nMehanicar\nPiroman\nSpijun", "Odaberi", "Odustani");
SetPlayerColor(playerid, 0x0000FF88);
SetPlayerTeam(playerid,1);
SpawnPlayer(playerid);
SetPlayerPos(playerid, 172.2970,-152.2985,1.5737);
PlayerInfo[playerid][pTeam] = 1;
SetPlayerSkin(playerid,285);
usa++;
}
if(PlayerInfo[playerid][pJezik] == 2)
{
if(PlayerInfo[playerid][pTeam] == 1) { usa--; }
if(PlayerInfo[playerid][pTeam] == 2) { euro--; }
if(PlayerInfo[playerid][pTeam] == 3) { rus--; }
if(PlayerInfo[playerid][pTeam] == 4) { jap--; }
if(PlayerInfo[playerid][pTeam] == 5) { aust--; }
if(usa < 1) { usa = 0; }
if(euro < 1) { euro = 0; }
if(rus < 1) { rus = 0; }
if(jap < 1) { jap = 0; }
if(aust < 1) { aust = 0; }
SendClientMessage(playerid, -1, "You choosed United States of America as your team!!");
ShowPlayerDialog(playerid, 300, DIALOG_STYLE_LIST, "Choose Class that you want", "Soilder\nDemolition\nSniper\nPilot\nMedic\nEngineer\nPyroman\nSpy", "Choose", "Cancel");
SetPlayerColor(playerid, 0x0000FF88);
SetPlayerTeam(playerid,1);
SpawnPlayer(playerid);
SetPlayerPos(playerid, 172.2970,-152.2985,1.5737);
PlayerInfo[playerid][pTeam] = 1;
SetPlayerSkin(playerid,285);
usa++;
}
}
I Have this, please take look at SetPlayerTeam..
I know that it gave's player team 1, becouse it spawns him and sets him skin, so that mean that problem is here
Код:
forward ZoneTimer(playerid);
public ZoneTimer(playerid)
{
for(new i=0; i < sizeof(ZoneInfo); i++) // loop all zones
{
if(ZoneAttacker[i] != -1) // zone is being attacked
{
if(GetPlayersInZone(i, ZoneAttacker[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=0; t < sizeof(Teams); t++) // loop all teams
{
if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[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]));
}
}
}
}
return true;
}