Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- radioalert_table_T = {}
- radioalert_table_S = {}
- if CLIENT then
- hook.Add( "HUDPaint", "Hud_KOS_Alert", function()
- HowManyKOS = table.Count(radioalert_table_T)
- HowManySUS = table.Count(radioalert_table_S)
- /*------
- --------SUSPECT
- */------
- x = 0
- y = 250
- if HowManySUS != 0 then
- SY = 250
- SYText = SY+20
- SYBox = 0
- draw.RoundedBoxEx( 8, x, SY, 150, 20, Color(150,150,0,100), false, true, false, false )
- draw.DrawText("Suspect ", "HudHintTextLarge", x+5, SY+3, Color(255, 255, 0, 255),TEXT_ALIGN_LEFT)
- for i = 1 , HowManySUS do
- draw.DrawText(radioalert_table_S[i], "Default", x+5, SYText-1, Color(255,255,255, 255),TEXT_ALIGN_LEFT)
- SYText = SYText+10
- SYBox = SYBox+10
- end
- draw.RoundedBoxEx( 0, x, SY+20, 150, SYBox, Color(100,100,0,100), false, false, false, false )
- draw.RoundedBoxEx( 4, x, SY+20+SYBox, 150, 8, Color(150,150,0,100), false, false, false, true )
- end
- /*------
- --------Traitor
- */------
- if HowManyKOS != 0 then
- if HowManySUS == 0 then
- TY = y
- TYText = TY+20
- TYBox = 0
- else
- TY = SY+SYBox+35
- TYText = TY+20
- TYBox = 0
- end
- draw.RoundedBoxEx( 8, x, TY, 150, 20, Color(150,0,0,100), false, true, false, false )
- draw.DrawText("Traitor - KOS", "HudHintTextLarge", x+5, TY+3, Color(255, 0, 0, 255),TEXT_ALIGN_LEFT)
- -- draw.DrawText(table.Count(radioalert_table_T), "Default", x+100, TY+20, Color(255, 255, 255, 255),TEXT_ALIGN_LEFT)
- for i = 1 , HowManyKOS do
- draw.DrawText(radioalert_table_T[i], "Default", x+5, TYText-1, Color(255,255,255, 255),TEXT_ALIGN_LEFT)
- TYText = TYText+10
- TYBox = TYBox+10
- end
- draw.RoundedBoxEx( 0, x, TY+20, 150, TYBox, Color(100,0,0,100), false, false, false, false )
- draw.RoundedBoxEx( 4, x, TY+20+TYBox, 150, 8, Color(150,0,0,100), false, false, false, true )
- end
- /*------
- --------Player Warnings
- */------
- if table.HasValue(radioalert_table_T, LocalPlayer():Nick()) then
- draw.DrawText("Someone has called you out as a Traitor.", "DermaLarge", 270, ScrH()-35, Color(150, 0, 0, 255),TEXT_ALIGN_LEFT)
- elseif table.HasValue(radioalert_table_S, LocalPlayer():Nick()) then
- draw.DrawText("Someone is suspecting you.", "DermaLarge", 270, ScrH()-35, Color(150, 150, 0, 255),TEXT_ALIGN_LEFT)
- end
- end)
- /*------
- --------Server Net Grabber
- */------
- net.Receive( "Radio_Player_KOS", function( len ) -- Radio Tratior
- Target = net.ReadString()
- Target1 = player.GetByID(Target):Nick()
- if !table.HasValue( radioalert_table_T, Target1 ) and player.GetByID(Target):GetRole() != 2 then
- table.insert(radioalert_table_T,Target1)
- if table.HasValue( radioalert_table_S, Target1 ) then
- table.remove(radioalert_table_S,table.KeyFromValue(radioalert_table_S, Target1))
- end
- end
- end )
- net.Receive( "Radio_Player_SUS", function( len ) -- Radio Suspect
- Target = net.ReadString()
- Target1 = player.GetByID(Target):Nick()
- print(Target)
- if !table.HasValue( radioalert_table_S, Target1 ) and player.GetByID(Target):GetRole() != 2 then
- table.insert(radioalert_table_S,Target1)
- if table.HasValue( radioalert_table_T, Target1 ) then
- table.remove(radioalert_table_T,table.KeyFromValue(radioalert_table_T, Target1))
- end
- end
- end )
- net.Receive( "Radio_Player_REM", function( len ) -- Radio Innocent
- Target = net.ReadString()
- Target1 = player.GetByID(Target):Nick()
- if table.HasValue( radioalert_table_S, Target1 ) then
- table.remove(radioalert_table_S,table.KeyFromValue(radioalert_table_S, Target1))
- end
- if table.HasValue( radioalert_table_T, Target1 ) then
- table.remove(radioalert_table_T,table.KeyFromValue(radioalert_table_T, Target1))
- end
- end )
- net.Receive( "Radio_Player_REM_B", function( len ) -- Dead Bodies
- Target = net.ReadString()
- if table.HasValue( radioalert_table_S, Target1 ) then
- table.remove(radioalert_table_S,table.KeyFromValue(radioalert_table_S, Target1))
- end
- if table.HasValue( radioalert_table_T, Target ) then
- table.remove(radioalert_table_T,table.KeyFromValue(radioalert_table_S, Target))
- end
- end )
- end
- if SERVER then
- /*------
- --------Server Net Cteater
- */------
- util.AddNetworkString( "Radio_Player_KOS" )
- util.AddNetworkString( "Radio_Player_SUS" )
- util.AddNetworkString( "Radio_Player_REM" )
- util.AddNetworkString( "Radio_Player_REM_B" )
- /*------
- --------Radio Hooks and Server Net Senders
- */------
- hook.Add("TTTPlayerRadioCommand", "Radio_KOS_Alert", function(ply, cmd_name, cmd_target)
- if (cmd_name == "quick_traitor" and cmd_target != "quick_nobody" and cmd_target != "quick_corpse") then
- Radio_Target = cmd_target:EntIndex()
- net.Start("Radio_Player_KOS")
- net.WriteString(Radio_Target)
- net.Send(player.GetAll())
- end
- if (cmd_name == "quick_suspect" and cmd_target != "quick_nobody" and cmd_target != "quick_corpse") then
- Radio_Target = cmd_target:EntIndex()
- net.Start("Radio_Player_SUS")
- net.WriteString(Radio_Target)
- net.Send(player.GetAll())
- end
- if (cmd_name == "quick_inno" and cmd_target != "quick_nobody" and cmd_target != "quick_corpse") then
- Radio_Target = cmd_target:EntIndex()
- net.Start("Radio_Player_REM")
- net.WriteString(Radio_Target)
- net.Send(player.GetAll())
- end
- end )
- end
- /*------
- --------Hooks to clear table at brguning of each stage and body clear hook
- */------
- hook.Add("TTTPrepareRound", "ClearRadioTable1", function()
- table.Empty(radioalert_table_T)
- table.Empty(radioalert_table_S)
- end)
- hook.Add("TTTBeginRound", "ClearRadioTable2", function()
- table.Empty(radioalert_table_T)
- table.Empty(radioalert_table_S)
- end)
- hook.Add("TTTEndRound", "ClearRadioTable3", function()
- table.Empty(radioalert_table_T)
- table.Empty(radioalert_table_S)
- end)
- hook.Add("TTTBodyFound", "RemoveRadioTable", function(ply, deadply, rag)
- Radio_Target = tostring(CORPSE.GetPlayerNick(rag))
- net.Start("Radio_Player_REM_B")
- net.WriteString(Radio_Target)
- net.Send(player.GetAll())
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement