Results 1 to 4 of 4
  1. #1
    Iron Guard
    Join Date
    Feb 2010
    Location
    [COM]->[EU]->[PL]
    Posts
    653

    Default Call func problem SIM->REL SRV / SIM-> REL CLT-> REL SRV from Pawn

    Hi!

    I have problem with calling server function from simulated PostBeginPlay

    Code:
    // in MyPawn
    var int UTCOffset;
    
    simulated event PostBeginPlay()
    {
    	super.PostBeginPlay();
    
    	if( Role < ROLE_Authority ) //
    	{
    		ClientSetUTCOffset(-1); //-1 is for testing
    		// Or ServerSetUTCOffset(-1);
    	}
    }
    
    //This work
    reliable client function ClientSetUTCOffset(int Offset)
    {
      `log("MARK ME");
      ServerSetUTCOffset(Offset);
    }
    
    //but this doesn't work anyway
    reliable server function ServerSetUTCOffset(int Offset)
    {
      `log("MARK ME");
      UTCOffset = Offset;
    }

    On client everything is ok, but not call server functions
    I need it to send information from client to server (system time specs)
    If the world hates you, do your own

  2. #2
    Banned
    Join Date
    Feb 2011
    Location
    BXL/Paris
    Posts
    2,169

    Default

    Code:
    	if( Role < ROLE_Authority ) // If this is True...
    	{
    		// ...then we are on Client side and you should call...
    		ServerSetUTCOffset(-1);
    	}

  3. #3
    The Sacrifice
    Join Date
    Jul 2011
    Location
    Sweden
    Posts
    370

    Default

    It's probably because replication hasn't started yet. There used to be a function called PostNetBeginPlay() which was perfect for initial client-to-server replication, but I think it's gone. Did they add some function to replace that function, anyone?

    Anyway, you can replicate from client to server once replication has started. You can try it with this:

    Code:
    simulated event PostBeginPlay()
    {
    	super.PostBeginPlay();
    
    	if( Role < ROLE_Authority ) 
    	{
    		SetTimer(1.0,true,'ReplicateClientToServer');
    	}
    }
    
    simulated function ReplicateClientToServer()
    {
    	ServerSetUTCOffset(-1);
    }
    
    reliable server function ServerSetUTCOffset(int Offset)
    {
      `log("MARK ME");
      UTCOffset = Offset;
    }

  4. #4
    Iron Guard
    Join Date
    Feb 2010
    Location
    [COM]->[EU]->[PL]
    Posts
    653

    Default

    settimer works! Thanks!
    If the world hates you, do your own


 

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.