• A toggleable "Use to pickup weapon" using a convar
    4 replies, posted
Hello! I need a really simple script that force you to press +use to pickup a weapon... But with some addition like a Convar to enable it ( like "UseToPickup 1" ) and a ConVar to make that you can't pickup weapon at all (even if you are pressing use) Thanks you if you make it!
Up, that could help me a lot!
Again, I'm bumping this thread because I really need it, you know, for making save(not the crappy one, one with a real story) and for personal use on my friend server.
Here's the code, to block weapon pickup. It's convar to disable is weapon_nopickup. [code] local NoWeaponPickup = CreateConVar( "weapon_nopickup", "0", { FCVAR_REPLICATED, FCVAR_ARCHIVE, FCVAR_SERVER_CAN_EXECUTE } ) hook.Add("CanPlayerPickup","Canihazwep", function(ply, weapon) if NoWeaponPickup:GetBool() then return end if !ply.IsSpawned then ply:Give(weapon) end if ply:KeyDown(IN_USE) and ply.IsSpawned then ply:Give(weapon) else return false end end) hook.Add("PlayerSpawn") function() if !ply:IsValid() then return end timer.Simple( 5, function() ply.IsSpawned = true end) end) [/code] Tell me, if it doesn't work.
I will test it in a second, thanks! Edit: Doesn't seem to work :( Thanks anyways
Sorry, you need to Log In to post a reply to this thread.