• Из-за обновления GTA 5 (был добавлен новый патч) может временно не работать вход в RAGE Multiplayer.

    Ошибка: Ваша версия Grand Theft Auto V не поддерживается RAGE Multiplayer.
    ERROR: Your game version is not supported by RAGE Multiplayer.

    Данная ошибка говорит о том, что GTA V обновилась до новой версии (GTA Online тоже). Вам необходимо обновить саму игру в главном меню вашего приложения (Steam / Epic Games / Rockstar Games).
    Если после этого RAGE:MP все равно не работает - вам нужно дождаться выхода патча для самого мультиплеера (обычно это занимает от нескольких часов до нескольких дней).

    Новости и апдейты Rockstar Games - https://www.rockstargames.com/newswire/
    Статус всех служб для Rockstar Games Launcher и поддерживаемых игр: https://support.rockstargames.com/ru/servicestatus


    Grand Theft Auto 5 (+ GTA Online) последний раз были обновлены:

Вопрос Точка взаимодействия

vlad_ertushov

Новый участник
20 Май 2021
15
0
6
Подскажите как создать точку взаимодействии во фракции , чтобы при нажатие Е открывалось меню или просто выдавалась одежда. Я написал кодик, но он не работает, может кто-то подскажет.
 

Harland David Sanders

🍔 ChefBurger
Команда форума
High developer
10 Сен 2020
3,590
2,749
219
Кодик скинь
 

vlad_ertushov

Новый участник
20 Май 2021
15
0
6
Код:
using System;
using System.Collections.Generic;
using GTANetworkAPI;
using DevFive.Core;
using DevFive.SDK;
using DevFive.GUI;
using System.Data;
using System.Linq;
using MySql.Data.MySqlClient;
using DevFive.Core.Character;
using Newtonsoft.Json;

namespace DevFive.Fractions
{
    class Merryweather : Script
    {
        private static nLog Log = new nLog("Merryweather");

        private static Dictionary<int, ColShape> Cols = new Dictionary<int, ColShape>();
        public static List<Vector3> Coords = new List<Vector3>
        {
            new Vector3(1571.831, 2240.648, 78.40011), // Колшэйп входа в бункер
            new Vector3(2154.641, 2921.034, -62.82243), // Колшэйп изнутри интерьера для телепорта наверх
            new Vector3(2033.842, 2942.104, -62.82434), // Колшэйп входа на другой этаж
            new Vector3(2155.425, 2921.066, -81.99551), // Колшэйп изнутри этажа, чтобы вернуться назад
            new Vector3(2072.27, 2992.96, -64.10), // одежда
            new Vector3(2038.35, 3017, -73.70),
            new Vector3(2071.39, 2995.11, -64.10),
          
        };
        public static bool warg_mode = false;

        [ServerEvent(Event.ResourceStart)]
        public void OnResourceStartHandler()
        {
            try
            {
              
              

                Cols.Add(0, NAPI.ColShape.CreateCylinderColShape(Coords[0], 1f, 2, 0));
                Cols[0].OnEntityEnterColShape += mws_OnEntityEnterColShape;
                Cols[0].OnEntityExitColShape += mws_OnEntityExitColShape;
                Cols[0].SetData("INTERACT", 82);

                Cols.Add(1, NAPI.ColShape.CreateCylinderColShape(Coords[1], 1f, 2, 0));
                Cols[1].OnEntityEnterColShape += mws_OnEntityEnterColShape;
                Cols[1].OnEntityExitColShape += mws_OnEntityExitColShape;
                Cols[1].SetData("INTERACT", 83);

                Cols.Add(2, NAPI.ColShape.CreateCylinderColShape(Coords[2], 1f, 2, 0));
                Cols[2].OnEntityEnterColShape += mws_OnEntityEnterColShape;
                Cols[2].OnEntityExitColShape += mws_OnEntityExitColShape;
                Cols[2].SetData("INTERACT", 84);

                Cols.Add(3, NAPI.ColShape.CreateCylinderColShape(Coords[3], 1f, 2, 0));
                Cols[3].OnEntityEnterColShape += mws_OnEntityEnterColShape;
                Cols[3].OnEntityExitColShape += mws_OnEntityExitColShape;
                Cols[3].SetData("INTERACT", 85);

                Cols.Add(4, NAPI.ColShape.CreateCylinderColShape(Coords[4], 1, 2, 0));
                Cols[4].OnEntityEnterColShape += mws_OnEntityEnterColShape;
                Cols[4].OnEntityExitColShape += mws_OnEntityExitColShape;
                Cols[4].SetData("INTERACT", 1005);
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~Нажмите E чтобы открыть меню"), new Vector3(Coords[4].X, Coords[4].Y, Coords[4].Z + 1.8), 5F, 0.3F, 0, new Color(255, 255, 255));

               Cols.Add(5, NAPI.ColShape.CreateCylinderColShape(Coords[5], 1, 2, 0));
                Cols[5].SetData("INTERACT", 1006);
                Cols[5].OnEntityEnterColShape += mws_OnEntityEnterColShape;
                Cols[5].OnEntityExitColShape += mws_OnEntityExitColShape;
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~Открыть склад"), new Vector3(Coords[5].X, Coords[5].Y, Coords[5].Z + 1.8), 5F, 0.3F, 0, new Color(250, 250, 250));

                Cols.Add(6, NAPI.ColShape.CreateCylinderColShape(Coords[6], 1, 2, 0));
                Cols[6].SetData("INTERACT", 1007);
                Cols[6].OnEntityEnterColShape += mws_OnEntityEnterColShape;
                Cols[6].OnEntityExitColShape += mws_OnEntityExitColShape;
                NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~Переодеться"), new Vector3(Coords[6].X, Coords[6].Y, Coords[6].Z + 1.8), 5F, 0.3F, 0, new Color(250, 250, 250));

                /* Cols.Add(4, NAPI.ColShape.CreateCylinderColShape(Coords[4], 1f, 2, 0)); // duty
                 Cols[4].OnEntityEnterColShape += mws_OnEntityEnterColShape;
                 Cols[4].OnEntityExitColShape += mws_OnEntityExitColShape;
                 Cols[4].SetData("INTERACT", 1000);
                 NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~o~Нажмите E - Меню Одежды"), new Vector3(Coords[4].X, Coords[4].Y, Coords[4].Z + 0.3), 5F, 0.3F, 0, new Color(255, 255, 255));*/

                NAPI.Marker.CreateMarker(1, Coords[0] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
                NAPI.Marker.CreateMarker(1, Coords[1] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
                NAPI.Marker.CreateMarker(1, Coords[2] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
                NAPI.Marker.CreateMarker(1, Coords[3] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
                NAPI.Marker.CreateMarker(1, Coords[4] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
                NAPI.Marker.CreateMarker(1, Coords[5] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
                NAPI.Marker.CreateMarker(1, Coords[6] - new Vector3(0, 0, 0.7), new Vector3(), new Vector3(), 1, new Color(255, 255, 255, 220));
            }
            catch (Exception e) 
            {
                Log.Write("EXCEPTION AT\"FRACTIONS_MERRYWEATHER\":\n" + e.ToString(), nLog.Type.Error);
            }
        }
 

vlad_ertushov

Новый участник
20 Май 2021
15
0
6
#region colshape


private void mws_OnEntityEnterColShape(ColShape shape, Client entity)
{
try
{
NAPI.Data.SetEntityData(entity, "INTERACTIONCHECK", shape.GetData("INTERACT"));
}
catch (Exception e) { Log.Write("mws_OnEntityEnterColShape: " + e.Message, nLog.Type.Error); }
}

private void mws_OnEntityExitColShape(ColShape shape, Client entity)
{
try
{
NAPI.Data.SetEntityData(entity, "INTERACTIONCHECK", 0);
}
catch (Exception e) { Log.Write("mws_OnEntityExitColShape: " + e.Message, nLog.Type.Error); }
}

private void onEntityEnterColshape(ColShape shape, Client entity)
{
try
{
NAPI.Data.SetEntityData(entity, "INTERACTIONCHECK", shape.GetData("INTERACT"));
}
catch (Exception ex) { Log.Write("onEntityEnterColshape: " + ex.Message, nLog.Type.Error); }
}

private void onEntityExitColshape(ColShape shape, Client entity)
{
try
{
NAPI.Data.SetEntityData(entity, "INTERACTIONCHECK", 0);
}
catch (Exception ex) { Log.Write("onEntityExitColshape: " + ex.Message, nLog.Type.Error); }
}

#endregion


public static void interactPressed(Client player, int interact)
{
switch (interact)
{
/* case 82:
case 85:
if (player.IsInVehicle) return;
if (player.HasData("FOLLOWING"))
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000);
return;
}
if (Main.Players[player].FractionID != 17)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Вы не состоите в Merryweather", 3000);
return;
}
if (interact == 82) NAPI.Entity.SetEntityPosition(player, Coords[1] + new Vector3(0, 0, 1.12));
else if (interact == 85) NAPI.Entity.SetEntityPosition(player, Coords[0] + new Vector3(0, 0, 1.12));
return;*/
case 82:
case 83:
case 84:
case 85:
if (player.IsInVehicle) return;
if (player.HasData("FOLLOWING"))
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000);
return;
}
if (Main.Players[player].FractionID != 17)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Вы не состоите в Merryweather", 3000);
return;
}
if (interact == 82) NAPI.Entity.SetEntityPosition(player, Coords[1] + new Vector3(0, 0, 1.12));
else if (interact == 83) NAPI.Entity.SetEntityPosition(player, Coords[0] + new Vector3(0, 0, 1.12));
else if (interact == 84) NAPI.Entity.SetEntityPosition(player, Coords[3] + new Vector3(0, 0, 1.12));
else if (interact == 85) NAPI.Entity.SetEntityPosition(player, Coords[2] + new Vector3(0, 0, 1.12));
return;


case 1005:
if (Main.Players[player].FractionID != 17)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не состоите в Merryweather", 3000);
return;
}
if (!Stocks.fracStocks[17].IsOpen)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000);
return;
}
OpenMeryGunMenu(player);
return;

case 1006:
if (Main.Players[player].FractionID != 17)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не состоите в Merryweather", 3000);
return;
}
if (!Stocks.fracStocks[17].IsOpen)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000);
return;
}
if (!Manager.canUseCommand(player, "openweaponstock")) return;
player.SetData("ONFRACSTOCK", 17);
GUI.Dashboard.OpenOut(player, Stocks.fracStocks[17].Weapons, "Склад оружия", 6);
return;

case 1007:
if (Main.Players[player].FractionID == 17)
{
if (!NAPI.Data.GetEntityData(player, "ON_DUTY"))
{
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы начали рабочий день", 3000);
Manager.setSkin(player, 17, 1);
NAPI.Data.SetEntityData(player, "ON_DUTY", true);
break;
}
else
{
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000); ;
Customization.ApplyCharacter(player);
if (player.HasData("HAND_MONEY")) player.SetClothes(5, 45, 0);
else if (player.HasData("HEIST_DRILL")) player.SetClothes(5, 41, 0);
NAPI.Data.SetEntityData(player, "ON_DUTY", false);
break;
}
}
else Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не состоите в Merryweather", 3000);
return;
/*{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не состоите в Merryweather", 3000);
return;
}
callback_Meryclothes(player);
return;*/

}
}
#region menu

