[Release] Player Current Weapon Drop

As the title said, this script is gonna drop your weapon on ground ( if you have a weapon in your hand ) , it’s not gonna do anything if you don’t have a weapon in your hand .

To do list : Add the actual weapon model drop ( atm it’s gonna be a ammunition charger .) - If possible

Drop

You trigger by typing /dropgun in chat.

Link is fixed , and if this happends again, remember that in my previous releases you will find my github, where i store all the releases.

6 Likes

This is such a wonderful release, wanted to do this, but got too busy at work, glad you made this, thank you so much :smiley:

1 Like

Well it drops one gun then another one is in my hand, and another ,and another and so on. Great idea so far.

1 Like

There is a famous GTA Online quote : Not on my screen :stuck_out_tongue:
Conclusion : i don’t know what code you have in your server that’s preventing this script to work proper.

Another great script that will add to the role-play experience! Thank you!

1 Like

no update for weapon on the floor ?

I want to make a black market only for a player and do the transaction with the weapon on the ground, if anyone can help me, thx in advance.

If you want this, you need to change the weapon store. Like do a check and save the current weapon for players all x minutes.

is there anyway to trigger the drop weapon by a key press ? trying to avoid using chat at all for any functions , thanks in advance for any help that can be given :smiley:

yes you can, you modify the client to trigger from pressing a key and get rid of the server.lua

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

2 Likes

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.

1 Like

That’s my own Post he he

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

function ShowNotification(text)
	SetNotificationTextEntry("STRING")
	AddTextComponentString(text)
	DrawNotification(false, false)
end

Citizen.CreateThread(function()
	while true do
		Wait(0)
			if IsControlJustPressed(1, 81) then
				TriggerServerEvent("drops")
			end
		end 
end)

and modify server.lua to :

RegisterServerEvent('drops')
AddEventHandler('drops', function()
	TriggerClientEvent('dropweapon', source)
end)
2 Likes

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: