[Release] Player Current Weapon Drop

Could you post an edited one for noobs like me…?

Is there a pick up in the script or just drop atm

ok i will do it today after i get back home


thanks would really appreciate a version with key press , i hope you figure out how to make the gun drop instead of it turning into a ammo clip too , and make it pick up-able by others , maybe look at the games native function when someone with a gun dies and it drops to the ground to see how that works.

And when you’re finished could you also send me a list of all the possible keys? i know lua has it in numbers but i haven’t been able to find a list of it yet.

That’s my own Post he he

AddEventHandler('dropweapon', function()
	local ped = GetPlayerPed(-1)
	if DoesEntityExist(ped) and not IsEntityDead(ped) then
		ShowNotification("~r~You have dropped your weapon.")

function ShowNotification(text)
	DrawNotification(false, false)

	while true do
			if IsControlJustPressed(1, 81) then

and modify server.lua to :

AddEventHandler('drops', function()
	TriggerClientEvent('dropweapon', source)

Same thing here. I drop one weapon and then the avatar rearms another weapon instantly. I’m not even running many resources really and nothing else conflicts or works improperly, but this resource. It’s a good idea, but needs some kinks worked out I think to work better with other resource scripts.

When you drop your weapon another one is equipped. I believe this is just how GTA does it. You can use the native givepedweapon and use the unarmed hash. Put the code right after setpeddropsweapon(ped). Not at home, can’t test.

thanks a lot HBK that works perfect :smiley:

i think its related to essential mode or you have something else that’s conflicting with this one, lets say you have a weapon database , this script is not gonna remove your weapon from database too and you might rearm every time you use it.

You equip another weapon from your inventory, it’s from GTA, not from other ressources.

I’ve PM “hbk” with a fresh new script, I let him publish it.

Spoiler :
Drop weapon model
Lootable by other
set unarmed after drop

See ya, have fun

That’s what I said above. Lol. Add one native and it works fine. :grinning: Lootable by others, that’s cool though. Although I have player weapon pickup false. (Prison guards and military drop Ar’s)

dont kill the wanted level and add the no dispatch native :wink:

Prison guard and Military will defend it self

True, but I prefer no wanted level. And they will defend themselves but if killed they still drop weapons. I found out after 4hrs of playing around that setting a model type not to drop weapons is not so easy. Until I can figure that out, I just don’t allow players weapon pickups.

how about blacklist militarian models?

I tried that awhile back. It blacklists them from being spawned by player but doesn’t stop them from spawning naturally. Went to the base, tanks and military and chat was being spammed with “this model is blacklisted”. For military vehicles I just lock that vehicle class.

if you tested it and it’s ok you can post it here as modification, if guys are gonna like it i will put it into first link too

I would rather use SET_PED_DROPS_INVENTORY_WEAPON than SET_PED_DROPS_WEAPON because you have a better control on the weapon object :

  • Choose the offset to drop the weapon
  • Force the pickup to match with the weapon hash

More details http://www.dev-c.com/nativedb/func/info/208a1888007fc0e6