what lua file should I be looking in to fix the auto pick up that occurs after dropping a weapon in darkrp. It seems that in darkrp, after someone presses 'e' on a weapon, rather then adding it to that person's list of weapons, it merely makes it so that anyone even remotely close to it will pick it up. This lasts even after it has been picked up and dropped. This is a huge annoyance for any class that deals weapons, and often results in the destruction of weapons. Anyone know how to fix it?
Go to DarkRP\entities\entities\spawned_weapon\ and open init.lua (notepad will do), find the function ENT:Use and replace all of it with this :
[code]function ENT:Use(activator,caller)
local class = self.Entity.weaponclass
activator:Give(class)
self.Entity:Remove()
end[/code]
I can't guarantee it will work as I haven't tested it, but it should make it so you automatically pickup the weapons. You should probably backup init.lua first.
I hope this helps.
Tried and did not work. Didn't hurt anything, or change anything even(that I know of) but it did not work. Thank you though
Don't know if this works:
[QUOTE=The-Stone;12839842][lua]
// 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[/QUOTE]
Sorry, you need to Log In to post a reply to this thread.