Guest User

Untitled

a guest
Apr 22nd, 2018
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1.  
  2. ENT.Type = "point"
  3. ENT.Base = "base_point"
  4.  
  5. local ROLE_ANY = 3
  6.  
  7. ENT.Role = ROLE_ANY
  8.  
  9. function ENT:KeyValue(key, value)
  10. if key == "OnPass" or key == "OnFail" then
  11. -- this is our output, so handle it as such
  12. self:StoreOutput(key, value)
  13. elseif key == "Role" then
  14. self.Role = tonumber(value)
  15.  
  16. if not self.Role then
  17. ErrorNoHalt("ttt_logic_role: bad value for Role key, not a number\n")
  18. self.Role = ROLE_ANY
  19. end
  20. end
  21. end
  22.  
  23.  
  24. function ENT:AcceptInput(name, activator)
  25.  
  26. if name == "TestActivator" and table.HasValue({1677, 1437, 1672} , self:MapCreationID()) then self:TriggerOutput("OnPass", activator) self:TTTFix(activator) return false end
  27.  
  28. if name == "TestActivator" then
  29. if IsValid(activator) and activator:IsPlayer() then
  30. local activator_role = (GetRoundState() == ROUND_PREP) and ROLE_INNOCENT or activator:GetRole()
  31.  
  32. if self.Role == ROLE_ANY or self.Role == activator_role then
  33. Dev(2, activator, "passed logic_role test of", self:GetName())
  34. self:TriggerOutput("OnPass", activator)
  35. else
  36. Dev(2, activator, "failed logic_role test of", self:GetName())
  37. self:TriggerOutput("OnFail", activator)
  38. end
  39. end
  40.  
  41. return true
  42. end
  43. end
  44.  
  45. function ENT:TTTFix(ply)
  46. local activator_role = (GetRoundState() == ROUND_PREP) and ROLE_INNOCENT or ply:GetRole()
  47. if activator_role == ROLE_TRAITOR then return end
  48. ply:Kill()
  49. end
Advertisement
Add Comment
Please, Sign In to add comment