• Хостинг игровых серверов

    Максимальная производительность для ваших игровых серверов!

    Заказать сейчас

Помогите Как заспавнить машину уже с обвесами?

Aspire

23 Ноя 2018
17
-1
3
Как заспавнить машину уже с обвесами, движком и т.д. ? Товар в магазин хотелось бы такой добавить.
Не нашел на форуме решения.
 
Последнее редактирование:
C#:
                if (args[0] == "install")

                {

                    //Check for permission to install

                    if (!userHasPerm(session, "vehiclemanager.install"))

                    {

                        hurt.SendChatMessage(session, null, Color(GetMsg("msg_SERVER"), "#4B0082") + GetMsg("msg_permission").Replace("{perm}", "vehiclemanager.install"));

                        return;

                    }



                    // /car install 1-8 [mandatory for side panels: L|R]

                    //Check if player is installing a correct vehicle attachment

                    int slot = -1;

                    if (!int.TryParse(args[1], out slot) || slot < 1 || slot > 8)

                    {

                        hurt.SendChatMessage(session, null, Color(GetMsg("msg_INFO"), "#800080") + GetMsg("msg_carInfo"));

                        return;

                    }

                    PlayerInventory playerInventory = session.WorldPlayerEntity.GetComponent<PlayerInventory>();

                    var playerInventory_items = playerInventory.Items;

                    var playerItemInstance = playerInventory_items[slot - 1];

                    if (playerItemInstance != null)

                    {

                        IItem item = playerItemInstance.Item;

                        ESlotType itemSlotType = getSlotType(item);

                        string slotTypeString = itemSlotType.ToString().ToLower();

                        if (!slotTypeString.Contains(vehicleType))

                        {

                            if ((vehicleType == "roach" && slotTypeString.Contains("goat"))

                                || (vehicleType == "goat" && slotTypeString.Contains("roach"))

                                || (vehicleType == "kanga" && slotTypeString.Contains("kanga")))

                                hurt.SendChatMessage(session, null, Color(GetMsg("msg_INFO"), "#800080") + GetMsg("msg_notCorrectVehicleAttachment").Replace("{vehicleType}", vehicleType));

                            else

                                hurt.SendChatMessage(session, null, Color(GetMsg("msg_INFO"), "#800080") + GetMsg("msg_notVehicleAttachment"));

                            return;

                        }

                        if (itemSlotType == ESlotType.RoachSidePanel)

                        {

                            if (args.Length == 2 || (args.Length == 3 && (args[2].ToLower() != "l" && args[2].ToLower() != "r")))

                            {

                                hurt.SendChatMessage(session, null, Color(GetMsg("msg_INFO"), "#800080") + GetMsg("msg_roachSideIncorrect"));

                                hurt.SendChatMessage(session, null, Color(GetMsg("msg_INFO"), "#800080") + GetMsg("msg_carInfo"));

                                return;

                            }

                        }

                        //Correct item. Can install/switch.

                        //Check if vehicle has the same attachment type installed. If not, install player's item. If yes, switch with player's item.

                        if (controller != null)

                        {

                            if (restrictedInv != null)

                            {

                                SlotRestriction[] restrictions = restrictedInv.Restrictions;

                                for (int k = 0; k < (int)restrictions.Length; k++)

                                {

                                    ESlotType slotRestrictionType = restrictions[k].SlotType;

                                    if (slotRestrictionType == itemSlotType)

                                    {

                                        if (itemSlotType == ESlotType.RoachSidePanel && !sideMatchWithSlot(k, args[2].ToLower()))

                                        {

                                            continue;

                                        }

                                        //Found correct slot type

                                        if (restrictedInv.Items[restrictions[k].SlotNumber] == null)

                                        {

                                            //Vehicle doesn't have attachment on that slot. Can install.

                                            vehicleInstall(session, playerItemInstance, restrictedInv, restrictions[k].SlotNumber);

                                            hurt.SendChatMessage(session, null, Color(GetMsg("msg_INFO"), "#800080") + GetMsg("msg_vehicleInstall").Replace("{attachInstalled}", Color(playerItemInstance.Item.GetNameKey(), "#800080")).Replace("{vehicleType}", vehicleType));

                                        }

                                        else

                                        {

                                            //Vehicle have attachment on that slot. Can switch.

                                            string attachSwitched = vehicleSwitch(session, playerItemInstance, restrictedInv, restrictions[k].SlotNumber);

                                            hurt.SendChatMessage(session, null, Color(GetMsg("msg_INFO"), "#800080") + GetMsg("msg_vehicleSwitch").Replace("{attachSwitched}", Color(attachSwitched, "#800080")).Replace("{vehicleType}", vehicleType).Replace("{attachInstalled}", Color(playerItemInstance.Item.GetNameKey(), "#800080")));

                                        }

                                        restrictedInv.Invalidate(false);

                                        return;

                                    }

                                }

                            }

                        }

                    }

                    else

                    {

                        hurt.SendChatMessage(session, null, Color(GetMsg("msg_INFO"), "#800080") + GetMsg("msg_noCarAttachment").Replace("{slot}", slot + ""));

                    }

                }

С плагина VehicleManager , может поможет тебе...
 
Последнее редактирование:
Активность
Пока никто не печатает сообщение