private void HideOnUseItem() { foreach (Entity ent in ItemsList) { if (ent.GetField <int>("used") == 1) { ent.Hide(); foreach (Entity fx in FXList) { if (fx.Origin.DistanceTo(ent.Origin + new Vector3(0, 0, -50)) <= 10) { FXList.Remove(fx); fx.Delete(); break; } } Entity newfx = SpawnTriggerFX(redcircle_fx, ent.Origin + new Vector3(0, 0, -50)); FXList.Add(newfx); } else { ent.Show(); foreach (Entity fx in FXList) { if (fx.Origin.DistanceTo(ent.Origin + new Vector3(0, 0, -50)) <= 10) { FXList.Remove(fx); fx.Delete(); break; } } Entity newfx = SpawnTriggerFX(goldcircle_fx, ent.Origin + new Vector3(0, 0, -50)); FXList.Add(newfx); } } }
private void SpawnItems() { //Spawn FX //Set Weapons List <string> Weapons = new List <string>(); int[] itemCount = RandomNum(TargetZones.Length, 0, OS_Weapons.Length); for (int i = 0; i < itemCount.Length; i++) { Weapons.Add(OS_Weapons[itemCount[i]]); } //Spawn Weapons & FX int spawnedcount = 0; foreach (Vector3 zone in TargetZones) { Entity fx = SpawnTriggerFX(goldcircle_fx, zone + new Vector3(0, 0, -50)); FXList.Add(fx); Entity wep = SpawnModel(zone - new Vector3(0, 0, 10), FindModelbyWep(Weapons[spawnedcount])); ItemsList.Add(wep); spawnedcount++; } //Items Init foreach (Entity Items in ItemsList) { Items.SetField("used", 0); if (!OS_Models.Contains(Items.Model)) { Items.Delete(); } if (!GSCFunctions.IsDefined(Items)) { ItemsList.Remove(Items); } } //Set Perk Zone List <int> PerkZone = new List <int>(); int[] objperkszone = RandomNum(3, 0, ItemsList.Count); for (int i = 0; i < objperkszone.Length; i++) { PerkZone.Add(objperkszone[i]); } //Set Perks List <int> Perks = new List <int>(); int[] _numperk = RandomNum(3, 0, os_perks.Length); for (int i = 0; i < _numperk.Length; i++) { Perks.Add(_numperk[i]); } //Spawn Perks int count = 0; foreach (int num in PerkZone) { ItemsList[num].SetModel(os_perk); ItemsList[num].SetField("perk", os_perks[_numperk[count]]); count++; } //Rotate Models OnInterval(5000, () => { foreach (Entity ent in ItemsList) { ent.RotateYaw(360, 5); } return(true); }); }