Skip to content

Instantly share code, notes, and snippets.

@ValentinFunk
Created November 7, 2017 10:10
Show Gist options
  • Save ValentinFunk/d6cc30c828ec9d0316ba8ef0eb4e5858 to your computer and use it in GitHub Desktop.
Save ValentinFunk/d6cc30c828ec9d0316ba8ef0eb4e5858 to your computer and use it in GitHub Desktop.
Restrict Weapons to a certain Team. Place in lua/autorun/server
local RestrictWeaponMixin = {}
function RestrictWeaponMixin:included( klass )
local oldGiveWeapon = klaas.GiveWeapon
klass.GiveWeapon = function(self)
if self:GetOwner():Team() == TEAM_PRISIONER then
if string.find(self.weaponClass, "csgo") then
return oldGiveWeapon(self)
end
self:GetOwner():ChatPrint("[Pointshop 2] Not giving you " .. self:GetPrintName() .. " since you are a prisioner.")
return
end
return oldGiveWeapon(self)
end
KLogf(4, "[RestrictWeaponMixin] Patched base_weapon item" )
end
Pointshop2.RegisterItemClassMixin( "base_weapon", RestrictWeaponMixin )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment