T2-BoL/scripts/modscripts/server/RPG/RadioChat.cs

1 line
2.7 KiB
PHP
Raw Permalink Normal View History

//------------------------------------------------------------------------------ // radioChat.cs // Functions for radio voice in T2BoL // Copyright (c) 2012 Robert MacGregor //------------------------------------------------------------------------------ $BOL::Radio::Max = 10; $BOL::Radio::Min = 1; $BOL::Radio::Units = "MHz"; function ServerCmdIncreaseRadioFrequency(%client, %noDisplay) { if (!%client.hasRadio) { messageClient(%client, 'msgClient', "\c3You have no radio to tune."); return; } else if ($CurrentMissionType !$= "RPG") { messageClient(%client, 'msgClient', "\c3Server is not running the RPG gamemode currently."); return; } if (%client.radioFrequency == 0) %client.radioFrequency = 1; if (%client.radioFrequency >= $BOL::Radio::Max) %client.radioFrequency = $BOL::Radio::Min; else %client.radioFrequency++; if (!%noDisplay) messageClient(%client, 'msgClient',"\c3You tune your radio to " @ %client.radioFrequency @ $BOL::Radio::Units @ "."); } function ServerCmdDecreaseRadioFrequency(%client, %noDisplay) { if (!%client.hasRadio) { messageClient(%client, 'msgClient', "\c3You have no radio to tune."); return; } if (%client.radioFrequency == 0) %client.radioFrequency = 1; if (%client.radioFrequency <= $BOL::Radio::Min) %client.radioFrequency = $BOL::Radio::Max; else %client.radioFrequency--; if (!%noDisplay) messageClient(%client, 'msgClient',"\c3You tune your radio to " @ %client.radioFrequency @ $BOL::Radio::Units @ "."); } function radioBroadcast( %text, %frequency ) { %units = $BOL::Radio::Units; %count = ClientGroup.getCount(); for ( %i = 0; %i < %count; %i++ ) { %client = ClientGroup.getObject( %i ); if ( %client.hasRadio && %client.radioFrequency == %frequency ) messageClient(%client,'msgClient',"\c3(" @ %frequency @ %units @ "): " @ %text @ "~wfx/misc/static.wav"); } } function radioChatMessageTeam( %sender, %team, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10 ) { if (!%sender.hasRadio) { messageClient(%sender,'msgNoRadio',"\c3You must have a radio."); return; } %frequency = %sender.radioFrequency; if (%frequency < $BOL::Radio::Min || %frequency > $BOL::Radio::Max) { %sender.radioFrequency = $BOL::Radio::Min; messageClient(%sender,'msgClient',"\c3Your radio appears to be in dire need of retuning."); return; } %units = $BOL::Radio::Units; %count = ClientGroup.getCount(); for ( %i = 0; %i < %count; %i++ ) { %client = ClientGroup.getObject(%i); if ( %client.hasRadio && %client.radioFrequency == %sender.radioFrequency ) messageClient(%client,'msgClient',"\c3"@ %sender.namebase@ " (" @ %frequency @ %units @ "): "@%a2@" ~wfx/misc/static.wav"); } }