/*public static void OpenMeryClothesMenu(Client player)
{
Menu menu = new Menu("meryclothes", false, false);
menu.Callback = callback_Meryclothes;

Menu.Item menuItem = new Menu.Item("header", Menu.MenuItem.Header);
menuItem.Text = "Одежда";
menu.Add(menuItem);

menuItem = new Menu.Item("change", Menu.MenuItem.Button);
menuItem.Text = "Переодеться";
menu.Add(menuItem);

menuItem = new Menu.Item("combat", Menu.MenuItem.Button);
menuItem.Text = "Боевая форма";
menu.Add(menuItem);

menuItem = new Menu.Item("close", Menu.MenuItem.Button);
menuItem.Text = "Закрыть";
menu.Add(menuItem);

menu.Open(player);
} */
private static void callback_Meryclothes(Client client, Menu menu, Menu.Item item, string eventName, dynamic data)
{
switch (item.ID)
{
case "change":
if (Main.Players[client].FractionLVL < 2)
{
Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не можете переодеться/раздеться", 3000);
return;
}
if (!client.GetData("ON_DUTY"))
{
Notify.Send(client, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы переоделись в служебную форму", 3000);
Manager.setSkin(client, Main.Players[client].FractionID, Main.Players[client].FractionLVL);
client.SetData("ON_DUTY", true);
}
else
{
Notify.Send(client, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы переоделись в повседневную одежду", 3000);
Customization.ApplyCharacter(client);
if (client.HasData("HAND_MONEY")) client.SetClothes(5, 45, 0);
else if (client.HasData("HEIST_DRILL")) client.SetClothes(5, 41, 0);
client.SetData("ON_DUTY", false);
}
return;
case "combat":
MenuManager.Close(client);
OpenMeryCombatMenu(client);
return;
case "close":
MenuManager.Close(client);
return;
}
}

public static void OpenMeryCombatMenu(Client player)
{
Menu menu = new Menu("merycombat", false, false);
menu.Callback = callback_merycombat;

Menu.Item menuItem = new Menu.Item("header", Menu.MenuItem.Header);
menuItem.Text = "Боевая форма";
menu.Add(menuItem);

menuItem = new Menu.Item("mer1", Menu.MenuItem.Button);
menuItem.Text = "Одежда 1";
menu.Add(menuItem);

menuItem = new Menu.Item("takeoff", Menu.MenuItem.Button);
menuItem.Text = "Снять форму";
menu.Add(menuItem);

menuItem = new Menu.Item("back", Menu.MenuItem.Button);
menuItem.Text = "Назад";
menu.Add(menuItem);

menu.Open(player);
}
private static void callback_merycombat(Client client, Menu menu, Menu.Item item, string eventName, dynamic data)
{
if (item.ID == "back")
{
MenuManager.Close(client);
//OpenMeryClothesMenu(client);
return;
}
if (Main.Players[client].FractionID != 17 && Main.Players[client].FractionID != 9)
{

Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не состоите в Merryweather", 3000);
return;
}
if (!client.GetData("ON_DUTY"))
{
Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны начать службу", 3000);
return;
}
client.SetData("IN_CP_MODE", true);
var gender = Main.Players[client].Gender;
Customization.ClearClothes(client, gender);
switch (item.ID)
{

case "mer1":
if (gender)
/* {
Customization.SetHat(client, 117, 13);
client.SetClothes(1, 104, 5);
client.SetClothes(11, 221, 5);
client.SetClothes(4, 87, 5);
client.SetClothes(6, 62, 0);
client.SetClothes(9, 16, 0);
client.SetClothes(3, 49, 1);
}
else
{
Customization.SetHat(client, 116, 13);
client.SetClothes(1, 104, 5);
client.SetClothes(4, 90, 5);
client.SetClothes(11, 224, 5);
client.SetClothes(6, 65, 0);
client.SetClothes(3, 46, 1);
client.SetClothes(9, 18, 0);
}*/
if (gender)
{
Customization.SetHat(client, 39, 0);
//client.SetClothes(1, 52, 0);
client.SetClothes(11, 53, 0);
client.SetClothes(4, 31, 0);
client.SetClothes(6, 25, 0);
client.SetClothes(9, 15, 2);
client.SetClothes(3, 49, 0);
}
else
{
Customization.SetHat(client, 38, 0);
//client.SetClothes(1, 57, 0);
client.SetClothes(11, 46, 0);
client.SetClothes(4, 30, 0);
client.SetClothes(6, 25, 0);
client.SetClothes(9, 17, 2);
client.SetClothes(3, 53, 0);
}
return;

case "takeoff":
Manager.setSkin(client, Main.Players[client].FractionID, Main.Players[client].FractionLVL);
client.SetData("IN_CP_MODE", false);
return;
}
}
#endregion
public static void OpenMeryGunMenu(Client player)
{
Trigger.ClientEvent(player, "meryg");
}
[RemoteEvent("merygun")]

public static void callback_meryGuns(Client client, int index)

{

try

{

switch (index)

{

case 0: //nightstick

Fractions.Manager.giveGun(client, Weapons.Hash.Nightstick, "Nightstick");

return;

case 1: //Pistol

Fractions.Manager.giveGun(client, Weapons.Hash.Pistol, "Pistol");

return;

case 2: //CompactRifle
Fractions.Manager.giveGun(client, Weapons.Hash.CompactRifle, "CompactRifle");

return;

case 3: // pistol ammo

if (!Manager.canGetWeapon(client, "PistolAmmo")) return;

Fractions.Manager.giveAmmo(client, ItemType.PistolAmmo, 12);

return;

case 4: // RiflesAmmo ammo

if (!Manager.canGetWeapon(client, "RiflesAmmo")) return;

Fractions.Manager.giveAmmo(client, ItemType.RiflesAmmo, 15);

return;

case 5: // medkit

if (!Manager.canGetWeapon(client, "Medkits")) return;

if (Fractions.Stocks.fracStocks[17].Medkits == 0)

{

Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, "На складе нет аптечек", 3000);

return;

}

var hItem = nInventory.Find(Main.Players[client].UUID, ItemType.HealthKit);

if (hItem != null)

{

Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, "У Вас уже есть аптечка", 3000);

return;

}

Fractions.Stocks.fracStocks[17].Medkits--;

Fractions.Stocks.fracStocks[17].UpdateLabel();

nInventory.Add(client, new nItem(ItemType.HealthKit, 1));

GameLog.Stock(Main.Players[client].FractionID, Main.Players[client].UUID, "medkit", 1, false);

Notify.Send(client, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы получили аптечку", 3000);

return;

case 6:

if (!Manager.canGetWeapon(client, "armor")) return;

if (Fractions.Stocks.fracStocks[17].Materials < Fractions.Manager.matsForArmor)

{

Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, "На складе недостаточно материала", 3000);

return;

}

var aItem = nInventory.Find(Main.Players[client].UUID, ItemType.BodyArmor);

if (aItem != null)

{

Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, "У Вас уже есть бронежилет", 3000);

return;

}

Fractions.Stocks.fracStocks[17].Materials -= Fractions.Manager.matsForArmor;

Fractions.Stocks.fracStocks[17].UpdateLabel();

nInventory.Add(client, new nItem(ItemType.BodyArmor, 1, 100.ToString()));

Notify.Send(client, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы получили бронежилет", 3000);

GameLog.Stock(Main.Players[client].FractionID, Main.Players[client].UUID, "armor", 1, false);

return;

}

}

catch (Exception e)

{

Log.Write($"Merygun: " + e.Message, nLog.Type.Error);

}

}


}
}
 

