How to eliminate Prop created by GTA.World.CreateProp?
-
Hi guys, I'm Italian and I apologize for any communication problems. I'm new to GTA modding but I'm slowly learning a lot. I have generated props at certain coordinates and I am happy to have achieved this goal but I cannot understand how to eliminate the generated props.
using the function:
GTA.World.CreateProp(model : Model , position: Vector3, dynamic : bool, onGround : bool) : Prop;
This function allowed me to generate the object on the map (in fact in the game I see it correctly) and to have the variable PropThe question is how can I get rid of it? I tried using the native function: DELETE_OBJECT
GTA.Native.Function.Call(GTA.Native.Hash.DELETE_OBJECT, ..parameter..);
I noticed from the documentation that this function requires the pointer to an Object.
Any of you know how to indicate me, having a variable Prop how to eliminate it in game?
-
The CreateProp function returns a Prop variable. You can use that variable to delete the prop, e.g. prop.Delete()
-
Tomorrow i'll try
thank you for answer me
-
@Jitnaught Thank you for tips. Work perfectly! I remember you when i'll publish my creation
-
GTA.World.CreateProp(model : Model , position: Vector3, dynamic : bool, onGround : bool) : Prop;
How remove Collision at generated Prop?
-
@TdB_Snip3r Store the prop to a variable, then set prop.IsCollisionEnabled to false, if you're using Script Hook V .NET V3. If you're using V2, set prop.HasCollision to false.
-
@Jitnaught Thank you, work perfectly. Now my mod is functionally finish. I'll insert some little things for make it better. In practice this mod reads the XML files created by the MapEditor and based on some objects inside it creates a treasure hunt. I wanted to use MapEditor XML to speed up the creation of different scenarios.