Jump to content

Registration form in ingame browser


dam034

Recommended Posts

Dear users,

I want to let the users to sign-up and sign-in the game when connected to my server.

For some reasons (PHP scripts and third-parties API) I can't use simple GUI elements, but a webpage hosted on a LAMP server.

Now, I know I need permissions by the player to access that webpage, via requestBrowserDomains function, and I'll say to the players they need to allow those domains to play.

 

I want to load a simple browser when the player joins the game, and to do these steps:

  • load a simple page hosted in the resource which informs the user he needs to allow some domains to play;
  • ask the permission for those domains;
  • load the page hosted externally to sign-in or sign-up;
  • let the user to login to my server in that page;
  • read the result from that script (in JSON) and parse it in a function to login the user in the game;
  • close the browser and spawn the player assigning some properties (e.g. money amount, particular skin, etc...).

 

I read some function documentations and I wrote this clientside code:

window = guiCreateWindow( 0.2, 0.2, 0.6, 0.6, "Titolo", true )

dimx, dimy = guiGetSize(window, false)

browser = guiCreateBrowser( 0, 28, dimx, dimy, false, false, false, window )
theBrowser = guiGetBrowser( browser )

requestBrowserDomains({'192.168.1.16'})

guiWindowSetMovable ( window, false )
	showCursor ( true )


addEventHandler( "onClientBrowserCreated", theBrowser, 
	function( )
		loadBrowserURL( source, "http://192.168.1.16/" )
	end
)

addEventHandler('onClientBrowserWhitelistChange', root, function(lista)
outputChatBox(table.getn(lista))
loadBrowserURL( source, "http://192.168.1.16/" )

end
)

I'm executing this code to resource start for test, and 192.168.1.16 is the LAN server IP for test, I'll change it in production mode.

When the resource starts, the window opens, and asks me for the permission, but when I grant it, does nothing.

 

How can I solve and begin this new login resource?

 

Thanks

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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