Jump to content

Spawning a model of weapon.img


Recommended Posts

So, i want to spawn a .wdr from the weapon.img, does not matter which item. How do i do this? I looked trough the native functions, and found: CREATE_OBJECT but i could not figure that out because it needed an intenger value for the object model.. Thanks in advance!

Link to comment
https://gtaforums.com/topic/716970-spawning-a-model-of-weaponimg/
Share on other sites

well you can try this (Not tested)

private model YourModel;private object YourObject;YourModel = "MP4 Or Whatever you want";Function.Call("CREATE_OBJECT", YourModel, Player.character.position.X,  Player.character.position.Y,  Player.character.position.Z, YourObject, true);

 

well you can try this (Not tested)

private model YourModel;private object YourObject;YourModel = "MP4 Or Whatever you want";Function.Call("CREATE_OBJECT", YourModel, Player.character.position.X,  Player.character.position.Y,  Player.character.position.Z, YourObject, true);

 

Already tried it, but it does not work.. It says it had unvalid arguments

LordOfTheBongs

i dont think that would be valid code... u do this according to the documentation here... http://www.gtamodding.com/index.php?title=CREATE_OBJECT

 

i forget but i think i use the hexadecimal hash for the glock in my example

GTA.Native.Pointer handlePointer = typeof(int);//this will store the object handle which is an integerGTA.Native.Function.Call("CREATE_OBJECT", 0xFA292061, somePos.X, somePos.Y, somePos.Z, handlePointer, true);int objHandle = (int)handlePointer.Value;//now u can only use this object in natives via Function.Call and refer to this handle

it is easier to just use the shdn wrapper for the create object native and then it lets u use the object with the natives wrapped in the GTA.Object class...

GTA.Object obj = World.CreateObject(new Model(0xFA292061), somePos);
Edited by LordOfTheBongs
  • Like 2

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.