Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. -- Called alot
  2. function GM:CheckPlayerDeathRoundEnd()
  3. if !GAMEMODE.RoundBased || !GAMEMODE:InRound() then
  4. return
  5. end
  6.  
  7. local Teams = GAMEMODE:GetTeamAliveCounts()
  8.  
  9. if table.Count(Teams) == 0 then
  10. GAMEMODE:RoundEndWithResult(1001, "Draw, everyone loses!")
  11. VOICE_IS_END_ROUND = 1
  12. ForceCloseTauntWindow(1)
  13. return
  14. end
  15.  
  16. if table.Count(Teams) == 1 then
  17. local TeamID = table.GetFirstKey(Teams)
  18. -- debug
  19. MsgAll("Round Result: "..team.GetName(TeamID).." ("..TeamID..") Wins!\n")
  20. -- End Round
  21. GAMEMODE:RoundEndWithResult(TeamID, team.GetName(TeamID).." win!") -- fix end result that often opposited as "Props Win" or "Hunter Win".
  22. VOICE_IS_END_ROUND = 1
  23. ForceCloseTauntWindow(1)
  24. return
  25. end
  26. end
  27.  
  28. -- Player Voice & Chat Control to prevent Metagaming. (As requested by some server owners/suggestors.)
  29. -- You can disable this feature by typing 'sv_alltalk 1' in console to make everyone can hear.
  30.  
  31. -- Control Player Voice
  32. local alltalk = GetConVar("sv_alltalk")
  33. function GM:PlayerCanHearPlayersVoice(listen, speaker)
  34.  
  35. local alltalk_cvar = alltalk:GetInt()
  36. if (alltalk_cvar > 0) then return true, false end
  37.  
  38. -- prevent Loopback check.
  39. if (listen == speaker) then return false, false end
  40.  
  41. -- Only alive players can listen other living players.
  42. if listen:Alive() && speaker:Alive() then return true, false end
  43.  
  44. -- Event: On Round Start. Living Players don't listen to dead players.
  45. if VOICE_IS_END_ROUND == 0 && listen:Alive() && !speaker:Alive() then return false, false end
  46.  
  47. -- Listen to all dead players while you dead.
  48. if !listen:Alive() && !speaker:Alive() then return true, false end
  49.  
  50. -- However, Living players can be heard from dead players.
  51. if !listen:Alive() && speaker:Alive() then return true, false end
  52.  
  53. -- Event: On Round End/Time End. Listen to everyone.
  54. if VOICE_IS_END_ROUND == 1 && listen:Alive() && !speaker:Alive() then return true, false end
  55.  
  56. -- Spectator can only read from themselves.
  57. if listen:Team() == TEAM_SPECTATOR && listen:Alive() && speaker:Alive() then return false, false end
  58.  
  59. -- This is for ULX "Permanent Gag". Uncomment this if you have issues.
  60. -- if speaker:GetPData( "permgagged" ) == "true" then return false, false end
  61. end
  62.  
  63. -- Control Players Chat
  64. function GM:PlayerCanSeePlayersChat(txt, onteam, listen, speaker)
  65.  
  66. if ( onteam ) then
  67. -- Generic Specific OnTeam chats
  68. if ( !IsValid( speaker ) || !IsValid( listen ) ) then return false end
  69. if ( listen:Team() != speaker:Team() ) then return false end
  70.  
  71. -- ditto, this is same as below.
  72. if listen:Alive() && speaker:Alive() then return true end
  73. if VOICE_IS_END_ROUND == 0 && listen:Alive() && !speaker:Alive() then return false end
  74. if !listen:Alive() && !speaker:Alive() then return true end
  75. if !listen:Alive() && speaker:Alive() then return true end
  76. if VOICE_IS_END_ROUND == 1 && listen:Alive() && !speaker:Alive() then return true end
  77. if listen:Team() == TEAM_SPECTATOR && listen:Alive() && speaker:Alive() then return false end
  78. end
  79.  
  80. -- Generic Checks
  81. if ( !IsValid( speaker ) || !IsValid( listen ) ) then return false end
  82.  
  83. -- Only alive players can see other living players.
  84. if listen:Alive() && speaker:Alive() then return true end
  85.  
  86. -- Event: On Round Start. Living Players don't see dead players' chat.
  87. if VOICE_IS_END_ROUND == 0 && listen:Alive() && !speaker:Alive() then return false end
  88.  
  89. -- See Chat to all dead players while you dead.
  90. if !listen:Alive() && !speaker:Alive() then return true end
  91.  
  92. -- However, Living players' chat can be seen from dead players.
  93. if !listen:Alive() && speaker:Alive() then return true end
  94.  
  95. -- Event: On Round End/Time End. See Chat to everyone.
  96. if VOICE_IS_END_ROUND == 1 && listen:Alive() && !speaker:Alive() then return true end
  97.  
  98. -- Spectator can only read from themselves.
  99. if listen:Team() == TEAM_SPECTATOR && listen:Alive() && speaker:Alive() then return false end
  100. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement