Jump to content

FBInstant.context Clearing Player


o0Corps0o
 Share

Recommended Posts

Hiya,

I've made a 1v1 game but I would like it so that when a player has taken a turn, instead of quiting out of the game, I would like it to return to the main menu so they have the option of choosing to play someone else.  Is there a way of clearing the context, or changing it so that the opponent doesn't keep getting picked up?  Can I just use switchAsync('') or context.createAsync('') and apply a blank value?

I tried FBInstant.endGameAsync() but i think this is old and doesn't work any more... Do I have to initialise the game everytime?

 

*Never mind, i've just rewrote my Main Menu code.. but would still be good to know if you can clean out an async*

Link to comment
Share on other sites

Great answer :) this is what i was looking for.. i just wasn't sure how to access it.. (ie. blanks values etc).. I will give it a shot today! Thanks!

I've tried to add this in to the game to try get it back to SOLO context.. but when i try this i get an error:

"INVALID_PARAM, At least one player id besides the current player'smust be provided. "
I will try switchAsync... *Nope same kind of error "Invalid context id for player"

Link to comment
Share on other sites

In the end I didn't change the context.. I just made a work around, so if it errored with the same context, i just wouldn't change it and go back to the game. (Or send it somewhere else if need be, but this would be all done in the 'catch' part if a new context couldn't be created for whatever reason).

Hope that helps..

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...