public void ArmedBody_WeaponChange(Client player, WeaponHash old_weapon) { if (WeaponData.ContainsKey(old_weapon)) { CreateWeaponProp(player, old_weapon); } WeaponHash current_weapon = player.currentWeapon; if (WeaponData.ContainsKey(current_weapon)) { int type = (int)WeaponData[current_weapon].Type; if (player.hasData(WeaponKeys[type])) { GrandTheftMultiplayer.Server.Elements.Object obj = player.getData(WeaponKeys[type]); if (obj.model == API.getHashKey(WeaponData[current_weapon].Model)) { obj.delete(); player.resetData(WeaponKeys[type]); } } } }
public SafeLootItem(Safe safe, Vector3 offset) { Amount = Main.SafeRNG.Next(Main.SafeMinLoot, Main.SafeMaxLoot + 1); Object = API.shared.createObject(API.shared.getHashKey("bkr_prop_moneypack_01a"), safe.Position, new Vector3(0.0, 0.0, 0.0)); Object.attachTo(safe.Object.handle, null, offset, new Vector3(0.0, 0.0, 0.0)); Label = API.shared.createTextLabel("~g~$" + Amount, safe.Position, 7.5f, 0.65f, true); Label.attachTo(Object.handle, null, new Vector3(0, 0, 0.17), new Vector3(0, 0, 0)); }
public DroppedItem(Guid dropID, ItemID itemID, WorldModel model, Vector3 position, int quantity) { ID = itemID; Name = ItemDefinitions.ItemDictionary[itemID].Name; _quantity = quantity; RemoveTime = DateTime.Now.AddMinutes(Main.DroppedItemLifetime); _itemObject = API.shared.createObject(API.shared.getHashKey(model.ModelName), position + model.Offset, model.Rotation); _itemObject.setSyncedData("ItemDropID", dropID.ToString()); _itemLabel = API.shared.createTextLabel($"{Name} x{quantity}", position + model.Offset + new Vector3(0.0, 0.0, 0.15), 10f, 0.5f, false); }
public void SetProp(Client player, int model) { if (_attachedObject != null) { API.detachEntity(_attachedObject); API.deleteEntity(_attachedObject); } _model = model; _attachedObject = API.createObject(_model, new Vector3(), new Vector3()); UpdateObject(player); API.sendChatMessageToPlayer(player, "Set prop to " + model); }
public void CreateWeaponProp(Client player, WeaponHash weapon) { if (!WeaponData.ContainsKey(weapon)) { return; } RemoveWeaponProp(player, WeaponData[weapon].Type); // make sure player has the weapon if (Array.IndexOf(player.weapons, weapon) == -1) { return; } string bone = ""; Vector3 offset = new Vector3(0.0, 0.0, 0.0); Vector3 rotation = new Vector3(0.0, 0.0, 0.0); switch (WeaponData[weapon].Type) { case WeaponAttachmentType.RightLeg: bone = "SKEL_R_Thigh"; offset = new Vector3(0.02, 0.06, 0.1); rotation = new Vector3(-100.0, 0.0, 0.0); break; case WeaponAttachmentType.LeftLeg: bone = "SKEL_L_Thigh"; offset = new Vector3(0.08, 0.03, -0.1); rotation = new Vector3(-80.77, 0.0, 0.0); break; case WeaponAttachmentType.RightBack: bone = "SKEL_Spine3"; offset = new Vector3(-0.1, -0.15, -0.13); rotation = new Vector3(0.0, 0.0, 3.5); break; case WeaponAttachmentType.LeftBack: bone = "SKEL_Spine3"; offset = new Vector3(-0.1, -0.15, 0.11); rotation = new Vector3(-180.0, 0.0, 0.0); break; } GrandTheftMultiplayer.Server.Elements.Object temp_handle = API.createObject(API.getHashKey(WeaponData[weapon].Model), player.position, new Vector3()); temp_handle.attachTo(player.handle, bone, offset, rotation); player.setData(WeaponKeys[(int)WeaponData[weapon].Type], temp_handle); }
public void RemoveWeaponProp(Client player, WeaponAttachmentType type) { int type_int = (int)type; if (!player.hasData(WeaponKeys[type_int])) { return; } GrandTheftMultiplayer.Server.Elements.Object obj = player.getData(WeaponKeys[type_int]); obj.delete(); player.resetData(WeaponKeys[type_int]); }
public void RemoveWeaponProps(Client player) { foreach (string key in WeaponKeys) { if (!player.hasData(key)) { continue; } GrandTheftMultiplayer.Server.Elements.Object obj = player.getData(key); obj.delete(); player.resetData(key); } }
/// <summary> /// Перемещает груз в фургон /// </summary> private static void DetachBooty(Vehicle vehicle, Object bootyObject, int bootyCount) { var place = (MissionPlace)bootyObject.getData(PLACE_KEY); var offsets = MissionDataGetter.VansOffsets[place]; if (offsets.ContainsKey(bootyCount)) { bootyObject.detach(); bootyObject.position = vehicle.position; bootyObject.attachTo(vehicle, null, offsets[bootyCount], new Vector3(0.0, 0.0, 0.15)); ((List <Object>)vehicle.getData(ClanCourtyard.BOOTY_IN_TRUNK)).Add(bootyObject); } else { API.shared.deleteEntity(bootyObject); } }
public void RemovePlayerWeapon(Client player, WeaponHash weapon) { if (WeaponData.ContainsKey(weapon)) { string key = WeaponKeys[(int)WeaponData[weapon].Type]; if (player.hasData(key)) { GrandTheftMultiplayer.Server.Elements.Object obj = player.getData(key); if (obj.model == API.getHashKey(WeaponData[weapon].Model)) { obj.delete(); player.resetData(key); } } } player.removeWeapon(weapon); }
public void Create() { Object = API.shared.createObject(API.shared.getHashKey("v_ilev_gangsafe"), Position, new Vector3(0.0, 0.0, Rotation)); DoorObject = API.shared.createObject(API.shared.getHashKey("v_ilev_gangsafedoor"), Position, new Vector3(0.0, 0.0, Rotation)); ColShape = API.shared.createCylinderColShape(Position, 1.25f, 1.0f); Label = API.shared.createTextLabel("~g~Safe", Position, 10f, 0.65f, false); Label.attachTo(Object.handle, null, new Vector3(-0.35, 0.25, 1.05), new Vector3(0.0, 0.0, 0.0)); LockAngle = Main.SafeRNG.Next(0, 361); ColShape.onEntityEnterColShape += (shape, entity) => { Client player; if ((player = API.shared.getPlayerFromHandle(entity)) != null) { player.triggerEvent("SetSafeNearby", true); player.setData("temp_SafeID", ID); } }; ColShape.onEntityExitColShape += (shape, entity) => { Client player; if ((player = API.shared.getPlayerFromHandle(entity)) != null) { if (player == Occupier) { Occupier = null; } player.triggerEvent("SetSafeNearby", false); player.triggerEvent("SetDialInfo", 0.0, false); player.resetData("temp_SafeID"); } }; }
public void Create(int dimension) { Object = API.shared.createObject(Model, Position, Rotation, dimension); }
public static void EnableObjectEditor(Client player, GrandTheftMultiplayer.Server.Elements.Object obj) { player.setData("ObjEditor", obj); player.triggerEvent("EditorStatus", true); }