Code: Select all
// Send a voice message of a certain type to a certain player.
exec function Speech( int Type, int Index, int Callsign )
{
local VoicePack V;
if ( PlayerReplicationInfo.VoiceType == None || Level.TimeSeconds - OldMessageTime < 2.5 )
return;
else OldMessageTime = Level.TimeSeconds;
V = Spawn( PlayerReplicationInfo.VoiceType, Self );
if (V != None)
{
V.PlayerSpeech( Type, Index, Callsign );
V.Destroy();
}
}
Code: Select all
function SendVoiceMessage(PlayerReplicationInfo Sender, PlayerReplicationInfo Recipient, name messagetype, byte messageID, name broadcasttype)
{
local Pawn P;
local bool bNoSpeak;
if ( Level.TimeSeconds - OldMessageTime < 2.5 )
bNoSpeak = true;
else
OldMessageTime = Level.TimeSeconds;
for ( P=Level.PawnList; P!=None; P=P.NextPawn )
{
if ( P.IsA('PlayerPawn') )
{
if ( !bNoSpeak )
{
if ( (broadcasttype == 'GLOBAL') || !Level.Game.bTeamGame )
P.ClientVoiceMessage(Sender, Recipient, messagetype, messageID);
else if ( Sender.Team == P.PlayerReplicationInfo.Team )
P.ClientVoiceMessage(Sender, Recipient, messagetype, messageID);
}
}
else if ( (P.PlayerReplicationInfo == Recipient) || ((messagetype == 'ORDER') && (Recipient == None)) )
P.BotVoiceMessage(messagetype, messageID, self);
}
}
if ( Level.TimeSeconds - OldMessageTime < 2.5 )
is always true here, since OldMessageTime is set to Level.TimeSeconds right before this check. So bNoSpeak forever.
It's worth noting that neither 226b nor UT have such an interesting premature assignment, so I wonder why it was added there. It should be removed or moved to the end of PlayerPawn.Speech.