Нужна помощь?
Создайте тему в соответствующем разделе
Не нужно писать всё в чат!Загляните на торговую площадку
Там вы можете купить
всё что касается игровых серверовНе хотите бан?
Пожалуйста, ознакомьтесь с нашими правилами
Не нарушайте порядок!Продаёте или покупаете?
Пользуйтесь услугами гаранта
Мы сделаем вашу сделку безопасной
- 0
-
Наш выбор
-
Создаем свой серверный мод. [DayZ 1.4 to Discontined]
123new опубликовал тему в Версия 1.0 и выше,
-
Увеличение карты х2
vitacite опубликовал тему в Картостроение,
Всем привет. Помогите с кодом триггеров газа. Газ есть, но не работает ни один из противогазов, в том числе из модов.
class Zone {
int id;
int type;
vector pos;
float radius;
}
enum ZoneType {
SAFE,
GAS,
RAD,
BIO
}
ref array<ref Zone> ga_zones = new array<ref Zone>;
ref ControllerZones ctrl_zones = new ControllerZones;
class ControllerZones {
void ControllerZones() {
int id = 0;
vector pos;
float radius;
int type = 0;
id = 1; // Pavlovo
pos = "2125 0 3400";
radius = 200.0;
AddZone(id, pos, radius);
id = 2; // Zeleno
pos = "2530 0 5112";
radius = 150.0;
AddZone(id, pos, radius);
id = 3; // Dichina
pos = "4524 0 8290";
radius = 50.0;
AddZone(id, pos, radius);
id = 4; // Mushkino
pos = "332 0 9368";
radius = 100.0;
AddZone(id, pos, radius);
id = 5; // Aero SW
pos = "4586 0 9533";
radius = 220.0;
AddZone(id, pos, radius);
id = 6; // Aero SE
pos = "5177 0 9960";
radius = 350.0;
AddZone(id, pos, radius);
id = 7; // Aero W
pos = "4228 0 10400";
radius = 350.0;
AddZone(id, pos, radius);
id = 8; // Aero E
pos = "4785 0 10530";
radius = 250.0;
AddZone(id, pos, radius);
id = 9; // Aero N
pos = "4290 0 10956";
radius = 250.0;
AddZone(id, pos, radius);
GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(CheckZones, 5000, true);
}
void ~ControllerZones() {
}
void AddZone(int id, vector pos, float radius, int type = ZoneType.BIO) {
ref Zone zone = new ref Zone;
zone.id = id;
zone.pos = pos;
zone.radius = radius;
zone.type = type;
ga_zones.Insert(zone);
}
bool InZone(PlayerBase player, ref Zone zone) {
vector player_position = player.GetPosition();
player_position[1] = 0;
if( (vector.Distance(player_position, zone.pos)) < zone.radius ) {
EntityAI attachment;
ItemBase item;
string className;
float biosafe = 0;
attachment = player.FindAttachmentBySlotName("Mask");
if ( attachment && attachment.IsItemBase() ) {
item = Class.Cast(attachment);
className = item.GetType();
if ( className.Contains("GP5GasMask") ) {
//return true; // TEMP FIX
biosafe = biosafe + 1.0; }
}
}
if ( biosafe > 1.0 )
return true;
float damage_player;
float damage_zone = 6.0;
damage_player = player.GetHealth("GlobalHealth", "Health");
player.SetHealth("GlobalHealth", "Health", damage_player - (damage_zone - ((damage_zone / 6) * biosafe)));
player.GetSymptomManager().QueueUpPrimarySymptom(SymptomIDs.SYMPTOM_COUGH);
Param1<string> m_MessageParam = new Param1<string>("Вам нужен противогаз!");
GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, m_MessageParam, true, player.GetIdentity());
return true;
}
return false;
}
void CheckZones() {
ref array<Man> players = new array<Man>;
GetGame().GetPlayers( players );
for ( int i = 0; i < players.Count(); i++ )
{
PlayerBase player;
Class.CastTo(player, players.Get(i));
for ( int j = 0; j < ga_zones.Count(); j++ ) {
if(InZone(player, ga_zones.Get(j))) {
break;
}
}
}
}
}
Поделиться сообщением
Ссылка на сообщение
Поделиться на других сайтах