Furymonyt

Начинающий специалист
16 Апр 2021
320
59
78
Cols.Add(0, NAPI.ColShape.CreateCylinderColShape(YourFracChecksCoords[0], 1f, 2, 0)); // Раздевалка
Cols[0].OnEntityEnterColShape += city_OnEntityEnterColShape;
Cols[0].OnEntityExitColShape += city_OnEntityExitColShape;
Cols[0].SetData("INTERACT", 0);
NAPI.TextLabel.CreateTextLabel(Main.StringToU16("~g~Нажми E, чтобы переодеться"), new Vector3(YourFraclChecksCoords[1].X, YourFracChecksCoords[0].Y, YourFracChecksCoords[0].Z + 0.7), 5F, 0.4F, 0, new Color(255, 255, 255));


if (Main.Players[player].FractionID != Суда id своей фракции)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник Своей Фракции", 3000);
return;
}
if (!NAPI.Data.GetEntityData(player, "ON_DUTY"))
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны начать рабочий день", 3000);
return;
}


public static void beginWorkDay(Player player)
{
if (Main.Players[player].FractionID == id своей фракции)
{
if (!NAPI.Data.GetEntityData(player, "ON_DUTY"))
{
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы начали рабочий день", 3000);
Manager.setSkin(player, Айди фракции, Main.Players[player].FractionLVL);
NAPI.Data.SetEntityData(player, "ON_DUTY", true);
if (Main.Players[player].FractionLVL >= 3)
player.Armor = 100;
return;
}
else
{
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000);
Customization.ApplyCharacter(player);
if (player.HasData("HAND_MONEY")) player.SetClothes(5, 45, 0);
else if (player.HasData("HEIST_DRILL")) player.SetClothes(5, 41, 0);
NAPI.Data.SetEntityData(player, "ON_DUTY", false);
return;
}
}
else Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не сотрудник Своей фракции", 3000);
}


