tomybk Posted December 4, 2019 Share Posted December 4, 2019 Hello everyone, This code add blip to map: Blip newBlip1 = World.CreateBlip(new Vector3(1767.84f, 3328.11f, 45.60f)); newBlip1.Sprite = BlipSprite.Repair; But how goes for delete or remove? I try this two and doesnt work any of them newBlip1.RemoveAt(); newBlip1.Delete(); Link to comment Share on other sites More sharing options...
Tanjitsu Posted December 6, 2019 Share Posted December 6, 2019 (edited) newBlip1.Delete(); If you are using ScriptHookDotNet... in V2 .Remove() in V3 .Delete() would be the correct function to remove the blip. Edited December 6, 2019 by Tanjitsu Link to comment Share on other sites More sharing options...
tomybk Posted December 7, 2019 Author Share Posted December 7, 2019 Thank you for answering, i already try that but didnt work Let me show entire code below: var checkbox6 = new UIMenuCheckboxItem("Show Car Services", checkbox, ""); // Creates checkbox displaying text sub10.AddItem(checkbox6); // Adds the creates item onto the menu/submenu checkbox6.Enabled = true; // Enables the variable button sub10.OnCheckboxChange += (sender, item, checked_) => // Enables the variable checkbox { if (item == checkbox6) // If statement, this checks if the item selected is the variable in the if statement. { if (checked_ == true) // If statement, checks if the item is checked { Blip newBlip1 = World.CreateBlip(new Vector3(1767.84f, 3328.11f, 45.60f)); newBlip1.Sprite = BlipSprite.Bennys; newBlip1.Scale = 0.9f; newBlip1.Color = BlipColor.Blue; UI.Notify("~w~Car Services Showed on Map"); } else if (checked_ == false) // If statement, checks if the item is not checked { // This two below dont work //newBlip1.RemoveAt(); //newBlip1.Delete(); UI.ShowSubtitle("~w~Car Services Removed from Map"); } } }; Link to comment Share on other sites More sharing options...
Tanjitsu Posted December 8, 2019 Share Posted December 8, 2019 Change it too.... Blip newBlip1 = null; var checkbox6 = new UIMenuCheckboxItem("Show Car Services", checkbox, ""); // Creates checkbox displaying text sub10.AddItem(checkbox6); // Adds the creates item onto the menu/submenu checkbox6.Enabled = true; // Enables the variable button sub10.OnCheckboxChange += (sender, item, checked_) => // Enables the variable checkbox { if (item == checkbox6) // If statement, this checks if the item selected is the variable in the if statement. { if (checked_ == true) // If statement, checks if the item is checked { newBlip1 = World.CreateBlip(new Vector3(1767.84f, 3328.11f, 45.60f)); newBlip1.Sprite = BlipSprite.Bennys; newBlip1.Scale = 0.9f; newBlip1.Color = BlipColor.Blue; UI.Notify("~w~Car Services Showed on Map"); } else if (checked_ == false) // If statement, checks if the item is not checked { if (newBlip1 != null) newBlip1.Delete(); //newBlip1.RemoveAt(); // This two below dont work UI.ShowSubtitle("~w~Car Services Removed from Map"); } } }; You need to define the Blip newBlip1 outside of sub10.OnCheckboxChange. Atm if _checked you create a variable named newBlip1. Next time it runs, _checked is false so no variable is created named newBlip1. newBlip1 needs to be stored outside the function so it exists everytime the function sub10.OnCheckboxChange is run. Link to comment Share on other sites More sharing options...