Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ITEM.Name = "Golden crowbar"
- ITEM.Price = 80000
- ITEM.Model = "models/weapons/w_crowbar.mdl"
- ITEM.DonatorOnly = true
- local _gold = Color(255,204,0,255)
- local _white = Color(255,255,255,255)
- local _swep = "weapon_zm_improvised"
- local _swep1 = "weapon_ttt_crowbar1"
- local _shine = "models/shiny"
- if CLIENT then
- hook.Add("PreDrawViewModel", "GoldCrowbar", function(vm, p, w )
- if vm and vm:IsValid() then
- local ply = ( p and p:GetObserverTarget() and p:GetObserverTarget():IsValid() and p:GetObserverTarget():IsPlayer() ) and p:GetObserverTarget() or p
- if w and w:IsValid() and w:GetClass() == _swep or _swep1 and ply and ply:IsValid() and ply:GetNWBool("golden",false) then
- if not vm._golden then
- vm._golden = true
- vm:SetColor( _gold )
- vm:SetMaterial( _shine )
- end
- elseif vm._golden then
- vm:SetMaterial("")
- vm:SetColor( _white )
- vm._golden = false
- end
- end
- end )
- end
- function ITEM:OnBuy( ply )
- ply:SetNWBool("golden", true)
- local crowbar = ply:GetWeapon(weapon_zm_improvised) or ply:GetWeapon("weapon_ttt_crowbar1")
- if crowbar and crowbar:IsValid() then
- print(crowbar)
- crowbar:SetColor( _gold )
- crowbar:SetMaterial(_shine)
- end
- end
- ITEM.PlayerLoadout = ITEM.OnBuy
- ITEM.OnEquip = ITEM.OnBuy
- function ITEM:OnSell(ply)
- ply:SetNWBool("golden", false)
- local crowbar = ply:GetWeapon(weapon_zm_improvised) or ply:GetWeapon("weapon_ttt_crowbar1")
- if crowbar and crowbar:IsValid() then
- crowbar:SetMaterial("")
- crowbar:SetColor( _white )
- end
- end
- ITEM.OnHolster = ITEM.OnSell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement