Hi,
My case is:
1. Client send SpectatorToPlayerRequest
2. Server handle SFSEvent.SPECTATOR_TO_PLAYER and check user money. If user not enough money, I throw exception: throw new SFSUserException("You don't have enough money to play game.");
3. Client don't receive SFSEvent.SPECTATOR_TO_PLAYER_ERROR. Client only receive SFSEvent.SPECTATOR_TO_PLAYER.
How can I custom this event for this case?
Thank you.
How to server check player money in SFSEvent.SPECTATOR_TO_PLAYER?
Re: How to server check player money in SFSEvent.SPECTATOR_TO_PLAYER?
HI,
you need a different strategy for this operation.
The SFSEvent.SPECTATOR_TO_PLAYER is generated when the operation is already finished, so it is too late to send an error to the User. You need to run your money check before the server and send a custom error if the player is not allowed to become a player.
To do this I would suggest these steps:
1- client call custom extension command
2- Extension checks the player's money and either sends a custom error or proceeds by calling SFSApi.spectatorToPlayer(...), this in turn will send the SPECTATOR_TO_PLAYER to the user.
Hope it helps
you need a different strategy for this operation.
The SFSEvent.SPECTATOR_TO_PLAYER is generated when the operation is already finished, so it is too late to send an error to the User. You need to run your money check before the server and send a custom error if the player is not allowed to become a player.
To do this I would suggest these steps:
1- client call custom extension command
2- Extension checks the player's money and either sends a custom error or proceeds by calling SFSApi.spectatorToPlayer(...), this in turn will send the SPECTATOR_TO_PLAYER to the user.
Hope it helps
Who is online
Users browsing this forum: No registered users and 68 guests