• Hook PlayerCanPickupWeapons "not working"
    2 replies, posted
I'm new to LUA and i dont know much about hooks... Im working on a Power Round called "Nemesis" in it basically there must be a player randomly selected with an m249, lots of life and infinite ammo... Almost everything is ready, the only problem is that I can not make Hook "PlayerCanPickupWeapons" work... I've already tried it in several ways but I could not make it work... Here are a few attempts ...   -- function PlayerCanPickupWeapon(Ply, wep) -- if Ply:GetRole() == ROLE_DETECTIVE then -- return (wep:GetClass() == "weapon_zm_sledge") end -- hook.Add("PlayerCanPickupWeapon") -- end ---------------------------------------------------------------------------------------------------------   -- hook.Add("PlayerCanPickupWeapon", function(Ply,wep) -- if Ply:GetRole() == ROLE_DETECTIVE and wep:GetClass() ~= "weapon_zm_sledge" then return false end -- end ) --------------------------------------------------------------------------------------------------------- -- Hooks["PlayerCanPickupWeapon"] = function( Ply, wep ) -- if Ply:GetRole() == ROLE_DETECTIVE and wep:GetClass() ~= "weapon_zm_sledge" then return false end -- end But no one is working... Can someone help me?
Check out hook.Add on the wiki as your using it wrong. https://wiki.garrysmod.com/page/hook/Add
Yeah, thank you! It worked!
Sorry, you need to Log In to post a reply to this thread.