• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code What functions are called after PostLogin

forrestmark9

Grizzled Veteran
Nov 29, 2011
1,110
42
I need to know what functions are called after PostLogin, I made a VIP system that sets certain things when the player joins but I need GetPlayerIDHash() to return the players SteamID and not his CD-Key hash and this seems to only happen after PostLogin is called. I currently have the function call in Tick on the PRI but it has rpoven unreliable as it seems to skip players and sometimes doesn't work

Here is the code if you could improve it in anyway

PRI
Code:
function Tick(float DT)
{
	Super.Tick(DT);

    if( !bGotVIPValues )
    {
        bGotVIPValues = true;
        if( FMXPlayerController(Owner) != none )
            FMXPlayerController(Owner).InitVIPInfo();
    }
}

PlayerController
Code:
function InitVIPInfo()
{
    local int i;
    local ForrestPRI FPlayerRepInfo;
    local string SteamID;
    local FMXScrnMut FScrnMut;
    
    FPlayerRepInfo = ForrestPRI(PlayerReplicationInfo);
    if( FPlayerRepInfo == none )
        return;

    SteamID = GetPlayerIDHash();
    FScrnMut = FMXScrnMut(Mut);
    
    for(i=0;i<FScrnMut.SteamIDs.Length;i++)
    {
        if( FScrnMut.SteamIDs[i].ID == SteamID )
        {
            FPlayerRepInfo.IsVIP = true;
            FPlayerRepInfo.bSuperVIP = True;
            FPlayerRepInfo.MedalMaterial = Material(DynamicLoadObject(FScrnMut.SteamIDs[i].MedalMaterial, class'Material', true));
            FPlayerRepInfo.PlayerNameColor = FScrnMut.SteamIDs[i].VIPColor;
            BecomeVIP();
        }
    }
}
 
CheckReplacement, adding actor to pending array, calling timer or setting time when to update in tick, something like it works in ServerPerks. Why dont use this scheme?

And if talk about improving existing code, maybe something like this:
...
if( !bGotVIPValues && InitVIPInfo() )
bGotVIPValues = true;
...

function bool InitVIPInfo()
{
local FMXPlayerController PC;

PC = FMXPlayerController(Owner);
if ( PC != none ) return PC.InitVIPInfo(Self);
return false;
}

...

Controller

...

function bool InitVIPInfo(FPlayerRepInfo FPRI)
{
if ( FPRI == none ) return false;
...
return true;
}
 
Last edited:
Upvote 0