Created
November 7, 2017 10:10
-
-
Save ValentinFunk/d6cc30c828ec9d0316ba8ef0eb4e5858 to your computer and use it in GitHub Desktop.
Restrict Weapons to a certain Team. Place in lua/autorun/server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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