case "changeclothes":
if (!NAPI.Data.GetEntityData(client, "IN_CP_MODE"))
{
bool gender = Main.Players[client].Gender;
Customization.ApplyCharacter(client);
Customization.ClearClothes(client, gender);
if (gender)
{
Customization.SetHat(client, 39, 0);
client.SetClothes(11, 53, 0);
client.SetClothes(4, 31, 0);
client.SetClothes(6, 25, 0);
client.SetClothes(9, 15, 2);
client.SetClothes(3, 49, 0);
}
else
{
Customization.SetHat(client, 38, 0);
client.SetClothes(11, 46, 0);
client.SetClothes(4, 30, 0);
client.SetClothes(6, 25, 0);
client.SetClothes(9, 17, 2);
client.SetClothes(3, 53, 0);
}
 

Furymonyt

Начинающий специалист
16 Апр 2021
320
59
78
У тебя же всё создано? в чём проблема?
#region colshape


private void mws_OnEntityEnterColShape(ColShape shape, Client entity)
{
try
{
NAPI.Data.SetEntityData(entity, "INTERACTIONCHECK", shape.GetData("INTERACT"));
}
catch (Exception e) { Log.Write("mws_OnEntityEnterColShape: " + e.Message, nLog.Type.Error); }
}

private void mws_OnEntityExitColShape(ColShape shape, Client entity)
{
try
{
NAPI.Data.SetEntityData(entity, "INTERACTIONCHECK", 0);
}
catch (Exception e) { Log.Write("mws_OnEntityExitColShape: " + e.Message, nLog.Type.Error); }
}

private void onEntityEnterColshape(ColShape shape, Client entity)
{
try
{
NAPI.Data.SetEntityData(entity, "INTERACTIONCHECK", shape.GetData("INTERACT"));
}
catch (Exception ex) { Log.Write("onEntityEnterColshape: " + ex.Message, nLog.Type.Error); }
}

private void onEntityExitColshape(ColShape shape, Client entity)
{
try
{
NAPI.Data.SetEntityData(entity, "INTERACTIONCHECK", 0);
}
catch (Exception ex) { Log.Write("onEntityExitColshape: " + ex.Message, nLog.Type.Error); }
}

#endregion


public static void interactPressed(Client player, int interact)
{
switch (interact)
{
/* case 82:
case 85:
if (player.IsInVehicle) return;
if (player.HasData("FOLLOWING"))
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000);
return;
}
if (Main.Players[player].FractionID != 17)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Вы не состоите в Merryweather", 3000);
return;
}
if (interact == 82) NAPI.Entity.SetEntityPosition(player, Coords[1] + new Vector3(0, 0, 1.12));
else if (interact == 85) NAPI.Entity.SetEntityPosition(player, Coords[0] + new Vector3(0, 0, 1.12));
return;*/
case 82:
case 83:
case 84:
case 85:
if (player.IsInVehicle) return;
if (player.HasData("FOLLOWING"))
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вас кто-то тащит за собой", 3000);
return;
}
if (Main.Players[player].FractionID != 17)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, "Вы не состоите в Merryweather", 3000);
return;
}
if (interact == 82) NAPI.Entity.SetEntityPosition(player, Coords[1] + new Vector3(0, 0, 1.12));
else if (interact == 83) NAPI.Entity.SetEntityPosition(player, Coords[0] + new Vector3(0, 0, 1.12));
else if (interact == 84) NAPI.Entity.SetEntityPosition(player, Coords[3] + new Vector3(0, 0, 1.12));
else if (interact == 85) NAPI.Entity.SetEntityPosition(player, Coords[2] + new Vector3(0, 0, 1.12));
return;


