Blabla456789 Posted January 20, 2021 Share Posted January 20, 2021 (edited) Hi, I'm making a mod in c# where a ped spawn, I'm courious to know if there is a way to delete this ped once I have reloded the script (pressing Insert and reload all the scripts), I'm trying with no success with DELETE_ENTITY, any advice? Thanks! Edited January 20, 2021 by Blabla456789 Link to comment Share on other sites More sharing options...
LeeC22 Posted January 20, 2021 Share Posted January 20, 2021 (edited) 33 minutes ago, Blabla456789 said: Hi, I'm making a mod in c# where a ped spawn, I'm courious to know if there is a way to delete this ped once I have reloded the script (pressing Insert and reload all the scripts), I'm trying with no success with DELETE_ENTITY, any advice? Thanks! Anything you wish to delete has to be held in a variable in your script. So define a Global variable called MyPed or whatever name you choose and when you create the Ped, do MyPed = World.CreatePed(etc...) Then in your Aborted event handler, which you create the same way as your Tick handler, just check if (MyPed != null && MyPed.Exists()) and then do MyPed.Delete() inside the if (){} check. If you create more peds, you can store them in a List<Ped> MyPeds and then in the Aborted event, check and delete them inside a foreach (Ped p in MyPeds) Edited January 20, 2021 by LeeC22 Link to comment Share on other sites More sharing options...
Blabla456789 Posted January 20, 2021 Author Share Posted January 20, 2021 worked perfectly, thanks a lot!! LeeC22 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now