Results 1 to 4 of 4

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

  1. #1
    SeBeQ
    Guest

    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. #2
    VendorX
    Guest
    Code:
    	if( Role < ROLE_Authority ) // If this is True...
    	{
    		// ...then we are on Client side and you should call...
    		ServerSetUTCOffset(-1);
    	}

  3. #3
    evr
    Guest
    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
    SeBeQ
    Guest
    settimer works! Thanks!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •