Buy Detective


SUBMITTED BY: Guest

DATE: May 14, 2013, 6:05 p.m.

FORMAT: Lua

SIZE: 1.0 kB

HITS: 9789

  1. ITEM.Name = 'Buy Once: Detective'
  2. ITEM.Price = 1000
  3. ITEM.Material = 'VGUI/ttt/sprite_traitor.vmt'
  4. ITEM.OneUse = true
  5. ITEM.AllowedUserGroups = { "admin", "donator", "superadmin","vipmoderator","vetadmin","sdonator","bdonator","gdonator","ddonator" }
  6. function ITEM:OnEquip(ply, modifications)
  7. hook.Add("TTTBeginRound", ply:UniqueID() .. "_detective", function()
  8. if ply:GetRoleString() != "detective" then
  9. ply:SetRole(ROLE_DETECTIVE)
  10. ply:AddCredits(GetConVarNumber("ttt_credits_starting"))
  11. end
  12. if SERVER then
  13. ply:PS_TakeItem(self.ID)
  14. end
  15. hook.Remove("TTTBeginRound", ply:UniqueID() .. "_detective")
  16. end)
  17. end
  18. function ITEM:OnHolster(ply)
  19. hook.Remove("TTTBeginRound", ply:UniqueID() .. "_detective")
  20. end
  21. function ITEM:OnSell(ply)
  22. hook.Remove("TTTBeginRound", ply:UniqueID() .. "_detective")
  23. end

comments powered by Disqus