Results 1 to 3 of 3
  1. #1
    Skaarj
    Join Date
    Mar 2004
    Posts
    5

    Default Problem getting playername client side

    I am having a problem getting the player name client side. Some times this works and some times this does not. Can anyone see where I am screwing it up?

    class PTChecker extends UnrealSecurity;

    var ClientConnect MyClient;

    simulated function PostNetBeginPlay()
    {
    Super.PostNetBeginPlay();
    if ( ROLE < ROLE_Authority)
    {
    Log("============================================= ============================");
    Log("Mutator");
    Log("============================================= ============================");
    }
    GetClientInfo();
    }

    simulated function GetClientInfo()
    {
    local PlayerController PC;
    local string LocalPlayerName, LocalPlayerHash;
    if ( ROLE < ROLE_Authority )
    {
    PC = Level.GetLocalPlayerController();
    if ( PC != None )
    {
    LocalPlayerName = PC.PlayerReplicationInfo.PlayerName;
    LocalPlayerHash = PC.GetPlayerIDHash();
    }
    MyClient.ConnectClient(LocalPlayerHash, LocalPlayerName);
    }
    }

    defaultproperties
    {
    RemoteRole=ROLE_SimulatedProxy
    bAlwaysRelevant=True
    }
    This is the error I get in the log file.....
    Warning: PTChecker CTF-Grendelkeep.PTChecker (Function PlayerTracker.PTChecker.GetClientInfo:0127) Accessed None 'PlayerReplicationInfo'

    What is weird is that it will grab the player hash every single time. However the player name is grabs some times and other times it gives the error I have listed above. Any help would be appreciated.
    Last edited by legacy-KeltiK; 11-07-2004 at 01:23 AM.

  2. #2
    Iron Guard
    Join Date
    Feb 2002
    Posts
    616

    Default

    Looks like the PlayerReplicationInfo has not yet been spawned for the player. So i suggest you add:

    PC = Level.GetLocalPlayerController();
    if ( (PC != None) && PC.PlayerReplicationInfo !=None )
    {
    LocalPlayerName = PC.PlayerReplicationInfo.PlayerName;

    After all you are not checking to see if the PlayerReplicationInfo is available. That will fix your LOG error, but it may not fix getting the player name, you would need to recheck this at a later time, I guess.

  3. #3
    Skaarj
    Join Date
    Mar 2004
    Posts
    5

    Default

    Thanks for the reply. It gave me an idea. I set a loop to continue checking for when PlayerReplicationInfo becomes spawned and when it does it grabs the playername.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.