• can't grab weapons in darkrp
    6 replies, posted
i useing // RabidToaster is SO frickin cool // What the hell is this doing clientside? if ( CLIENT ) then return end local function PlayerCanPickupWeapon( ply, weap ) if ( CurTime() <= ( ply.UseWeaponSpawn or 0 ) ) then return end if ( !ply:KeyDown( IN_USE ) ) then return false end local trace = util.QuickTrace( ply:GetShootPos(), ply:GetAimVector() * 8192, ply ) if ( !trace.Entity || !trace.Entity:IsValid() || trace.Entity != weap ) then return false end end hook.Add( "PlayerCanPickupWeapon", "UseWeapon", PlayerCanPickupWeapon ) local function PlayerSpawn( ply ) ply.UseWeaponSpawn = CurTime() end hook.Add( "PlayerSpawn", "UseWeapon", PlayerSpawn ) [/lua] Credits go to RabidToaster https://gmod.facepunch.com/f/gmoddev/lhwx/Disable-auto-pick-up-in-dakrp/1/https://gmod.facepunch.com/f/gmoddev/lhwx/Disable-auto-pick-up-in-dakrp/1/https://gmod.facepunch.com/f/gmoddev/lhwx/Disable-auto-pick-up-in-dakrp/1/https://gmod.facepunch.com/f/gmoddev/lhwx/Disable-auto-pick-up-in-dakrp/1/https://gmod.facepunch.com/f/gmoddev/lhwx/Disable-auto-pick-up-in-dakrp/1/https://gmod.facepunch.com/f/gmoddev/lhwx/Disable-auto-pick-up-in-dakrp/1/https://gmod.facepunch.com/f/gmoddev/lhwx/Disable-auto-pick-up-in-dakrp/1/ after i can't grab weapon using /drop command and shipment weapon
Auto-grab should already be disabled with that code since it requires the Use key to be pressed. What exactly is the issue? Also, the "UseWeaponSpawn" feature will never work since the time is never changed, and a few optimisations can be made: -- https://github.com/VSES/SourceEngine2007/blob/43a5c90a5ada1e69ca044595383be67f40b33c61/se2007/game/shared/baseplayer_shared.cpp#L965 local MASK_USE = bit.bor(MASK_SOLID, CONTENTS_DEBRIS, CONTENTS_PLAYERCLIP) hook.Add("PlayerCanPickupWeapon", "UseWeapon", function(pPlayer, pWeapon) if (not pPlayer:KeyDown(IN_USE)) then return false end local vStart = pPlayer:EyePos() local vEnd = pPlayer:EyeAngles():Forward() vEnd:Mul(1024) vEnd:Add(vStart) -- Not completely accurate but GMod doesn't have FindUseEntity if (util.TraceLine({start = vStart, endpos = vEnd, filter = pPlayer}).Entity ~= pWeapon) then return false end end)
where put in this code lua/autorun/sever/name.lua???
Sure, anywhere serverside works.
did't work join user lost spawn items and same probolm so i turn back codes and this problom
Does that only start to appear when you use the custom pickup code?
yes
Sorry, you need to Log In to post a reply to this thread.