case 1005:
if (Main.Players[player].FractionID != 17)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не состоите в Merryweather", 3000);
return;
}
if (!Stocks.fracStocks[17].IsOpen)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000);
return;
}
OpenMeryGunMenu(player);
return;

case 1006:
if (Main.Players[player].FractionID != 17)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не состоите в Merryweather", 3000);
return;
}
if (!Stocks.fracStocks[17].IsOpen)
{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Склад закрыт", 3000);
return;
}
if (!Manager.canUseCommand(player, "openweaponstock")) return;
player.SetData("ONFRACSTOCK", 17);
GUI.Dashboard.OpenOut(player, Stocks.fracStocks[17].Weapons, "Склад оружия", 6);
return;

case 1007:
if (Main.Players[player].FractionID == 17)
{
if (!NAPI.Data.GetEntityData(player, "ON_DUTY"))
{
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы начали рабочий день", 3000);
Manager.setSkin(player, 17, 1);
NAPI.Data.SetEntityData(player, "ON_DUTY", true);
break;
}
else
{
Notify.Send(player, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы закончили рабочий день", 3000); ;
Customization.ApplyCharacter(player);
if (player.HasData("HAND_MONEY")) player.SetClothes(5, 45, 0);
else if (player.HasData("HEIST_DRILL")) player.SetClothes(5, 41, 0);
NAPI.Data.SetEntityData(player, "ON_DUTY", false);
break;
}
}
else Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не состоите в Merryweather", 3000);
return;
/*{
Notify.Send(player, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не состоите в Merryweather", 3000);
return;
}
callback_Meryclothes(player);
return;*/

}
}
#region menu

/*public static void OpenMeryClothesMenu(Client player)
{
Menu menu = new Menu("meryclothes", false, false);
menu.Callback = callback_Meryclothes;

Menu.Item menuItem = new Menu.Item("header", Menu.MenuItem.Header);
menuItem.Text = "Одежда";
menu.Add(menuItem);

menuItem = new Menu.Item("change", Menu.MenuItem.Button);
menuItem.Text = "Переодеться";
menu.Add(menuItem);

menuItem = new Menu.Item("combat", Menu.MenuItem.Button);
menuItem.Text = "Боевая форма";
menu.Add(menuItem);

menuItem = new Menu.Item("close", Menu.MenuItem.Button);
menuItem.Text = "Закрыть";
menu.Add(menuItem);

menu.Open(player);
} */
private static void callback_Meryclothes(Client client, Menu menu, Menu.Item item, string eventName, dynamic data)
{
switch (item.ID)
{
case "change":
if (Main.Players[client].FractionLVL < 2)
{
Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не можете переодеться/раздеться", 3000);
return;
}
if (!client.GetData("ON_DUTY"))
{
Notify.Send(client, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы переоделись в служебную форму", 3000);
Manager.setSkin(client, Main.Players[client].FractionID, Main.Players[client].FractionLVL);
client.SetData("ON_DUTY", true);
}
else
{
Notify.Send(client, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы переоделись в повседневную одежду", 3000);
Customization.ApplyCharacter(client);
if (client.HasData("HAND_MONEY")) client.SetClothes(5, 45, 0);
else if (client.HasData("HEIST_DRILL")) client.SetClothes(5, 41, 0);
client.SetData("ON_DUTY", false);
}
return;
case "combat":
MenuManager.Close(client);
OpenMeryCombatMenu(client);
return;
case "close":
MenuManager.Close(client);
return;
}
}

public static void OpenMeryCombatMenu(Client player)
{
Menu menu = new Menu("merycombat", false, false);
menu.Callback = callback_merycombat;

Menu.Item menuItem = new Menu.Item("header", Menu.MenuItem.Header);
menuItem.Text = "Боевая форма";
menu.Add(menuItem);

menuItem = new Menu.Item("mer1", Menu.MenuItem.Button);
menuItem.Text = "Одежда 1";
menu.Add(menuItem);

menuItem = new Menu.Item("takeoff", Menu.MenuItem.Button);
menuItem.Text = "Снять форму";
menu.Add(menuItem);

menuItem = new Menu.Item("back", Menu.MenuItem.Button);
menuItem.Text = "Назад";
menu.Add(menuItem);

menu.Open(player);
}
private static void callback_merycombat(Client client, Menu menu, Menu.Item item, string eventName, dynamic data)
{
if (item.ID == "back")
{
MenuManager.Close(client);
//OpenMeryClothesMenu(client);
return;
}
if (Main.Players[client].FractionID != 17 && Main.Players[client].FractionID != 9)
{

Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы не состоите в Merryweather", 3000);
return;
}
if (!client.GetData("ON_DUTY"))
{
Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, $"Вы должны начать службу", 3000);
return;
}
client.SetData("IN_CP_MODE", true);
var gender = Main.Players[client].Gender;
Customization.ClearClothes(client, gender);
switch (item.ID)
{

case "mer1":
if (gender)
/* {
Customization.SetHat(client, 117, 13);
client.SetClothes(1, 104, 5);
client.SetClothes(11, 221, 5);
client.SetClothes(4, 87, 5);
client.SetClothes(6, 62, 0);
client.SetClothes(9, 16, 0);
client.SetClothes(3, 49, 1);
}
else
{
Customization.SetHat(client, 116, 13);
client.SetClothes(1, 104, 5);
client.SetClothes(4, 90, 5);
client.SetClothes(11, 224, 5);
client.SetClothes(6, 65, 0);
client.SetClothes(3, 46, 1);
client.SetClothes(9, 18, 0);
}*/
if (gender)
{
Customization.SetHat(client, 39, 0);
//client.SetClothes(1, 52, 0);
client.SetClothes(11, 53, 0);
client.SetClothes(4, 31, 0);
client.SetClothes(6, 25, 0);
client.SetClothes(9, 15, 2);
client.SetClothes(3, 49, 0);
}
else
{
Customization.SetHat(client, 38, 0);
//client.SetClothes(1, 57, 0);
client.SetClothes(11, 46, 0);
client.SetClothes(4, 30, 0);
client.SetClothes(6, 25, 0);
client.SetClothes(9, 17, 2);
client.SetClothes(3, 53, 0);
}
return;

case "takeoff":
Manager.setSkin(client, Main.Players[client].FractionID, Main.Players[client].FractionLVL);
client.SetData("IN_CP_MODE", false);
return;
}
}
#endregion
public static void OpenMeryGunMenu(Client player)
{
Trigger.ClientEvent(player, "meryg");
}
[RemoteEvent("merygun")]

public static void callback_meryGuns(Client client, int index)

{

try

{

switch (index)

{

case 0: //nightstick

Fractions.Manager.giveGun(client, Weapons.Hash.Nightstick, "Nightstick");

return;

case 1: //Pistol

Fractions.Manager.giveGun(client, Weapons.Hash.Pistol, "Pistol");

return;

case 2: //CompactRifle
Fractions.Manager.giveGun(client, Weapons.Hash.CompactRifle, "CompactRifle");

return;

case 3: // pistol ammo

if (!Manager.canGetWeapon(client, "PistolAmmo")) return;

Fractions.Manager.giveAmmo(client, ItemType.PistolAmmo, 12);

return;

case 4: // RiflesAmmo ammo

if (!Manager.canGetWeapon(client, "RiflesAmmo")) return;

Fractions.Manager.giveAmmo(client, ItemType.RiflesAmmo, 15);

return;

case 5: // medkit

if (!Manager.canGetWeapon(client, "Medkits")) return;

if (Fractions.Stocks.fracStocks[17].Medkits == 0)

{

Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, "На складе нет аптечек", 3000);

return;

}

var hItem = nInventory.Find(Main.Players[client].UUID, ItemType.HealthKit);

if (hItem != null)

{

Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, "У Вас уже есть аптечка", 3000);

return;

}

Fractions.Stocks.fracStocks[17].Medkits--;

Fractions.Stocks.fracStocks[17].UpdateLabel();

nInventory.Add(client, new nItem(ItemType.HealthKit, 1));

GameLog.Stock(Main.Players[client].FractionID, Main.Players[client].UUID, "medkit", 1, false);

Notify.Send(client, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы получили аптечку", 3000);

return;

case 6:

if (!Manager.canGetWeapon(client, "armor")) return;

if (Fractions.Stocks.fracStocks[17].Materials < Fractions.Manager.matsForArmor)

{

Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, "На складе недостаточно материала", 3000);

return;

}

var aItem = nInventory.Find(Main.Players[client].UUID, ItemType.BodyArmor);

if (aItem != null)

{

Notify.Send(client, NotifyType.Error, NotifyPosition.BottomCenter, "У Вас уже есть бронежилет", 3000);

return;

}

Fractions.Stocks.fracStocks[17].Materials -= Fractions.Manager.matsForArmor;

Fractions.Stocks.fracStocks[17].UpdateLabel();

nInventory.Add(client, new nItem(ItemType.BodyArmor, 1, 100.ToString()));

Notify.Send(client, NotifyType.Success, NotifyPosition.BottomCenter, $"Вы получили бронежилет", 3000);

GameLog.Stock(Main.Players[client].FractionID, Main.Players[client].UUID, "armor", 1, false);

return;

}

}

catch (Exception e)

{

Log.Write($"Merygun: " + e.Message, nLog.Type.Error);

}

}


}
}
 

vlad_ertushov

Новый участник
20 Май 2021
15
0
6
Да я знаю что все написано, но вот на сервере нету взаимодействия. Просто не работают
 

Furymonyt

Начинающий специалист
16 Апр 2021
320
59
78
Что вылазиет во время интеракта? Возможно просто case в main.cs не поставлен
 
Реакции: Gastello

OleJon

Новый участник
11 Июл 2022
2
0
10
Кто поможет поменять одежду когда игрок начинает рабочий день?