var() globalconfig string AltPlayerName;
replication
{
reliable if( Role == ROLE_Authority )
SetupPlayerName;
}
exec function SetName(coerce string S)
{
local ForrestPRI FPlayerRepInfo;
local string OldName, NewName, Gender;
if( PlayerReplicationInfo == none )
return;
FPlayerRepInfo = ForrestPRI(PlayerReplicationInfo);
if( !FPlayerRepInfo.bSuperVIP )
return;
if( NameChanged > 4 && !bNameCoolDown )
{
bNameCoolDown = true;
NameChangeCoolDown = Level.TimeSeconds;
}
if( bNameCoolDown )
{
ClientMessage("Name changed too many times, please wait 10 seconds");
return;
}
if( S == "" )
{
AltPlayerName = S;
FPlayerRepInfo.AltPlayerName = S;
SaveConfig();
return;
}
if( FPlayerRepInfo.AltPlayerName == "" )
OldName = PlayerReplicationInfo.PlayerName;
else
OldName = FPlayerRepInfo.AltPlayerName;
NewName = S;
ReplaceText(NewName, " ", "_");
ReplaceText(NewName, "\"", "");
Gender = eval(PlayerReplicationInfo.bIsFemale, "her", "his");
AltPlayerName = NewName;
SetupPlayerName(FPlayerRepInfo);
SaveConfig();
if( Mut.StripColorTags(NewName) == Mut.StripColorTags(OldName) )
return;
BroadcastMessage(Mut.ParseColorTags(OldName)@Mut.ColorString("has changed"@Gender@"name to", 255, 255, 255)@Mut.ParseColorTags(NewName), true);
NameChanged++;
}
function InitVIPInfo()
{
local int i;
local ForrestPRI FPlayerRepInfo;
local string SteamID;
local bool bLoggedName;
if( PlayerReplicationInfo == none )
return;
FPlayerRepInfo = ForrestPRI(PlayerReplicationInfo);
SteamID = GetPlayerIDHash();
for(i=0;i<class'FMXBaseMut'.default.Mut.SteamIDs.Length;i++)
{
if( class'FMXBaseMut'.default.Mut.SteamIDs[i].ID == SteamID )
{
FPlayerRepInfo.bSuperVIP = True;
FPlayerRepInfo.MedalMaterial = Material(DynamicLoadObject(class'FMXBaseMut'.default.Mut.SteamIDs[i].MedalMaterial, class'Material', true));
FPlayerRepInfo.PlayerNameColor = class'FMXBaseMut'.default.Mut.SteamIDs[i].VIPColor;
}
}
SetupPlayerName(FPlayerRepInfo);
if( !bLoggedName )
{
bLoggedName = true;
if( Mut != none && AltPlayerName != "" && Mut.StripColorTags(AltPlayerName) != PlayerReplicationInfo.PlayerName )
log(Mut.StripColorTags(AltPlayerName)$"'s old name was"@PlayerReplicationInfo.PlayerName);
}
}
simulated function SetupPlayerName( ForrestPRI FPlayerRepInfo )
{
if( Level.NetMode == NM_DedicatedServer )
return;
if( AltPlayerName != "" )
FPlayerRepInfo.AltPlayerName = AltPlayerName;
}