Jump to content
Sign in to follow this  
takumo@gmail.com

How can I take item from the ground into inventory (on shoulders)?

Recommended Posts

Hello!


I'm spawning a rifle on the ground using player.SpawnEntityOnGroundPos , then I'm attaching a magazine and filling it with bullets and also putting one in chamber. This works, but I need this to be on the player shoulder. I also tried ServerTakeEntityToInventory but it is working weird: it actually takes the gun to player shoulder, but player still sees it on the ground. If I reconnect to the server I see it on my shoulder. 


I also tried to create the item in user inventory initially using player.GetInventory().CreateInInventory, but it has another problem: if item is created that way, chamber cannot be loaded, it shows that bullet is in the chamber, but firing is not working, trigger just clicks.


Thank you

Share this post


Link to post
Share on other sites
8 hours ago, takumo@gmail.com said:

Hello!


I'm spawning a rifle on the ground using player.SpawnEntityOnGroundPos , then I'm attaching a magazine and filling it with bullets and also putting one in chamber. This works, but I need this to be on the player shoulder. I also tried ServerTakeEntityToInventory but it is working weird: it actually takes the gun to player shoulder, but player still sees it on the ground. If I reconnect to the server I see it on my shoulder. 


I also tried to create the item in user inventory initially using player.GetInventory().CreateInInventory, but it has another problem: if item is created that way, chamber cannot be loaded, it shows that bullet is in the chamber, but firing is not working, trigger just clicks.


Thank you

In other topic I'd written for you an example for loadout with AKM and SKS, there has some code that will fix your problem at all. It might be used on almost every gun in game.

So basically use player.getinv.createininventory fnc, catch the spawned EntityAI in your inventory, casting in useful classes instances and make what you need with it.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×