nvm, bugged code.
Printable View
nvm, bugged code.
Sorry to bump this old thread
How does this work exactly? I find it hard to understand with the commands behind it.Code:player setClientCvar( "autologin" , "openscriptmenu login Serthy|unsafepass" ); //load this to script
player setClientCvar( "username" , "Serthy" ); //showed on login menu
player setClientCvar( "password" , "unsafepass" ); //showed on login menu
player setClientCvar( "autoexec" , "vstr autologin" ); //autoexec executes on connect
player execClientCommand( "writeconfig save.cfg" ); //save the config clientside
sets a variable (could be any name of your choice), which opens a menu called loginCode:player setClientCvar( "autologin" , "openscriptmenu login Jane Doe|pw1234" );
and passes username|password which can be caught in script via player waittill( "menuresponse" , menu , response );
and parsed afterwards
those variables (name of your choice) have a dummy variable at first,Code:player setClientCvar( "username" , "Jane Doe" );
player setClientCvar( "password" , "pw1234" );
but those will be reset after you parsed the menuresponse from above
those also will be displayed in your login-menu
and are also placeholders to save the username + password in a config later
autoexec is a special command in CoD2 (maybe also later and earlier CoD's)Code:player setClientCvar( "autoexec" , "vstr autologin" );
when a player connects to a server, this command will automatically be executed (hence the name)
so it calls vstr cvarname:
vstr transforms a string which is in cvarname into a config-command
and therefore will execute what is stored in autoexec, which is the menuresponse
and therefore the menuresponse is triggered in the frame the player connects to the server
You have to parse the menuresponse and save its data on the server (libcod, files)
after your player is logged in or registered, you have to set
what will later be saved in the autologin-cvar
(im not 100% sure about this part anylonger)Code:player setClientCvar( "autologin" , "openscriptmenu " + player.username + "|" + player.password );
// maybe not needed, shuld already be set via menu, but it doesnt hurt to set them again
player setClientCvar( "username" , player.username );
player setClientCvar( "password" , player.password );
Then you save/create/orverride a new config, which is stored on the clients pc (not the server),Code:player execClientCommand( "writeconfig save.cfg" );
when a client connects to the server, you have to let him execute the safe.cfg
either from within your login menu ( onOpen { exec safe.cfg } ) or via the well known execClientCommand() workaround
so the next time he connects, the autologin is set, and does its job on connect
if the player deletes this safe.cfg for some reason (reinstall, removed manual),
he has to manually type in its username/password again
so this is somewhat like cookies in a browser..
This is all I remember for now..
So this is what happens when a new user registers:
- connects to the server
- doesn't yet have a autoexec command in its config, nothing gets called
- you let the player execute his safe.cfg, which does not yet exists, nothing happens
- player registers himself, you safe the input on the server
- you set the autologin-cvar accordingly
- you create the safe.cfg
Now if the player connects again on the server:
- the autoexec variable is set and gets called
- it fires the vstr command that calls the openscriptmenu one
- now you get a menuresponse and can grab the login information and parse it
- login the player automatically
- (excute the safe.cfg, so autologin gets set if not already)
Thanks!!
But you cant use it to save some player variable and load it?
For example:cant be saved and loaded via this method?Code:self.admin = 1
Yeah it was just an example. But how can this be achieved?
Attachment 939
The fuck you mean?