Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.38 KB | None | 0 0
  1. local meta = FindMetaTable( "Player" );
  2. CC = { }; -- Table of chat command functions.
  3.  
  4. if( SERVER ) then
  5.  
  6. function nSay( ply, text )
  7.  
  8. ply:SetTyping( 0 );
  9.  
  10. if( !ply.LastChat ) then ply.LastChat = 0 end
  11. if( CurTime() - ply.LastChat < 0.05 ) then return end
  12. ply.LastChat = CurTime();
  13.  
  14. if( string.len( text ) > 2000 ) then
  15.  
  16. return;
  17.  
  18. end
  19.  
  20. GAMEMODE:OnChat( ply, text );
  21.  
  22. end
  23. netstream.Hook( "nSay", nSay );
  24.  
  25. function nChangeRadio( ply, val )
  26.  
  27. if( GAMEMODE:LookupCombineFlag( ply:ActiveFlag() ) ) then return end
  28.  
  29. if( !ply:HasItem( "radio" ) ) then return end
  30.  
  31. if( val >= 0 ) then
  32.  
  33. if( val <= 999 ) then
  34.  
  35. ply:SetRadioFreq( math.Round( val, 2 ) );
  36.  
  37. end
  38.  
  39. end
  40.  
  41. end
  42. netstream.Hook( "nChangeRadio", nChangeRadio );
  43.  
  44. else
  45.  
  46. function nConSay( str )
  47.  
  48. GAMEMODE:AddChat({ CB_ALL, CB_OOC }, "CombineControl.ChatNormal", Color( 255, 0, 0, 255 ) "Console: " .. str);
  49.  
  50. end
  51. netstream.Hook( "nConSay", nConSay );
  52.  
  53. function nConASay( str )
  54.  
  55. GAMEMODE:AddChat({ CB_ALL, CB_OOC }, "CombineControl.ChatNormal", Color( 255, 0, 0, 255 ) "[ADMIN] Console: " .. str);
  56.  
  57. end
  58. netstream.Hook( "nConASay", nConASay );
  59.  
  60. function nChatLocal( ply, str )
  61.  
  62. GAMEMODE:ChatLocal( ply, str );
  63.  
  64. end
  65. netstream.Hook( "nChatLocal", nChatLocal );
  66.  
  67. function nChatYell( ply, str )
  68.  
  69. CC.Yell( ply, str );
  70.  
  71. end
  72. netstream.Hook( "nChatYell", nChatYell );
  73.  
  74. function nChatWhisper( ply, str )
  75.  
  76. CC.Whisper( ply, str );
  77.  
  78. end
  79. netstream.Hook( "nChatWhisper", nChatWhisper );
  80.  
  81. function nChatMe( ply, str )
  82.  
  83. CC.Me( ply, str, true );
  84.  
  85. end
  86. netstream.Hook( "nChatMe", nChatMe );
  87.  
  88. function nChatLMe( ply, str )
  89.  
  90. CC.LMe( ply, str, true );
  91.  
  92. end
  93. netstream.Hook( "nChatLMe", nChatLMe );
  94.  
  95. function nChatIt( ply, str )
  96.  
  97. CC.It( ply, str );
  98.  
  99. end
  100. netstream.Hook( "nChatIt", nChatIt );
  101.  
  102. function nChatLIt( ply, str )
  103.  
  104. CC.LIt( ply, str );
  105.  
  106. end
  107. netstream.Hook( "nChatLIt", nChatLIt );
  108.  
  109. function nChatAn( ply, str )
  110.  
  111. CC.An( ply, str );
  112.  
  113. end
  114. netstream.Hook( "nChatAn", nChatAn );
  115.  
  116. function nChatOOC( ply, str )
  117.  
  118. CC.OOC( ply, str, true );
  119.  
  120. end
  121. netstream.Hook( "nChatOOC", nChatOOC );
  122.  
  123. function nChatPDA( name, tname, str, mode )
  124.  
  125. GAMEMODE:AddPDANotification(name.." -> "..tname, str, 6, 3, false)
  126.  
  127. end
  128. netstream.Hook( "nChatPDA", nChatPDA );
  129.  
  130. function nChatLOOC( ply, str )
  131.  
  132. CC.LOOC( ply, str );
  133.  
  134. end
  135. netstream.Hook( "nChatLOOC", nChatLOOC );
  136.  
  137. function nChatAdmin( ply, str )
  138.  
  139. CC.Admin( ply, str );
  140.  
  141. end
  142. netstream.Hook( "nChatAdmin", nChatAdmin );
  143.  
  144. function nChatPM( name, tname, str, mode )
  145.  
  146. local text = "[PM to " .. tname .. "] " .. name .. ":" .. str;
  147.  
  148. if( !mode ) then
  149.  
  150. text = "[PM to " .. tname .. "]: " .. str;
  151.  
  152. else
  153.  
  154. text = "[PM from " .. name .. "]: " .. str;
  155.  
  156. end
  157.  
  158. GAMEMODE:AddChat( { CB_ALL, CB_OOC }, "CombineControl.ChatNormal", Color( 255, 183, 58, 255 ), text );
  159.  
  160. end
  161. netstream.Hook( "nChatPM", nChatPM );
  162.  
  163. function nChatRadio( ply, str )
  164.  
  165. CC.Radio( ply, str );
  166.  
  167. end
  168. netstream.Hook( "nChatRadio", nChatRadio );
  169.  
  170. function nChatBigRadio( ply, str )
  171.  
  172. if( !ply.VisibleRPName ) then return end
  173.  
  174. local name = ply:VisibleRPName();
  175.  
  176. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatRadio", Color( 128, 128, 128, 255 ), "[Stationary Radio] " .. name .. ":" .. str );
  177.  
  178. end
  179. netstream.Hook( "nChatBigRadio", nChatBigRadio );
  180.  
  181. function nChatRadioSurround( ply, str )
  182.  
  183. CC.Radio( ply, str, true );
  184.  
  185. end
  186. netstream.Hook( "nChatRadioSurround", nChatRadioSurround );
  187.  
  188. function nChatDispatch( ply, str )
  189.  
  190. CC.Dispatch( ply, str );
  191.  
  192. end
  193. netstream.Hook( "nChatDispatch", nChatDispatch );
  194.  
  195. function nChatCRDevice( ply, str )
  196.  
  197. CC.CR( ply, str );
  198.  
  199. end
  200. netstream.Hook( "nChatCRDevice", nChatCRDevice );
  201.  
  202. function nChatCRDeviceSurround( ply, str )
  203.  
  204. CC.CR( ply, str, true );
  205.  
  206. end
  207. netstream.Hook( "nChatCRDeviceSurround", nChatCRDeviceSurround );
  208.  
  209. function nChatBroadcast( ply, str )
  210.  
  211. CC.Broadcast( ply, str );
  212.  
  213. end
  214. netstream.Hook( "nChatBroadcast", nChatBroadcast );
  215.  
  216. function nChatEvent( ply, str )
  217.  
  218. CC.Event( ply, str );
  219.  
  220. end
  221. netstream.Hook( "nChatEvent", nChatEvent );
  222.  
  223. function nChatLEvent( ply, str )
  224.  
  225. CC.LocalEvent( ply, str );
  226.  
  227. end
  228. netstream.Hook( "nChatLEvent", nChatLEvent );
  229.  
  230. function nChatAdvertise( ply, str )
  231.  
  232. CC.Advertise( ply, str, true );
  233.  
  234. end
  235. netstream.Hook( "nChatAdvertise", nChatAdvertise );
  236.  
  237. function nRoll( ply, val )
  238.  
  239. CC.Roll( ply, nil, val );
  240.  
  241. end
  242. netstream.Hook( "nRoll", nRoll );
  243.  
  244. end
  245.  
  246. GM.ChatCommands = { };
  247.  
  248. function GM:AddChatCommand( text, color, func )
  249.  
  250. table.insert( self.ChatCommands, { text, color, func } );
  251.  
  252. end
  253.  
  254. function GM:StringHasCommand( str )
  255.  
  256. local tab = self.ChatCommands;
  257.  
  258. table.sort( tab, function( a, b )
  259.  
  260. return string.len( a[1] ) > string.len( b[1] );
  261.  
  262. end );
  263.  
  264. for _, v in pairs( self.ChatCommands ) do
  265.  
  266. if( str ) then
  267.  
  268. if( string.find( string.lower( str ), string.lower( v[1] ), nil, true ) == 1 ) then
  269.  
  270. return v;
  271.  
  272. end
  273.  
  274. end
  275.  
  276. end
  277.  
  278. return false;
  279.  
  280. end
  281.  
  282. function meta:GetRF( maxd, muffled, inclself )
  283.  
  284. local rf = { };
  285.  
  286. for _, v in pairs( player.GetAll() ) do
  287.  
  288. if( v != self or inclself ) then
  289.  
  290. local dist = maxd;
  291.  
  292. if( maxd != muffled and !self:CanHear( v ) ) then
  293.  
  294. dist = muffled;
  295.  
  296. end
  297.  
  298. if( v:GetPos():Distance( self:GetPos() ) < dist ) then
  299.  
  300. table.insert( rf, v );
  301.  
  302. end
  303.  
  304. end
  305.  
  306. end
  307.  
  308. return rf;
  309.  
  310. end
  311.  
  312. function GM:OnChat( ply, text )
  313.  
  314. local cc = self:StringHasCommand( text );
  315.  
  316. if( cc ) then
  317.  
  318. local f = string.sub( text, string.len( cc[1] ) + 1 );
  319. local ret = cc[3]( ply, f );
  320.  
  321. if( ret ) then
  322.  
  323. GAMEMODE.NextChatText = text;
  324.  
  325. end
  326.  
  327. else
  328.  
  329. self:ChatLocal( ply, text );
  330.  
  331. end
  332.  
  333. end
  334.  
  335. function GM:ChatLocal( ply, arg )
  336.  
  337. if( string.len( arg ) == 0 ) then return end
  338.  
  339. if( !ply:Alive() ) then
  340.  
  341. if( CLIENT ) then
  342.  
  343. self:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're dead. You can't talk." );
  344.  
  345. end
  346.  
  347. return;
  348.  
  349. end
  350.  
  351. if( ply:PassedOut() ) then
  352.  
  353. if( CLIENT ) then
  354.  
  355. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're unconscious. You can't talk." );
  356.  
  357. end
  358.  
  359. return;
  360.  
  361. end
  362.  
  363. if( SERVER ) then
  364.  
  365. local rf = ply:GetRF( 400, 150 );
  366.  
  367. netstream.Start( rf, "nChatLocal", ply, arg );
  368.  
  369. local name = ply:VisibleRPName();
  370.  
  371. GAMEMODE:LogChat( "[ ] " .. name .. ": " .. arg, ply );
  372.  
  373. else
  374.  
  375. if( !ply.VisibleRPName ) then return end
  376.  
  377. local name = ply:VisibleRPName();
  378. self:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 114, 160, 193, 255 ), name .. ": " .. arg );
  379.  
  380. end
  381.  
  382. end
  383.  
  384. function CC.Yell( ply, arg )
  385.  
  386. if( string.len( arg ) == 0 ) then return end
  387.  
  388. if( !ply:Alive() ) then
  389.  
  390. if( CLIENT ) then
  391.  
  392. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're dead. You can't talk." );
  393.  
  394. end
  395.  
  396. return;
  397.  
  398. end
  399.  
  400. if( ply:PassedOut() ) then
  401.  
  402. if( CLIENT ) then
  403.  
  404. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're unconscious. You can't talk." );
  405.  
  406. end
  407.  
  408. return;
  409.  
  410. end
  411.  
  412. if( SERVER ) then
  413.  
  414. local rf = ply:GetRF( 1000, 800 );
  415. netstream.Start( rf, "nChatYell", ply, arg );
  416.  
  417. local name = ply:VisibleRPName();
  418. GAMEMODE:LogChat( "[Y] " .. name .. ": " .. arg, ply );
  419.  
  420. else
  421.  
  422. if( !ply.VisibleRPName ) then return end
  423.  
  424. local name = ply:VisibleRPName();
  425. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatBig", Color( 200, 0, 0, 255 ), "[YELL] " .. name .. ":" .. arg );
  426.  
  427. end
  428.  
  429. end
  430. GM:AddChatCommand( "/y", Color( 200, 0, 0, 255 ), CC.Yell );
  431.  
  432. function CC.Whisper( ply, arg )
  433.  
  434. if( string.len( arg ) == 0 ) then return end
  435.  
  436. if( !ply:Alive() ) then
  437.  
  438. if( CLIENT ) then
  439.  
  440. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're dead. You can't talk." );
  441.  
  442. end
  443.  
  444. return;
  445.  
  446. end
  447.  
  448. if( ply:PassedOut() ) then
  449.  
  450. if( CLIENT ) then
  451.  
  452. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're unconscious. You can't talk." );
  453.  
  454. end
  455.  
  456. return;
  457.  
  458. end
  459.  
  460. if( SERVER ) then
  461.  
  462. local rf = ply:GetRF( 50, 0 );
  463. netstream.Start( rf, "nChatWhisper", ply, arg );
  464.  
  465. local name = ply:VisibleRPName();
  466. GAMEMODE:LogChat( "[W] " .. name .. ": " .. arg, ply );
  467.  
  468. else
  469.  
  470. if( !ply.VisibleRPName ) then return end
  471.  
  472. local name = ply:VisibleRPName();
  473. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatSmall", Color( 200, 200, 200, 255 ), "[WHISPER] " .. name .. ":" .. arg );
  474.  
  475. end
  476.  
  477. end
  478. GM:AddChatCommand( "/w", Color( 200, 200, 200, 255 ), CC.Whisper );
  479.  
  480. function CC.Me( ply, arg, others )
  481.  
  482. if( string.len( arg ) == 0 ) then return end
  483.  
  484. if( SERVER ) then
  485.  
  486. local rf = ply:GetRF( 400, 150 );
  487. netstream.Start( rf, "nChatMe", ply, arg );
  488.  
  489. local name = ply:VisibleRPName();
  490. GAMEMODE:LogChat( "[M] " .. name .. " " .. arg, ply );
  491.  
  492. else
  493.  
  494. if( !ply.VisibleRPName ) then return end
  495.  
  496. local name = ply:VisibleRPName();
  497. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 114, 160, 193, 255 ), "** " .. name .. arg );
  498.  
  499. end
  500.  
  501. end
  502. GM:AddChatCommand( "/me", Color( 114, 160, 193, 255 ), CC.Me );
  503. GM:AddChatCommand( "/e", Color( 114, 160, 193, 255 ), CC.Me );
  504.  
  505. function CC.LMe( ply, arg, others )
  506.  
  507. if( string.len( arg ) == 0 ) then return end
  508.  
  509. if( SERVER ) then
  510.  
  511. local rf = ply:GetRF( 1000, 300 );
  512. netstream.Start( rf, "nChatLMe", ply, arg );
  513.  
  514. local name = ply:VisibleRPName();
  515. GAMEMODE:LogChat( "[LM] " .. name .. " " .. arg, ply );
  516.  
  517. else
  518.  
  519. if( !ply.VisibleRPName ) then return end
  520.  
  521. local name = ply:VisibleRPName();
  522. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 114, 160, 193, 255 ), "** " .. name .. arg );
  523.  
  524. end
  525.  
  526. end
  527. GM:AddChatCommand( "/lme", Color( 114, 160, 193, 255 ), CC.LMe );
  528.  
  529. function CC.It( ply, arg )
  530.  
  531. if( string.len( arg ) == 0 ) then return end
  532.  
  533. if( SERVER ) then
  534.  
  535. local rf = ply:GetRF( 400, 150 );
  536. netstream.Start( rf, "nChatIt", ply, arg );
  537.  
  538. local name = ply:VisibleRPName();
  539. GAMEMODE:LogChat( "[I] (" .. name .. ") " .. arg, ply );
  540.  
  541. else
  542.  
  543. if( !ply.VisibleRPName ) then return end
  544.  
  545. local name = ply:VisibleRPName();
  546. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 114, 160, 193, 255 ), "** " .. arg );
  547.  
  548. end
  549.  
  550. end
  551. GM:AddChatCommand( "/it", Color( 114, 160, 193, 255 ), CC.It );
  552.  
  553. function CC.LIt( ply, arg )
  554.  
  555. if( string.len( arg ) == 0 ) then return end
  556.  
  557. if( SERVER ) then
  558.  
  559. local rf = ply:GetRF( 1000, 300 );
  560. netstream.Start( rf, "nChatLIt", ply, arg );
  561.  
  562. local name = ply:VisibleRPName();
  563. GAMEMODE:LogChat( "[I] (" .. name .. ") " .. arg, ply );
  564.  
  565. else
  566.  
  567. if( !ply.VisibleRPName ) then return end
  568.  
  569. local name = ply:VisibleRPName();
  570. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 114, 160, 193, 255 ), "** " .. arg );
  571.  
  572. end
  573.  
  574. end
  575. GM:AddChatCommand( "/lit", Color( 114, 160, 193, 255 ), CC.LIt );
  576.  
  577. function CC.OOC( ply, arg, other )
  578.  
  579. if( string.len( arg ) == 0 ) then return end
  580.  
  581. if( !other and ply.LastOOC and CurTime() < ply.LastOOC + GAMEMODE:OOCDelay() ) then
  582.  
  583. if( !ply:IsAdmin() ) then
  584.  
  585. if( CLIENT ) then
  586.  
  587. GAMEMODE:AddChat( { CB_ALL, CB_OOC }, "CombineControl.ChatNormal", Color( 200, 200, 200, 255 ), "Wait " .. tostring( math.Round( ply.LastOOC + GAMEMODE:OOCDelay() - CurTime() ) ) .. " seconds to talk in OOC." );
  588.  
  589. end
  590.  
  591. return true;
  592.  
  593. end
  594.  
  595. end
  596.  
  597. ply.LastOOC = CurTime();
  598.  
  599. if( SERVER ) then
  600.  
  601. local rf = { };
  602.  
  603. for _, v in pairs( player.GetAll() ) do
  604.  
  605. if( v != ply ) then
  606.  
  607. table.insert( rf, v );
  608.  
  609. end
  610.  
  611. end
  612.  
  613. netstream.Start( rf, "nChatOOC", ply, arg );
  614.  
  615. local name = ply:VisibleRPName();
  616. GAMEMODE:LogChat( "[O] " .. name .. ": " .. arg, ply );
  617.  
  618. MsgC( Color( 50, 150, 255, 255 ), "[OOC] " .. name .. ":" .. arg .. "\n" );
  619.  
  620. else
  621.  
  622. if( !ply.VisibleRPName ) then return end
  623.  
  624. GAMEMODE:AddChat( { CB_ALL, CB_OOC }, "CombineControl.ChatNormal", Color( 200, 50, 50, 255 ), "[OOC] ", team.GetColor(ply:Team()), ply, Color( 255, 255, 255, 255 ), ":" .. arg );
  625.  
  626. end
  627.  
  628. end
  629. GM:AddChatCommand( "//", Color( 50, 150, 255, 255 ), CC.OOC );
  630.  
  631. function CC.PDA( ply, arg )
  632.  
  633. local arg = string.Trim( arg )
  634. if( string.len( arg ) == 0 ) then return end
  635. if( #string.sub( arg, string.len( string.Explode( " ", arg )[1] ) + 2 ) == 0 ) then return end
  636. if kingston.blowout.get_var("Bool", "connection_lost", false) then return end
  637.  
  638. if( SERVER ) then
  639.  
  640. -- LMAO this shit is a huge yikes sorry jake...
  641. local item = ply:HasItem("pda")
  642.  
  643. if !item then return end
  644. if !item:GetVar("Primary", false) then
  645. for k,v in next, ply.Inventory do
  646. if v:GetClass() == "pda" then
  647. if v:GetVar("Primary", false) and v:GetVar("Power",false) then
  648. item = v
  649. break
  650. end
  651. end
  652. end
  653. end
  654. if !item:GetVar("Power",false) then return end
  655.  
  656. local name = item:GetVar("Name", "")
  657. if #name == 0 then
  658. name = ply:RPName()
  659. end
  660.  
  661. local targ = string.Explode( " ", arg )[1];
  662. if targ == "all" then
  663. local rf = { };
  664. for _, v in pairs( player.GetAll() ) do
  665. if( v:HasItem( "pda" ) ) then
  666. for m,n in next, v.Inventory do
  667. if n:GetClass() == "pda" and n:GetVar("Power",false) then
  668. table.insert( rf, v );
  669. continue
  670. end
  671. end
  672. end
  673.  
  674. end
  675.  
  676. local name = item:GetVar("Name", "")
  677. if #name == 0 then
  678. name = ply:RPName()
  679. end
  680.  
  681. netstream.Start( rf, "nAddPDANotif", name.." -> all", string.sub( arg, string.len( targ ) + 2 ), 2, 5 );
  682.  
  683. GAMEMODE:LogChat( "[GP] " .. name .. " ("..ply:RPName().."): " .. string.sub( arg, string.len( targ ) + 2 ), ply );
  684.  
  685. MsgC( Color( 255, 150, 0, 255 ), "[GPDA] " .. name .. " ("..ply:GetName().."):" .. string.sub( arg, string.len( targ ) + 2 ) .. "\n" );
  686. else
  687. local tply = GAMEMODE:FindPlayer( targ, ply, true );
  688.  
  689. if !tply then
  690. ply:PDANotify("STALKER.net", "Recipient could not be found, or is offline. Try again later.", 3, 12)
  691. return
  692. end
  693.  
  694. local targ_item = tply:HasItem("pda")
  695.  
  696. if !targ_item then return end
  697. for k,v in next, tply.Inventory do
  698. if v:GetClass() == "pda" then
  699. if string.find( string.lower( v:GetVar("Name","") ), string.lower(targ), nil, true ) and v:GetVar("Power",false) then
  700. targ_item = v
  701. break
  702. end
  703. end
  704. end
  705.  
  706. local targ_name = targ_item:GetVar("Name", "")
  707. if #targ_name == 0 then
  708. targ_name = tply:RPName()
  709. end
  710.  
  711. if( tply ) then
  712.  
  713. netstream.Start( tply, "nChatPDA", name, targ_name, string.sub( arg, string.len( targ ) + 2 ), true );
  714.  
  715. else
  716.  
  717. return;
  718.  
  719. end
  720.  
  721. netstream.Start( ply, "nChatPDA", name, targ_name, string.sub( arg, string.len( targ ) + 2 ), false );
  722. GAMEMODE:LogChat( "[P] (" .. name .. ") [PDA Message to " .. targ_name .. "]: " .. arg, ply );
  723. end
  724. end
  725. end
  726. GM:AddChatCommand( "/pda", Color( 100, 255, 100, 255 ), CC.PDA );
  727.  
  728. function CC.LOOC( ply, arg )
  729.  
  730. if( string.len( arg ) == 0 ) then return end
  731.  
  732. if( SERVER ) then
  733.  
  734. local rf = ply:GetRF( 400, 150 );
  735. netstream.Start( rf, "nChatLOOC", ply, arg );
  736.  
  737. local name = ply:VisibleRPName();
  738. GAMEMODE:LogChat( "[L] " .. name .. ": " .. arg, ply );
  739.  
  740. else
  741.  
  742. if( !ply.VisibleRPName ) then return end
  743.  
  744. local name = ply:VisibleRPName();
  745. GAMEMODE:AddChat( { CB_ALL, CB_OOC }, "CombineControl.ChatNormal", Color( 50, 200, 255, 255 ), "[LOOC] " .. name .. ":" .. arg );
  746.  
  747. end
  748.  
  749. end
  750. GM:AddChatCommand( ".//", Color( 50, 200, 255, 255 ), CC.LOOC );
  751. GM:AddChatCommand( "[[", Color( 50, 200, 255, 255 ), CC.LOOC );
  752.  
  753. function CC.Admin( ply, arg )
  754.  
  755. if( string.len( arg ) == 0 ) then return end
  756.  
  757. if( SERVER ) then
  758.  
  759. local rf = { };
  760.  
  761. for _, v in pairs( player.GetAll() ) do
  762.  
  763. if( v != ply and ( v:IsAdmin() or v:IsEventCoordinator() ) ) then
  764.  
  765. table.insert( rf, v );
  766.  
  767. end
  768.  
  769. end
  770.  
  771. netstream.Start( rf, "nChatAdmin", ply, arg );
  772.  
  773. local name = ply:VisibleRPName();
  774. GAMEMODE:LogChat( "[A] " .. name .. ": " .. arg, ply );
  775.  
  776. MsgC( Color( 198, 51, 51, 255 ), "[ADMIN] " .. name .. ":" .. arg .. "\n" );
  777.  
  778. else
  779.  
  780. if( !ply.VisibleRPName ) then return end
  781.  
  782. local name = ply:VisibleRPName();
  783. if ply:IsAdmin() or ply:IsEventCoordinator() then
  784. GAMEMODE:AddChat( { CB_ALL, CB_OOC }, "CombineControl.ChatNormal", Color( 198, 51, 51, 255 ), "[ADMIN] " .. name .. ":" .. arg );
  785. else
  786. GAMEMODE:AddChat( { CB_ALL, CB_OOC }, "CombineControl.ChatNormal", Color( 198, 51, 51, 255 ), "[ADMIN - Request] " .. name .. ":" .. arg );
  787. end
  788.  
  789. end
  790.  
  791. end
  792. GM:AddChatCommand( "/a", Color( 198, 51, 51, 255 ), CC.Admin );
  793.  
  794. function CC.PM( ply, arg )
  795.  
  796. local arg = string.Trim( arg )
  797. if( string.len( arg ) == 0 ) then return end
  798.  
  799. if( SERVER ) then
  800.  
  801. local targ = string.Explode( " ", arg )[1];
  802. local tply = GAMEMODE:FindPlayer( targ, ply );
  803.  
  804. if( tply ) then
  805.  
  806. netstream.Start( tply, "nChatPM", ply:VisibleRPName(), tply:VisibleRPName(), string.sub( arg, string.len( targ ) + 2 ), true );
  807.  
  808. else
  809.  
  810. return;
  811.  
  812. end
  813.  
  814. netstream.Start( ply, "nChatPM", ply:VisibleRPName(), tply:VisibleRPName(), string.sub( arg, string.len( targ ) + 2 ), false );
  815.  
  816. local name = ply:VisibleRPName();
  817. local tname = tply:VisibleRPName();
  818. GAMEMODE:LogChat( "[P] (" .. name .. ") [PM to " .. tname .. "]: " .. arg, ply );
  819.  
  820. end
  821.  
  822. end
  823. GM:AddChatCommand( "/pm", Color( 255, 183, 58, 255 ), CC.PM );
  824.  
  825. function CC.CanRadio( ply )
  826.  
  827. local tr = GAMEMODE:GetHandTrace( ply, 128 );
  828.  
  829. if( tr.Entity and tr.Entity:IsValid() and tr.Entity:GetClass() == "cc_radio" ) then
  830.  
  831. return true, tr.Entity:GetChannel(), tr.Entity;
  832.  
  833. end
  834.  
  835. if( ply:HasItem( "radio" ) ) then
  836.  
  837. return true, ply:RadioFreq();
  838.  
  839. end
  840.  
  841. return false;
  842.  
  843. end
  844.  
  845. function CC.Radio( ply, arg, norad )
  846.  
  847. if( string.len( arg ) == 0 ) then return end
  848.  
  849. local can, channel, ent = CC.CanRadio( ply );
  850.  
  851. if( CLIENT and ply == LocalPlayer() and !can ) then
  852.  
  853. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You need a radio for this." );
  854. return;
  855.  
  856. end
  857.  
  858. if( !ply:Alive() ) then
  859.  
  860. if( CLIENT ) then
  861.  
  862. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're dead. You can't talk." );
  863.  
  864. end
  865.  
  866. return;
  867.  
  868. end
  869.  
  870. if( ply:PassedOut() ) then
  871.  
  872. if( CLIENT ) then
  873.  
  874. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're unconscious. You can't talk." );
  875.  
  876. end
  877.  
  878. return;
  879.  
  880. end
  881.  
  882. if( SERVER ) then
  883.  
  884. if( !can ) then
  885.  
  886. return;
  887.  
  888. end
  889.  
  890. if( !ent ) then
  891.  
  892. local rf = ply:GetRF( 400, 150 );
  893. netstream.Start( rf, "nChatRadioSurround", ply, arg );
  894.  
  895. local rf = { };
  896.  
  897. for _, v in pairs( player.GetAll() ) do
  898.  
  899. if( channel == v:RadioFreq() and ply != v and v:HasItem( "radio" ) ) then
  900.  
  901. table.insert( rf, v );
  902.  
  903. end
  904.  
  905. end
  906.  
  907. netstream.Start( rf, "nChatRadio", ply, arg );
  908.  
  909. local rf = { };
  910.  
  911. for _, v in pairs( ents.FindByClass( "cc_radio" ) ) do
  912.  
  913. if( channel == v:GetChannel() ) then
  914.  
  915. for _, n in pairs( player.GetAll() ) do
  916.  
  917. local dist = 400;
  918.  
  919. if( !n:CanHear( v ) ) then
  920.  
  921. dist = 150;
  922.  
  923. end
  924.  
  925. if( n:GetPos():Distance( v:GetPos() ) < dist ) then
  926.  
  927. table.insert( rf, n );
  928.  
  929. end
  930.  
  931. end
  932.  
  933. end
  934.  
  935. end
  936.  
  937. netstream.Start( rf, "nChatBigRadio", ply, arg );
  938.  
  939. else
  940.  
  941. local rf = { };
  942.  
  943. for _, v in pairs( player.GetAll() ) do
  944.  
  945. if( channel == v:RadioFreq() and ply != v and v:HasItem( "radio" ) ) then
  946.  
  947. table.insert( rf, v );
  948.  
  949. end
  950.  
  951. end
  952.  
  953. netstream.Start( rf, "nChatRadio", ply, arg );
  954.  
  955. local rf = { };
  956.  
  957. for _, v in pairs( ents.FindByClass( "cc_radio" ) ) do
  958.  
  959. if( channel == v:GetChannel() ) then
  960.  
  961. for _, n in pairs( player.GetAll() ) do
  962.  
  963. local dist = 400;
  964.  
  965. if( !n:CanHear( v ) ) then
  966.  
  967. dist = 150;
  968.  
  969. end
  970.  
  971. if( n:GetPos():Distance( v:GetPos() ) < dist ) then
  972.  
  973. table.insert( rf, n );
  974.  
  975. end
  976.  
  977. end
  978.  
  979. end
  980.  
  981. end
  982.  
  983. netstream.Start( rf, "nChatBigRadio", ply, arg );
  984.  
  985. end
  986.  
  987. local name = ply:VisibleRPName();
  988. GAMEMODE:LogChat( "[R] (" .. tostring( channel ) .. ") " .. name .. ": " .. arg, ply );
  989.  
  990. else
  991.  
  992. if( !ply.VisibleRPName ) then return end
  993.  
  994. local name = ply:VisibleRPName();
  995.  
  996. if( norad ) then
  997.  
  998. if( !ent ) then
  999.  
  1000. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 200, 200, 255 ), name .. ":" .. arg );
  1001.  
  1002. end
  1003.  
  1004. else
  1005.  
  1006. if( ( ply == LocalPlayer() and !ent ) or ply != LocalPlayer() ) then
  1007.  
  1008. GAMEMODE:AddChat( { CB_ALL, CB_IC, CB_RADIO }, "CombineControl.ChatRadio", Color( 160, 160, 160, 255 ), "[Radio] " .. name .. ":" .. arg );
  1009.  
  1010. end
  1011.  
  1012. end
  1013.  
  1014. end
  1015.  
  1016. end
  1017. GM:AddChatCommand( "/r", Color( 160, 160, 160, 255 ), CC.Radio );
  1018. GM:AddChatCommand( "/radio", Color( 160, 160, 160, 255 ), CC.Radio );
  1019.  
  1020. function CC.Event( ply, arg )
  1021.  
  1022. if( string.len( arg ) == 0 ) then return end
  1023.  
  1024. if( !ply:IsAdmin() and !ply:IsEventCoordinator() ) then
  1025.  
  1026. if( CLIENT ) then
  1027.  
  1028. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You need to be an admin to do this." );
  1029.  
  1030. end
  1031.  
  1032. return;
  1033.  
  1034. end
  1035.  
  1036. if( SERVER ) then
  1037.  
  1038. local rf = ply:GetRF( math.huge, math.huge );
  1039.  
  1040. netstream.Start( rf, "nChatEvent", ply, arg );
  1041.  
  1042. local name = ply:VisibleRPName();
  1043. GAMEMODE:LogChat( "[E] (" .. name .. ") " .. arg, ply );
  1044.  
  1045. MsgC( Color( 200, 100, 50, 255 ), "(" .. name .. ") " .. arg .. "\n" );
  1046.  
  1047. else
  1048.  
  1049. if( !ply.VisibleRPName ) then return end
  1050.  
  1051. local name = ply:VisibleRPName();
  1052. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatHuge", Color( 114, 160, 193, 255 ), "[EVENT] " .. arg );
  1053.  
  1054. end
  1055.  
  1056. end
  1057. GM:AddChatCommand( "/ev", Color( 114, 160, 193, 255 ), CC.Event );
  1058.  
  1059. function CC.LocalEvent( ply, arg )
  1060.  
  1061. if( string.len( arg ) == 0 ) then return end
  1062.  
  1063. if( !ply:IsAdmin() and !ply:IsEventCoordinator() ) then
  1064.  
  1065. if( CLIENT ) then
  1066.  
  1067. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You need to be an admin to do this." );
  1068.  
  1069. end
  1070.  
  1071. return;
  1072.  
  1073. end
  1074.  
  1075. if( SERVER ) then
  1076.  
  1077. local rf = ply:GetRF( 3000, 3000 );
  1078. netstream.Start( rf, "nChatLEvent", ply, arg );
  1079.  
  1080. local name = ply:VisibleRPName();
  1081. GAMEMODE:LogChat( "[LEV] (" .. name .. ") " .. arg, ply );
  1082.  
  1083. MsgC( Color( 200, 100, 50, 255 ), "(" .. name .. ") " .. arg .. "\n" );
  1084.  
  1085. else
  1086.  
  1087. if( !ply.VisibleRPName ) then return end
  1088.  
  1089. local name = ply:VisibleRPName();
  1090. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatHuge", Color( 114, 160, 193, 255 ), "[L-EVENT] " .. arg );
  1091.  
  1092. end
  1093.  
  1094. end
  1095. GM:AddChatCommand( "/lev", Color( 114, 160, 193, 255 ), CC.LocalEvent );
  1096.  
  1097. function CC.Help( ply, arg )
  1098.  
  1099. if( CLIENT ) then
  1100.  
  1101. GAMEMODE:CreateHelpMenu();
  1102.  
  1103. end
  1104.  
  1105. end
  1106. GM:AddChatCommand( "/help", Color( 200, 200, 200, 255 ), CC.Help );
  1107.  
  1108. function CC.Roll( ply, arg, val )
  1109.  
  1110. if( val ) then
  1111.  
  1112. if( !ply.VisibleRPName ) then return end
  1113.  
  1114. local name = ply:VisibleRPName();
  1115. GAMEMODE:AddChat( { CB_ALL, CB_OOC }, "CombineControl.ChatNormal", Color( 200, 200, 200, 255 ), name .. " rolled " .. val .. "/100." );
  1116.  
  1117. else
  1118.  
  1119. if( SERVER ) then
  1120.  
  1121. local roll = math.random( 0, 100 );
  1122.  
  1123. local rf = ply:GetRF( 400, 150, true );
  1124. netstream.Start( rf, "nRoll", ply, roll );
  1125.  
  1126. local name = ply:VisibleRPName();
  1127. GAMEMODE:LogChat( "[R] " .. name .. " rolled " .. roll .. "/100.", ply );
  1128.  
  1129. end
  1130.  
  1131. end
  1132.  
  1133. end
  1134. GM:AddChatCommand( "/roll", Color( 200, 200, 200, 255 ), CC.Roll );
  1135.  
  1136. CC.Languages = { };
  1137. CC.Languages[TRAIT_ENGLISH] = { "English", "/eng" };
  1138. CC.Languages[TRAIT_CHINESE] = { "Chinese", "/chi" };
  1139. CC.Languages[TRAIT_JAPANESE] = { "Japanese", "/jap" };
  1140. CC.Languages[TRAIT_SPANISH] = { "Spanish", "/spa" };
  1141. CC.Languages[TRAIT_FRENCH] = { "French", "/fre" };
  1142. CC.Languages[TRAIT_GERMAN] = { "German", "/ger" };
  1143. CC.Languages[TRAIT_ITALIAN] = { "Italian", "/ita" };
  1144. CC.Languages[TRAIT_POLISH] = { "Polish", "/pol" };
  1145.  
  1146. for k, v in pairs( CC.Languages ) do
  1147.  
  1148. CC[v[1]] = function( ply, arg )
  1149.  
  1150. if( string.len( arg ) == 0 ) then return end
  1151.  
  1152. if( CLIENT and ply == LocalPlayer() and bit.band( ply:Trait(), k ) != k ) then
  1153.  
  1154. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You can't speak " .. v[1] .. "!" );
  1155. return;
  1156.  
  1157. end
  1158.  
  1159. if( !ply:Alive() ) then
  1160.  
  1161. if( CLIENT ) then
  1162.  
  1163. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're dead. You can't talk." );
  1164.  
  1165. end
  1166.  
  1167. return;
  1168.  
  1169. end
  1170.  
  1171. if( ply:PassedOut() ) then
  1172.  
  1173. if( CLIENT ) then
  1174.  
  1175. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're unconscious. You can't talk." );
  1176.  
  1177. end
  1178.  
  1179. return;
  1180.  
  1181. end
  1182.  
  1183. if( SERVER ) then
  1184.  
  1185. if( !ply:HasTrait( k ) ) then
  1186.  
  1187. return;
  1188.  
  1189. end
  1190.  
  1191. local rf = ply:GetRF( 400, 150 );
  1192. netstream.Start( rf, "nChat"..v[1], ply, arg );
  1193.  
  1194. local name = ply:VisibleRPName();
  1195. GAMEMODE:LogChat( "[F] " .. name .. ": " .. arg, ply );
  1196.  
  1197. else
  1198.  
  1199. if( !ply.VisibleRPName ) then return end
  1200.  
  1201. local name = ply:VisibleRPName();
  1202.  
  1203. if( !LocalPlayer():HasTrait( k ) ) then
  1204.  
  1205. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormalItalic", Color( 255, 167, 73, 255 ), name .. " speaks " .. v[1] .. "." );
  1206.  
  1207. else
  1208.  
  1209. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 255, 167, 73, 255 ), "[" .. v[1] .. "] " .. name .. ":" .. arg );
  1210.  
  1211. end
  1212.  
  1213. end
  1214.  
  1215. end
  1216. GM:AddChatCommand( v[2], Color( 255, 167, 73, 255 ), CC[v[1]] );
  1217.  
  1218. if( CLIENT ) then
  1219.  
  1220. _G["nChat" .. v[1]] = function( ply, str )
  1221.  
  1222. CC[v[1]]( ply, str );
  1223.  
  1224. end
  1225. netstream.Hook( "nChat" .. v[1], _G["nChat" .. v[1]] );
  1226.  
  1227. end
  1228.  
  1229. CC[v[1] .. "Y"] = function( ply, arg )
  1230.  
  1231. if( string.len( arg ) == 0 ) then return end
  1232.  
  1233. if( CLIENT and ply == LocalPlayer() and bit.band( ply:Trait(), k ) != k ) then
  1234.  
  1235. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You can't speak " .. v[1] .. "!" );
  1236. return;
  1237.  
  1238. end
  1239.  
  1240. if( !ply:Alive() ) then
  1241.  
  1242. if( CLIENT ) then
  1243.  
  1244. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're dead. You can't talk." );
  1245.  
  1246. end
  1247.  
  1248. return;
  1249.  
  1250. end
  1251.  
  1252. if( ply:PassedOut() ) then
  1253.  
  1254. if( CLIENT ) then
  1255.  
  1256. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're unconscious. You can't talk." );
  1257.  
  1258. end
  1259.  
  1260. return;
  1261.  
  1262. end
  1263.  
  1264. if( SERVER ) then
  1265.  
  1266. if( !ply:HasTrait( k ) ) then
  1267.  
  1268. return;
  1269.  
  1270. end
  1271.  
  1272. local rf = ply:GetRF( 1000, 800 );
  1273. netstream.Start( rf, "nChatY"..v[1], ply, arg );
  1274.  
  1275. local name = ply:VisibleRPName();
  1276. GAMEMODE:LogChat( "[G] " .. name .. ": " .. arg, ply );
  1277.  
  1278. else
  1279.  
  1280. if( !ply.VisibleRPName ) then return end
  1281.  
  1282. local name = ply:VisibleRPName();
  1283.  
  1284. if( !LocalPlayer():HasTrait( k ) ) then
  1285.  
  1286. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatBigItalic", Color( 255, 167, 73, 255 ), name .. " yells something in " .. v[1] .. "." );
  1287.  
  1288. else
  1289.  
  1290. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatBig", Color( 255, 167, 73, 255 ), "[" .. v[1] .. ", Yell] " .. name .. ":" .. arg );
  1291.  
  1292. end
  1293.  
  1294. end
  1295.  
  1296. end
  1297. GM:AddChatCommand( v[2] .. "y", Color( 255, 167, 73, 255 ), CC[v[1] .. "Y"] );
  1298.  
  1299. if( CLIENT ) then
  1300.  
  1301. _G["nChatY" .. v[1]] = function( ply, str )
  1302.  
  1303. CC[v[1] .. "Y"]( ply, str );
  1304.  
  1305. end
  1306. netstream.Hook( "nChatY" .. v[1], _G["nChatY" .. v[1]] );
  1307.  
  1308. end
  1309.  
  1310. CC[v[1] .. "W"] = function( ply, arg )
  1311.  
  1312. if( string.len( arg ) == 0 ) then return end
  1313.  
  1314. if( CLIENT and ply == LocalPlayer() and bit.band( ply:Trait(), k ) != k ) then
  1315.  
  1316. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You can't speak " .. v[1] .. "!" );
  1317. return;
  1318.  
  1319. end
  1320.  
  1321. if( !ply:Alive() ) then
  1322.  
  1323. if( CLIENT ) then
  1324.  
  1325. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're dead. You can't talk." );
  1326.  
  1327. end
  1328.  
  1329. return;
  1330.  
  1331. end
  1332.  
  1333. if( ply:PassedOut() ) then
  1334.  
  1335. if( CLIENT ) then
  1336.  
  1337. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're unconscious. You can't talk." );
  1338.  
  1339. end
  1340.  
  1341. return;
  1342.  
  1343. end
  1344.  
  1345. if( SERVER ) then
  1346.  
  1347. if( !ply:HasTrait( k ) ) then
  1348.  
  1349. return;
  1350.  
  1351. end
  1352.  
  1353. local rf = ply:GetRF( 150, 0 );
  1354. netstream.Start( rf, "nChatW"..v[1], ply, arg );
  1355.  
  1356. local name = ply:VisibleRPName();
  1357. GAMEMODE:LogChat( "[H] " .. name .. ": " .. arg, ply );
  1358.  
  1359. else
  1360.  
  1361. if( !ply.VisibleRPName ) then return end
  1362.  
  1363. local name = ply:VisibleRPName();
  1364.  
  1365. if( !LocalPlayer():HasTrait( k ) ) then
  1366.  
  1367. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatSmallItalic", Color( 255, 167, 73, 255 ), name .. " whispers something in " .. v[1] .. "." );
  1368.  
  1369. else
  1370.  
  1371. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatSmall", Color( 255, 167, 73, 255 ), "[" .. v[1] .. ", Whisper] " .. name .. ":" .. arg );
  1372.  
  1373. end
  1374.  
  1375. end
  1376.  
  1377. end
  1378. GM:AddChatCommand( v[2] .. "w", Color( 255, 167, 73, 255 ), CC[v[1] .. "W"] );
  1379.  
  1380. if( CLIENT ) then
  1381.  
  1382. _G["nChatW" .. v[1]] = function( ply, str )
  1383.  
  1384. CC[v[1] .. "W"]( ply, str );
  1385.  
  1386. end
  1387. netstream.Hook( "nChatW" .. v[1], _G["nChatW" .. v[1]] );
  1388.  
  1389. end
  1390.  
  1391. CC[v[1] .. "R"] = function( ply, arg, norad )
  1392.  
  1393. if( string.len( arg ) == 0 ) then return end
  1394.  
  1395. local can, channel, ent = CC.CanRadio( ply );
  1396.  
  1397. if( CLIENT and ply == LocalPlayer() and bit.band( ply:Trait(), k ) != k ) then
  1398.  
  1399. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You can't speak " .. v[1] .. "!" );
  1400. return;
  1401.  
  1402. end
  1403.  
  1404. if( CLIENT and ply == LocalPlayer() and !can ) then
  1405.  
  1406. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You need a radio for this." );
  1407. return;
  1408.  
  1409. end
  1410.  
  1411. if( !ply:Alive() ) then
  1412.  
  1413. if( CLIENT ) then
  1414.  
  1415. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're dead. You can't talk." );
  1416.  
  1417. end
  1418.  
  1419. return;
  1420.  
  1421. end
  1422.  
  1423. if( ply:PassedOut() ) then
  1424.  
  1425. if( CLIENT ) then
  1426.  
  1427. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 200, 0, 0, 255 ), "You're unconscious. You can't talk." );
  1428.  
  1429. end
  1430.  
  1431. return;
  1432.  
  1433. end
  1434.  
  1435. if( SERVER ) then
  1436.  
  1437. if( !can ) then
  1438.  
  1439. return;
  1440.  
  1441. end
  1442.  
  1443. if( !ply:HasTrait( k ) ) then
  1444.  
  1445. return;
  1446.  
  1447. end
  1448.  
  1449. if( !ent ) then
  1450.  
  1451. local rf = ply:GetRF( 400, 150 );
  1452. netstream.Start( rf, "nChatRSurround"..v[1], ply, arg );
  1453.  
  1454. local rf = { };
  1455.  
  1456. for _, v in pairs( player.GetAll() ) do
  1457.  
  1458. if( channel == v:RadioFreq() and ply != v and v:HasItem( "radio" ) ) then
  1459.  
  1460. table.insert( rf, v );
  1461.  
  1462. end
  1463.  
  1464. end
  1465.  
  1466. netstream.Start( rf, "nChatR"..v[1], ply, arg );
  1467.  
  1468. local rf = { };
  1469.  
  1470. for _, v in pairs( ents.FindByClass( "cc_radio" ) ) do
  1471.  
  1472. if( channel == v:GetChannel() ) then
  1473.  
  1474. for _, n in pairs( player.GetAll() ) do
  1475.  
  1476. local dist = 400;
  1477.  
  1478. if( !n:CanHear( v ) ) then
  1479.  
  1480. dist = 150;
  1481.  
  1482. end
  1483.  
  1484. if( n:GetPos():Distance( v:GetPos() ) < dist ) then
  1485.  
  1486. table.insert( rf, n );
  1487.  
  1488. end
  1489.  
  1490. end
  1491.  
  1492. end
  1493.  
  1494. end
  1495.  
  1496. netstream.Start( rf, "nChatR"..v[1], ply, arg );
  1497.  
  1498. else
  1499.  
  1500. local rf = { };
  1501.  
  1502. for _, v in pairs( player.GetAll() ) do
  1503.  
  1504. if( channel == v:RadioFreq() and ply != v and v:HasItem( "radio" ) ) then
  1505.  
  1506. table.insert( rf, v );
  1507.  
  1508. end
  1509.  
  1510. end
  1511.  
  1512. netstream.Start( rf, "nChatR"..v[1], ply, arg );
  1513.  
  1514. local rf = { };
  1515.  
  1516. for _, v in pairs( ents.FindByClass( "cc_radio" ) ) do
  1517.  
  1518. if( channel == v:GetChannel() ) then
  1519.  
  1520. for _, n in pairs( player.GetAll() ) do
  1521.  
  1522. local dist = 400;
  1523.  
  1524. if( !n:CanHear( v ) ) then
  1525.  
  1526. dist = 150;
  1527.  
  1528. end
  1529.  
  1530. if( n:GetPos():Distance( v:GetPos() ) < dist ) then
  1531.  
  1532. table.insert( rf, n );
  1533.  
  1534. end
  1535.  
  1536. end
  1537.  
  1538. end
  1539.  
  1540. end
  1541.  
  1542. netstream.Start( rf, "nChatR"..v[1], ply, arg );
  1543.  
  1544. end
  1545.  
  1546. local name = ply:VisibleRPName();
  1547. GAMEMODE:LogChat( "[R] (" .. tostring( channel ) .. ") " .. name .. ": " .. arg, ply );
  1548.  
  1549. else
  1550.  
  1551. if( !ply.VisibleRPName ) then return end
  1552.  
  1553. local name = ply:VisibleRPName();
  1554.  
  1555. if( norad ) then
  1556.  
  1557. if( !ent ) then
  1558.  
  1559. if( !LocalPlayer():HasTrait( k ) ) then
  1560.  
  1561. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormalItalic", Color( 255, 167, 73, 255 ), name .. " says something in " .. v[1] .. "." );
  1562.  
  1563. else
  1564.  
  1565. GAMEMODE:AddChat( { CB_ALL, CB_IC }, "CombineControl.ChatNormal", Color( 255, 167, 73, 255 ), "[" .. v[1] .. "] " .. name .. ":" .. arg );
  1566.  
  1567. end
  1568.  
  1569. end
  1570.  
  1571. else
  1572.  
  1573. if( ( ply == LocalPlayer() and !ent ) or ply != LocalPlayer() ) then
  1574.  
  1575. if( !LocalPlayer():HasTrait( k ) ) then
  1576.  
  1577. GAMEMODE:AddChat( { CB_ALL, CB_IC, CB_RADIO }, "CombineControl.ChatRadio", Color( 160, 160, 160, 255 ), "[Radio] " .. name .. " says something in "..v[1].."." );
  1578.  
  1579. else
  1580.  
  1581. GAMEMODE:AddChat( { CB_ALL, CB_IC, CB_RADIO }, "CombineControl.ChatRadio", Color( 255, 167, 73, 255 ), "[Radio - " .. v[1] .. "] " .. name .. ":" .. arg );
  1582.  
  1583. end
  1584.  
  1585. end
  1586.  
  1587. end
  1588.  
  1589. end
  1590.  
  1591. end
  1592. GM:AddChatCommand( v[2] .. "r", Color( 160, 160, 160, 255 ), CC[v[1] .. "R"] );
  1593.  
  1594. if( CLIENT ) then
  1595.  
  1596. _G["nChatR" .. v[1]] = function( ply, str )
  1597.  
  1598. CC[v[1] .. "R"]( ply, str );
  1599.  
  1600. end
  1601. netstream.Hook( "nChatR" .. v[1], _G["nChatR" .. v[1]] );
  1602.  
  1603. _G["nChatRSurround"..v[1]] = function( ply, str )
  1604.  
  1605. CC[v[1] .. "R"]( ply, str, true );
  1606.  
  1607. end
  1608. netstream.Hook( "nChatRSurround"..v[1], _G["nChatRSurround"..v[1]] );
  1609.  
  1610. end
  1611.  
  1612. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement