Higor
10-25-2012, 11:47 PM
Writing this from a toaster filled with viruses, just as reminder for myself to copy/paste later.
// Short build message storing on connected clients, should display on SiegeStats below the rankings
// Useful for quick screenshots, improves moderation and teamwork, encourages usage of SiegeStats
class sgClientBuildMessages expands Info;
var string sHistory[16];
var PlayerPawn LocalPlayer;
replication
{
reliable if ( Role == ROLE_Authority)
ReceiveMessage;
}
simulated event PostBeginPlay()
{
if ( Level.NetMode != NM_DedicatedServer )
SetTimer(2, false);
}
simulated event Timer()
{
local playerPawn P;
ForEach AllActors (class'PlayerPawn',P)
if ( ViewPort(P.Player) != none )
{ LocalPlayer = P;
return;
}
Destroy(); //Why would a client have no player?
}
simulated function ReceiveMessage( string sMsg, int Team, bool bAnnounce)
{
local int i;
if ( (Spectator(LocalPlayer) == none) && (LocalPlayer.PlayerReplicationInfo.Team != Team) )
return; //Only store messages on spectators and same team players
For ( i=ArrayCount(sHistory) ; i>0 ; i-- )
sHistory[i] = sHistory[i-1]; //Push up
sHistory[0] = sMsg;
if ( bAnnounce )
LocalPlayer.ClientMessage("-== "$sMsg$" ==-");
}
defaultproperties
{
bAlwaysRelevant=True
RemoteRole=ROLE_SimulatedProxy
}
// Short build message storing on connected clients, should display on SiegeStats below the rankings
// Useful for quick screenshots, improves moderation and teamwork, encourages usage of SiegeStats
class sgClientBuildMessages expands Info;
var string sHistory[16];
var PlayerPawn LocalPlayer;
replication
{
reliable if ( Role == ROLE_Authority)
ReceiveMessage;
}
simulated event PostBeginPlay()
{
if ( Level.NetMode != NM_DedicatedServer )
SetTimer(2, false);
}
simulated event Timer()
{
local playerPawn P;
ForEach AllActors (class'PlayerPawn',P)
if ( ViewPort(P.Player) != none )
{ LocalPlayer = P;
return;
}
Destroy(); //Why would a client have no player?
}
simulated function ReceiveMessage( string sMsg, int Team, bool bAnnounce)
{
local int i;
if ( (Spectator(LocalPlayer) == none) && (LocalPlayer.PlayerReplicationInfo.Team != Team) )
return; //Only store messages on spectators and same team players
For ( i=ArrayCount(sHistory) ; i>0 ; i-- )
sHistory[i] = sHistory[i-1]; //Push up
sHistory[0] = sMsg;
if ( bAnnounce )
LocalPlayer.ClientMessage("-== "$sMsg$" ==-");
}
defaultproperties
{
bAlwaysRelevant=True
RemoteRole=ROLE_SimulatedProxy
}