The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Yona-TYT on June 03, 2017, 04:16:49 PM

Title: [Online] Is the player authenticated?
Post by: Yona-TYT on June 03, 2017, 04:16:49 PM

In online games I need to know if the player is authorized (enter password) to prevent other players from using their function.

It would be nice something like: "player_x(pl).is_unlocked()"
Title: Re: [Online] Is the player authenticated?
Post by: DrSuperGood on June 03, 2017, 10:28:32 PM
Not that easy to implement as only the server truly knows that and can be trusted. One would need to sync the results with all clients before permitting the script to execute any further.
Title: Re: [Online] Is the player authenticated?
Post by: Yona-TYT on June 03, 2017, 10:58:17 PM

I need this to be able to advance in the divided regions scenario.  :-[
Otherwise it would be useless, since the players have free access to the functions that I want to create.
Title: Re: [Online] Is the player authenticated?
Post by: Dwachs on June 12, 2017, 06:15:48 AM
@DrSuperGood: Scenarios only run on the server, so there is a chance to get this working.
Quote from: Yona-TYT on June 03, 2017, 04:16:49 PM
In online games I need to know if the player is authorized (enter password) to prevent other players from using their function.
@Yona: Can you please be more specific with respect to 'their function' ? What do you want to achieve?

Running scripts from clicks in scenario info window does not work currently for clients in network mode. It only works on the server itself.

In order to make it work in network mode, there should be some safety net in order to decide whether a script call is legitimate. Otherwise a modified client could sent arbitrary requests to spoil the scenario.
Title: Re: [Online] Is the player authenticated?
Post by: Yona-TYT on June 13, 2017, 11:46:46 AM
Quote from: Dwachs on June 12, 2017, 06:15:48 AM
Running scripts from clicks in scenario info window does not work currently for clients in network mode. It only works on the server itself.
I suppose that is the problem, maybe some kind of interaction is needed that shows the window to enter the password.
Title: Re: [Online] Is the player authenticated?
Post by: Yona-TYT on June 15, 2017, 01:33:39 AM
Quote from: Dwachs on June 12, 2017, 06:15:48 AM
@Yona: Can you please be more specific with respect to 'their function' ? What do you want to achieve?

Running scripts from clicks in scenario info window does not work currently for clients in network mode. It only works on the server itself.

In order to make it work in network mode, there should be some safety net in order to decide whether a script call is legitimate. Otherwise a modified client could sent arbitrary requests to spoil the scenario.
I was hoping this would work. :-[

(http://files.simutrans.com/index.php/apps/files_sharing/ajax/publicpreview.php?x=1440&y=372&a=true&file=shared_region.png&t=zTsSp4mv0RL4uJV&scalingup=0)