Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

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

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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)

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

    Comment


    • #3
      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;
      }

      Comment


      • #4
        settimer works! Thanks!

        Comment

        Working...
        X