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?
Yeah but i dont see/understand how the value is readed from the cfg file that is located on the players pc. I dont care if they can read the cfg and change the values. Most players arent that smart
Anyone please?
It's all in the code in the thread that i posted
Yeah thats obvious, but not for me. Because you are making some security script, I seriously cant see where you "convert" the value of the cfg on the players pc to a player.variable.
I'm not converting. I'm using it to log the player into the server and the server then retrieves the player's actual data from a database.
This is way more secure than just storing the g_my_admin_level_is=100 cvar on the client's pc because it just takes a single player to take a look inside the .cfg to crack your security.
Yes but thats what i need. I dont care about security. I want to mute a player by setting self.mute=1 . if i put it in a database, based on IP a simple ip change will undo this. Storing this variable on the players pc doesnt rely on IP. And they are not smart enough to check their config