Автор: Trigger
Гангзону нельзя захватить если игрок(и) этой банды не онлайн. Чтобы захватить гангзону введите /capture ждете 2 минуты (на подготовку) и стреляетесь, если вы всех убили и их на ГангЗоне нету то территория будет принадлежать вам.
Ко всем new:
Code: Select all
new Float:STANDARTGangZone[49][4] = {
{0.0, 0.0,0.0, 0.0},
{2577.861572, -1056.913940, 2787.590087, -898.770690},
{2368.133056, -1056.913940, 2577.861572, -898.770690},
{2158.404541, -1056.913940, 2368.133056, -898.770690},
{1948.676025, -1056.913940, 2158.404541, -898.770690},
{1738.947509, -1056.913940, 1948.676025, -898.770690},
{2787.590087, -1056.913940, 2997.318603, -898.770690},
{2787.590087, -1215.057128, 2997.318603, -1056.913940},
{2787.590087, -1373.200439, 2997.318603, -1215.057128},
{2787.590087, -1531.343750, 2997.318603, -1373.200439},
{2787.590087, -1689.486938, 2997.318603, -1531.343750},
{2787.590087, -1847.630126, 2997.318603, -1689.486938},
{2787.590087, -2005.773437, 2997.318603, -1847.630126},
{2787.590087, -2163.916503, 2997.318603, -2005.773437},
{2577.861572, -1215.057128, 2787.590087, -1056.913940},
{2577.861572, -1373.200439, 2787.590087, -1215.057128},
{2577.861572, -1531.343750, 2787.590087, -1373.200439},
{2577.861572, -1689.486938, 2787.590087, -1531.343750},
{2577.861572, -1847.630126, 2787.590087, -1689.486938},
{2577.861572, -2005.773437, 2787.590087, -1847.630126},
{2577.861572, -2163.916503, 2787.590087, -2005.773437},
{2368.133056, -1215.057128, 2577.861572, -1056.913940},
{2368.133056, -1373.200439, 2577.861572, -1215.057128},
{2368.133056, -1531.343750, 2577.861572, -1373.200439},
{2368.133056, -1689.486938, 2577.861572, -1531.343750},
{2368.133056, -1847.630126, 2577.861572, -1689.486938},
{2368.133056, -2005.773437, 2577.861572, -1847.630126},
{2368.133056, -2163.916503, 2577.861572, -2005.773437},
{2158.404541, -1215.057128, 2368.133056, -1056.913940},
{2158.404541, -1373.200439, 2368.133056, -1215.057128},
{2158.404541, -1531.343750, 2368.133056, -1373.200439},
{2158.404541, -1689.486938, 2368.133056, -1531.343750},
{2158.404541, -1847.630126, 2368.133056, -1689.486938},
{2158.404541, -2005.773437, 2368.133056, -1847.630126},
{2158.404541, -2163.916503, 2368.133056, -2005.773437},
{1948.676025, -1215.057128, 2158.404541, -1056.913940},
{1948.676025, -1373.200439, 2158.404541, -1215.057128},
{1948.676025, -1531.343750, 2158.404541, -1373.200439},
{1948.676025, -1689.486938, 2158.404541, -1531.343750},
{1948.676025, -1847.630126, 2158.404541, -1689.486938},
{1948.676025, -2005.773437, 2158.404541, -1847.630126},
{1948.676025, -2163.916503, 2158.404541, -2005.773437},
{1738.947509, -1215.057128, 1948.676025, -1056.913940},
{1738.947509, -1373.200439, 1948.676025, -1215.057128},
{1738.947509, -1531.343750, 1948.676025, -1373.200439},
{1738.947509, -1689.486938, 1948.676025, -1531.343750},
{1738.947509, -1847.630126, 1948.676025, -1689.486938},
{1738.947509, -2005.773437, 1948.676025, -1847.630126},
{1738.947509, -2163.916503, 1948.676025, -2005.773437}
};
new OnZONE[49][20];
new ZoneOnBattle[49];
new ZoneTimer[49];
new allowedfactions[] = { 13,14,16,19,15};
new GZSafeTime[49];
enum GzoneInfo
{
gID,
Float:gCoords[4],
gFrakVlad,
gNapad,
}
new GZInfo[49][GzoneInfo];
new FrakCD[20];
Ко всем forward:
Code: Select all
forward LoadGZ();
forward SaveGZ();
forward GzCheck();
forward PlayerToKvadrat( playerid, Float:min_x, Float:min_y, Float:max_x, Float:max_y );
Ко всем stock:
Code: Select all
stock GetGangZoneColor(gangzonex)
{
new zx;
switch(GZInfo[gangzonex][gFrakVlad])
{
case 13: zx =0x00FF1465;
case 14: zx = 0x00EBFF65;
case 16: zx =0xFF00EB65;
case 19: zx =0x0087FF65;
case 15: zx =0xFFC80065;
default: zx = 0xFFBE0065;
}
return zx;
}
stock GetGZColorF(fnumber)
{
new zx;
switch(fnumber)
{
case 13: zx =0x00FF1465;
case 14: zx = 0x00EBFF65;
case 16: zx =0xFF00EB65;
case 19: zx =0x0087FF65;
case 15: zx =0xFFC80065;
}
return zx;
}
stock IsInAllowed(playerid)
{
for(new i =0;i<sizeof(allowedfactions);i++)
{
if(PlayerInfo[playerid][pMember] == allowedfactions[i]||PlayerInfo[playerid][pLeader] == allowedfactions[i]) return 1;
}
return 0;
}
stock IsInAllowedF(fnumbers)
{
for(new i =0;i<sizeof(allowedfactions);i++)
{
if(fnumbers == allowedfactions[i]) return 1;
}
return 0;
}
stock GetGangName(fnumbwer)
{
new string[256];
switch(fnumbwer)
{
case 13: format(string,sizeof(string),"Grove Street Gang");
case 14: format(string,sizeof(string),"Los Aztecas Gang");
case 16: format(string,sizeof(string),"The Ballas Gang");
case 19: format(string,sizeof(string),"SF Rifa Gang");
case 15: format(string,sizeof(string),"Los Santos Vagos Gang");
}
return string;
}
stock IsPlayerInBandOnline(bandid)
{
for(new i=0; i < GetMaxPlayers(); i++)
{
if(PlayerInfo[i][pMember] == bandid || PlayerInfo[i][pLeader] == bandid) return 1;
}
return 0;
}
stock Name(playerid) { new pl[24]; GetPlayerName(playerid,pl,24); return pl; }
Ко всем public:
Code: Select all
public LoadGZ()
{
new string[256];
new File = iniOpen("GangZonesTrigga.ini");
new l[256];
new asd[5][10];
for(new i =0;i<sizeof(GZInfo);i++)
{
format(string,sizeof(string),"Zone%d",i);
new x = iniGet(File,string,l);
if(x < 0)
{
GZInfo[i][gCoords][0] = STANDARTGangZone[i][0];
GZInfo[i][gCoords][1] = STANDARTGangZone[i][1];
GZInfo[i][gCoords][2] =STANDARTGangZone[i][2];
GZInfo[i][gCoords][3] =STANDARTGangZone[i][3];
}
else
{
split(l,asd,'|');
GZInfo[i][gCoords][0] = floatstr(asd[0]);
GZInfo[i][gCoords][1] = floatstr(asd[1]);
GZInfo[i][gCoords][2] = floatstr(asd[2]);
GZInfo[i][gCoords][3] = floatstr(asd[3]);
}
GZInfo[i][gFrakVlad] = strval(asd[4]);
if(GZInfo[i][gFrakVlad] == 0) GZInfo[i][gFrakVlad] = allowedfactions[random(sizeof(allowedfactions))];
GZInfo[i][gID] = GangZoneCreate(GZInfo[i][gCoords][0],GZInfo[i][gCoords][1],GZInfo[i][gCoords][2],GZInfo[i][gCoords][3]);
ZoneOnBattle[i] =0;
GZSafeTime[i] =0;
}
iniClose(File);
print("Система гангзон успешно загружена!");
}
public SaveGZ()
{
new string[256];
new File = iniOpen("GangZonesTrigga.ini");
new l[10];
for(new i =0;i<sizeof(GZInfo);i++)
{
format(l,sizeof(l),"Zone%d",i);
format(string,sizeof(string),"%f|%f|%f|%f|%d",GZInfo[i][gCoords][0], GZInfo[i][gCoords][1],GZInfo[i][gCoords][2],GZInfo[i][gCoords][3],GZInfo[i][gFrakVlad]);
iniSet(File,l,string);
}
iniClose(File);
}
public GzCheck()
{
new string[256];
for(new i =0;i<sizeof(GZInfo);i++)
{
if(ZoneOnBattle[i] == 1 && GZSafeTime[i] == 0)
{
ZoneTimer[i] -=10;
if(ZoneTimer[i] <=0)
{
SendClientMessageToAll(-1,"Наблюдатель: Время на захват зоны вышел. Ничья.");
ZoneOnBattle[i] =0;
GangZoneStopFlashForAll(GZInfo[i][gID]);
}
for(new x =0;x<MAX_PLAYERS;x++)
{
if(PlayerToKvadrat(x,GZInfo[i][gCoords][0], GZInfo[i][gCoords][1],GZInfo[i][gCoords][2],GZInfo[i][gCoords][3])&&IsInAllowed(x))
{
new faction;
if(PlayerInfo[x][pLeader] !=0) {faction = PlayerInfo[x][pLeader];}
else { faction = PlayerInfo[x][pMember];}
OnZONE[i][faction] ++;
}
}
new asd;
for(new x =0;x<20;x++)
{
if(OnZONE[i][x] > 0 && IsInAllowedF(x)) asd ++;
}
if(asd == 1)
{
for(new x =0;x<20;x++)
{
if(OnZONE[i][x] > 0)
{
new zx,zl;
zx = x;
zl = i;
if(GZInfo[i][gFrakVlad] == x) {format(string,sizeof(string),"Наблюдатель: Банда %s отстояла свою зону.",GetGangName(zx)); }
else
{format(string,sizeof(string),"Наблюдатель: Банда %s выйгрывает зону.",GetGangName(zx)); }
for(new ads = 13;ads <= 19;ads++)
{
SendFamilyMessage(ads,GetGangZoneColor(zx),string);
}
ZoneOnBattle[zl] =0;
GZInfo[zl][gNapad] = 0;
GZInfo[zl][gFrakVlad] = zx;
GangZoneStopFlashForAll(GZInfo[zl][gID]);
GangZoneHideForAll(GZInfo[zl][gID]);
GangZoneShowForAll(GZInfo[zl][gID],GetGangZoneColor(zl));
break;
}
}
}
}
}
for(new i =0;i<49;i++)
{
for(new z = 0;z<20;z++)
{
OnZONE[i][z] =0;
}
}
}
public PlayerToKvadrat(playerid,Float:min_x,Float:min_y,Float:max_x,Float:max_y)
{
new Float:xxp,Float:yyp,Float:zzp;
GetPlayerPos(playerid, xxp, yyp, zzp);
if((xxp <= max_x && xxp >= min_x) && (yyp <= max_y && yyp >= min_y)) return 1;
return 0;
}
В public OnPlayerConnect(playerid):
Code: Select all
for(new i =0;i<49;i++)
{
GangZoneShowForPlayer(playerid,GZInfo[i][gID],GetGangZoneColor(i));
}
В public OnGameModeInit:
Code: Select all
SetTimer("GzCheck",10000,1);
SetTimer("SaveGZ",100000,1);
LoadGZ();
В public SaveAccounts():
Code: Select all
SaveGZ();
в OnPlayerCommandText(playerid, cmdtext[]):
Code: Select all
new faction;
if(PlayerInfo[playerid][pMember] !=0 && PlayerInfo[playerid][pLeader]==0) faction = PlayerInfo[playerid][pMember];
else if(PlayerInfo[playerid][pLeader]!=0 && PlayerInfo[playerid][pMember]==0) faction = PlayerInfo[playerid][pLeader];
else faction =0;
if(!strcmp(cmd,"/changegzcolor",true))
{
tmp = strtok(cmdtext,idx);
new l = strval(tmp);
if(!IsInAllowedF(l)) return SendClientMessage(playerid,COLOR_LIGHTRED,"Неправильный ид банды!");
if(PlayerInfo[playerid][pAdmin] >= 6)
{
for(new i = 0;i<49;i++)
{
if(PlayerToKvadrat(playerid,GZInfo[i][gCoords][0], GZInfo[i][gCoords][1],GZInfo[i][gCoords][2],GZInfo[i][gCoords][3]))
{
GZInfo[i][gFrakVlad] = l;
GangZoneStopFlashForAll(GZInfo[i][gID]);
GangZoneHideForAll(GZInfo[i][gID]);
GangZoneShowForAll(GZInfo[i][gID],GetGangZoneColor(i));
return 1;
}
}
}
}
if(!strcmp(cmd,"/capture",true))
{
if(FrakCD[faction] == 0)
{
if(!IsInAllowed(playerid))
{
return SendClientMessage(playerid,COLOR_LIGHTRED,"Ваша банда не может учавствовать в захвате зон или вы не на 1 зоне");
}
for(new i = 0;i<49;i++)
{
if(PlayerToKvadrat(playerid,GZInfo[i][gCoords][0], GZInfo[i][gCoords][1],GZInfo[i][gCoords][2],GZInfo[i][gCoords][3]) && GZInfo[i][gFrakVlad] != faction && ZoneOnBattle[i] == 0)
{
if(!IsPlayerInBandOnline(GZInfo[i][gFrakVlad])) return SendClientMessage(playerid,COLOR_LIGHTRED,"Зону банды которую вы хотите атаковать нет в онлайне!");
if(PlayerInfo[playerid][pRank] < 5) return SendClientMessage(playerid,COLOR_LIGHTRED,"??ницировать захват можно только с 5 ранга и выше!");
SendFamilyMessage(GZInfo[i][gFrakVlad],COLOR_LIGHTRED,"Ваша Зона под атакой. У вас 2 минуты чтобы подготовится к защите зоны.");
SendFamilyMessage(GZInfo[i][gFrakVlad],COLOR_LIGHTRED,"Если через 2 минуты на зоне никого не будет то зона автоматически перейдет к врагу");
format(string,sizeof(string),"%s начал борьбу за зону против %s банды. У вас 2 минуты чтобы подготовится к атаке",Name(playerid),GetGangName(GZInfo[i][gFrakVlad]));
SendFamilyMessage(faction,COLOR_LIGHTRED,string);
GangZoneFlashForAll(GZInfo[i][gID],GetGZColorF(faction));
GZSafeTime[i] = 120;
FrakCD[faction] = 3000;
GZInfo[i][gNapad] = faction;
ZoneTimer[i] = 720;
ZoneOnBattle[i] = 1;
break;
}
}
}
else
{
return SendClientMessage(playerid,COLOR_LIGHTRED,"Ваша банда еще не окрепла с момента последнего захвата. Ждите!");
}
}
В public SetPlayerUnjail():
Code: Select all
for(new i =0;i<49;i++)
{
if(GZSafeTime[i]>0)
{
GZSafeTime[i] --;
if(GZSafeTime[i] == 60 || GZSafeTime[i] == 120)
{
format(string,sizeof(string),"У вас осталось %d секунд на подготовку",GZSafeTime[i]);
SendFamilyMessage(GZInfo[i][gNapad],COLOR_LIGHTRED,string);
SendFamilyMessage(GZInfo[i][gFrakVlad],COLOR_LIGHTRED,string);
}
if(GZSafeTime[i]==0)
{
format(string,sizeof(string),"Время на подготовку вышло. Если у вас нет ни одного солдата на поле боя то зона автоматически переходит к противнику");
SendFamilyMessage(GZInfo[i][gNapad],COLOR_LIGHTRED,string);
SendFamilyMessage(GZInfo[i][gFrakVlad],COLOR_LIGHTRED,string);
}
}
}
for(new i =0;i<sizeof(FrakCD);i++)
{
if(FrakCD[i] >0)
{
FrakCD[i] --;
if(FrakCD[i] == 0) SendFamilyMessage(i,COLOR_LIGHTRED,"Ваша банда снова может учавствовать в захвате зон");
}
Файлик "GangZonesTrigga.ini" нужно положить в папкy scriptfiles, иды фрак меняйте на свои ( 13,14,16,19,15 )
- GangZonesTrigga.ini
Code: Select all
Zone0 = 0.000000|0.000000|0.000000|0.000000|13
Zone1 = 2577.861572|-1056.913940|2787.590087|-898.770690|19
Zone2 = 2368.133056|-1056.913940|2577.861572|-898.770690|19
Zone3 = 2158.404541|-1056.913940|2368.133056|-898.770690|14
Zone4 = 1948.676025|-1056.913940|2158.404541|-898.770690|13
Zone5 = 1738.947509|-1056.913940|1948.676025|-898.770690|15
Zone6 = 2787.590087|-1056.913940|2997.318603|-898.770690|15
Zone7 = 2787.590087|-1215.057128|2997.318603|-1056.913940|15
Zone8 = 2787.590087|-1373.200439|2997.318603|-1215.057128|16
Zone9 = 2787.590087|-1531.343750|2997.318603|-1373.200439|15
Zone10 = 2787.590087|-1689.486938|2997.318603|-1531.343750|14
Zone11 = 2787.590087|-1847.630126|2997.318603|-1689.486938|14
Zone12 = 2787.590087|-2005.773437|2997.318603|-1847.630126|16
Zone13 = 2787.590087|-2163.916503|2997.318603|-2005.773437|19
Zone14 = 2577.861572|-1215.057128|2787.590087|-1056.913940|14
Zone15 = 2577.861572|-1373.200439|2787.590087|-1215.057128|14
Zone16 = 2577.861572|-1531.343750|2787.590087|-1373.200439|19
Zone17 = 2577.861572|-1689.486938|2787.590087|-1531.343750|13
Zone18 = 2577.861572|-1847.630126|2787.590087|-1689.486938|16
Zone19 = 2577.861572|-2005.773437|2787.590087|-1847.630126|16
Zone20 = 2577.861572|-2163.916503|2787.590087|-2005.773437|19
Zone21 = 2368.133056|-1215.057128|2577.861572|-1056.913940|16
Zone22 = 2368.133056|-1373.200439|2577.861572|-1215.057128|14
Zone23 = 2368.133056|-1531.343750|2577.861572|-1373.200439|14
Zone24 = 2368.133056|-1689.486938|2577.861572|-1531.343750|14
Zone25 = 2368.133056|-1847.630126|2577.861572|-1689.486938|19
Zone26 = 2368.133056|-2005.773437|2577.861572|-1847.630126|16
Zone27 = 2368.133056|-2163.916503|2577.861572|-2005.773437|15
Zone28 = 2158.404541|-1215.057128|2368.133056|-1056.913940|16
Zone29 = 2158.404541|-1373.200439|2368.133056|-1215.057128|14
Zone30 = 2158.404541|-1531.343750|2368.133056|-1373.200439|13
Zone31 = 2158.404541|-1689.486938|2368.133056|-1531.343750|19
Zone32 = 2158.404541|-1847.630126|2368.133056|-1689.486938|13
Zone33 = 2158.404541|-2005.773437|2368.133056|-1847.630126|16
Zone34 = 2158.404541|-2163.916503|2368.133056|-2005.773437|13
Zone35 = 1948.676025|-1215.057128|2158.404541|-1056.913940|16
Zone36 = 1948.676025|-1373.200439|2158.404541|-1215.057128|13
Zone37 = 1948.676025|-1531.343750|2158.404541|-1373.200439|13
Zone38 = 1948.676025|-1689.486938|2158.404541|-1531.343750|15
Zone39 = 1948.676025|-1847.630126|2158.404541|-1689.486938|15
Zone40 = 1948.676025|-2005.773437|2158.404541|-1847.630126|13
Zone41 = 1948.676025|-2163.916503|2158.404541|-2005.773437|15
Zone42 = 1738.947509|-1215.057128|1948.676025|-1056.913940|19
Zone43 = 1738.947509|-1373.200439|1948.676025|-1215.057128|19
Zone44 = 1738.947509|-1531.343750|1948.676025|-1373.200439|15
Zone45 = 1738.947509|-1689.486938|1948.676025|-1531.343750|16
Zone46 = 1738.947509|-1847.630126|1948.676025|-1689.486938|14
Zone47 = 1738.947509|-2005.773437|1948.676025|-1847.630126|15
Zone48 = 1738.947509|-2163.916503|1948.676025|-2005.773437|19