Jump to content

Dropping Weapons


CreepPork

Recommended Posts

Hello!

I've been trying multiple times to make the player drop the weapon that is currently in his hand. I had tried DropToGround() but I think I didn't properly set it up and also I have tried the native, which is: 

NativeFunction.CallByName<uint>("SET_PED_DROPS_WEAPON", Game.LocalPlayer.Character);

That works, but the weapon is dropped right at the players feet, and he immediately picks the weapon up. 

How could I change it so he drops it a further in front of him?

Thanks!

“For a long time it puzzled me how something so expensive, so leading edge, could be so useless. And then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match.”

- Bill Bryson

Link to comment
Share on other sites

16 minutes ago, AlconH said:

Do you want to simply remove the weapon or do you want to create a pickup once dropped?

It doesn't matter, I would prefer to make it as a pickup.

Edited by CreepPork

“For a long time it puzzled me how something so expensive, so leading edge, could be so useless. And then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match.”

- Bill Bryson

Link to comment
Share on other sites

You could also set that the ped cannot pick weapons up if that's possible.

My YouTube: Click here. 

My Discord Server - https://discord.gg/0taiZvBSiw5qGAXU

Useful post? Let me and others know by clicking the Like button.
Check out my many script modifications! 
Having issues? LSPDFR Troubleshooter by Albo1125.

Link to comment
Share on other sites

18 hours ago, Albo1125 said:

You could also set that the ped cannot pick weapons up if that's possible.

I don't think that exists, I'll do some digging, but if I set the player not to pick up weapons, that makes it more broken.

“For a long time it puzzled me how something so expensive, so leading edge, could be so useless. And then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match.”

- Bill Bryson

Link to comment
Share on other sites

Why don't you create an object rather than a pickup?

/* Where modelHash is your weapon hash
* x,y,z is the ped position
* 1st bool is networkHandle
* 2nd bool is createHandle
* 3rd bool is dynamic
*/

NativeFunction.Natives.CreateObject(modelHash, x, y, z, true, true, true); 

or without the natives :

Rage.Object weapon;
Vector3 coords = myPed.Position;   // spawn position
string weaponModel = ""; // replace it with the objectname (not in hash)
weapon = new Rage.Object(weaponModel, coords); // as it is an object, it can not be picked up
NativeFunction.Natives.PlaceObjectOnGroundProperly(weapon); // just in case

 

Edited by winject
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...