Guy I need help with script of drop ammo
I'd like to make it /dropweapon and it drops 50 ammo of the current weapon
Client:
function createPickup (player)
local px, py, pz = getElementPosition ( player )
local currentweapon = getPlayerWeapon ( player )
if (currentweapon) then
drop = createPickup ( px, py, pz, 2, currentweapon, 3000, 50)
end
end
addCommandHandler ( "dropweapon", createPickup)
server:
function onPickupHitFunc ( thePlayer )
if getPickupType ( drop ) == 2 then
local ammo = getPickupAmmo ( drop )
if ammo < 50 then
local weapon = getPickupWeapon ( drop )
giveWeaponAmmo ( thePlayer, weapon, 50 )
outputChatBox ( "You just picked up a " .. getWeaponNameFromID(weapon) .. " with " .. ammo .. " ammo", thePlayer )
end
end
end
addEventHandler ( "onPickupHit", getRootElement(), onPickupHitFunc )
Need help