nwnxee / unified

Binaries available under the Releases tab on Github
https://nwnxee.github.io/unified
GNU General Public License v3.0
131 stars 92 forks source link

Feature request: expose cdkey check to nwscript #322

Closed hendrikgit closed 5 years ago

hendrikgit commented 5 years ago

Expose the event when a player connects to the server to nwscript. The script should get the cdkey and playername and be able to return whether to accept the player or not. The call to the script should happen before it is possible to see contents of a servervault.

This would allow PWs to make custom checks against a database and make it for example easier to administrate players with 2 or more cdkeys and set to what playernames they may connect.

nwnx_tweak could be the plugin to add this to, if I read the discusion on discord correctly.

mtijanic commented 5 years ago

Best place to hook this in would be CNWSMessage::SendServerToPlayerCharList (not really, but best place nwnx can easily access). If the script validation fails, should disconnect the player with something like

Globals::AppManager()->m_pServerExoApp->GetNetLayer()->DisconnectPlayer(playerId, some_strref, 1, "");