FBModderFresh Posted November 29, 2015 Share Posted November 29, 2015 Hello I am stuck on the code for Spawn Object can anyone give me it please? Link to comment Share on other sites More sharing options...
ISOFX Posted November 30, 2015 Share Posted November 30, 2015 C++ - Credit to Joren on NGU int ObjectHandles[15];int SpawnedObjects;void Create_Object(const char* ObjectName, Vector3 Coordinates){ int ObjectHash = GET_HASH_KEY(ObjectName); if (IS_MODEL_IN_CDIMAGE(ObjectHash)) { if (IS_MODEL_VALID(ObjectHash)) { REQUEST_MODEL(ObjectHash); if (HAS_MODEL_LOADED(ObjectHash)) { ObjectHandles[spawnedObjects] = CREATE_OBJECT(ObjectHash, &Coordinates, 1, 1, 0, 0, 1); SpawnedObjects++; if(SpawnedObjects >= 15) SpawnedObjects = 0; } } }} C# - Credit to ScriptHookVDotNet. // Create a campfire modelvar model = new Model("prop_beach_fire");model.Request(250);// Check the model is validif (model.IsInCdImage && model.IsValid){ // Ensure the model is loaded before we try to create it in the world while (!model.IsLoaded) Script.Wait(50); // Create the prop in the world World.CreateProp(model, Game.Player.Character.GetOffsetInWorldCoords(new Vector3(0, 5, 0)), true, true);}// Mark the model as no longer needed to remove it from memory.model.MarkAsNoLongerNeeded(); 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