Quantcast

Jump to content

» «
Photo

Spawning a model of weapon.img

9 replies to this topic
Wiebrendh
  • Wiebrendh

    C# Programmer

  • Members
  • Joined: 22 Mar 2014
  • Netherlands

#1

Posted 18 June 2014 - 06:10 PM

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!


stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#2

Posted 18 June 2014 - 07:16 PM

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);

Wiebrendh
  • Wiebrendh

    C# Programmer

  • Members
  • Joined: 22 Mar 2014
  • Netherlands

#3

Posted 18 June 2014 - 07:45 PM

 

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
  • LordOfTheBongs

    Deceased

  • Members
  • Joined: 21 Sep 2013
  • None

#4

Posted 18 June 2014 - 08:03 PM Edited by LordOfTheBongs, 18 June 2014 - 08:08 PM.

i dont think that would be valid code... u do this according to the documentation here... http://www.gtamoddin...e=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 integer
GTA.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);
  • Maro Hannover and Wiebrendh like this

Maro Hannover
  • Maro Hannover

    Scriptboy

  • BUSTED!
  • Joined: 06 Jan 2014
  • None

#5

Posted 19 June 2014 - 09:28 PM

Thanks Bong i wanted this also


LordOfTheBongs
  • LordOfTheBongs

    Deceased

  • Members
  • Joined: 21 Sep 2013
  • None

#6

Posted 19 June 2014 - 11:01 PM

no problem ;)


Rugz007
  • Rugz007

    Scripters ... roll out !

  • Members
  • Joined: 19 Apr 2014
  • India

#7

Posted 20 June 2014 - 03:35 AM

Now Maro it's good behaviour

Wiebrendh
  • Wiebrendh

    C# Programmer

  • Members
  • Joined: 22 Mar 2014
  • Netherlands

#8

Posted 20 June 2014 - 09:07 AM

Now Maro it's good behaviour

 

Yeah, he learns it way faster than you do

  • stef538 likes this

stef538
  • stef538

    It's just me, going 88 MPH.

  • Members
  • Joined: 06 Oct 2012
  • Netherlands

#9

Posted 20 June 2014 - 09:09 AM

Hahahaha


Rugz007
  • Rugz007

    Scripters ... roll out !

  • Members
  • Joined: 19 Apr 2014
  • India

#10

Posted 20 June 2014 - 09:10 AM

Good Joker :D




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users