AutoLogin script
Posted: Wed Dec 19, 2018 5:25 pm
After a few horrible days of someone smurfing everyone, voting to kick, and all that other nonsense, I registered my username. Of course, that meant I had to login every time I joined the server. So I reached out to Perrinoia for some help. He sent me some ideas and I set out to create a script to log me in when I joined the OZ server.
Here's the result:
The script works great and now I don't have to worry about getting kicked before my old slow fingers get the password typed. That is, of course, if I actually remember to log in. I don't know if the backup server has the login code but if it does, just copy the $password line to a new line below that one and replace the IP address (replacing periods with underscores).
Most of you have been around long enough to understand how to add a script so I won't go into details. Just use a plain text editor to create a file in your config folder named something like autologin.cs. Add the above code replacing yourPassword with your registered password and save the file. Then at the bottom of autoexec.cs, add a new line with the following command: exec("autologin.cs");
P.S. Thanks for the jump start Perrinoia!
Enjoy
Here's the result:
Code: Select all
$password["208_100_45_12"] = "yourPassword";
function remoteSetMusic(%player, %track, %mode)
{
if($password[var($Server::Address)] != "") {
say(0, "#login "@ $password[var($Server::Address)]);
}
}
function String::Replace(%string, %search, %replace){
%len = String::Len(%search);
for (%i = 0; (%char = String::getSubStr(%string, %i, %len)) != ""; %i++) {
if (%char @ "s" == %search @ "s")
%string = String::getSubStr(%string, 0, %i) @ %replace @ String::getSubStr(%string, %i + %len, 255);
}
return %string;
}
function var(%this)
{
%v = String::Replace(%this, ":", " ");
%v = String::Replace(%v, ".", "_");
return getWord(%v, 1);
}
Most of you have been around long enough to understand how to add a script so I won't go into details. Just use a plain text editor to create a file in your config folder named something like autologin.cs. Add the above code replacing yourPassword with your registered password and save the file. Then at the bottom of autoexec.cs, add a new line with the following command: exec("autologin.cs");
P.S. Thanks for the jump start Perrinoia!
Enjoy