Forums Index >> Modding >> Lock server In-Game dash Code?



Page : <1> :


Hey guys, I had "borrowed" a peice of Ben's admin stuff, he's running version 0.3 admin, while I'm running 0.5, I would like to know how I can get this code to work on 0.5 so I can gather people and then lock the server for league games.

 

                                        
function LockServer(%sender,%msg)
{
if(!ClientIsAdmin(%sender,"Server Lock command failed only I can do this:::DON'T ASK!! THE ANSWER IS NO!!!!!"))
return;
%newpass = firstword(%msg);
if ($Pref::Server::PasswordEnabled $= 0)
{
if (%newpass $= " ")
{
%a1 = "Server Responce: ";
%a2 = "Server: No Password Specified";
chatMessageClient(%sender, %sender, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10);
}
else
{
$Pref::Server::PasswordEnabled = 1;
$pref::Server::SavePassword = %newpass;
$Pref::Server::Password = %newpass;

messageall(2,"The Server Has Been Locked");
echo("---SERVER LOCKED BY " @ %sender.namebase @ "!! ---");
echo("Password is " @ %newpass @ "!");
}
}
else
{
$Pref::Server::PasswordEnabled = 0;
$Pref::Server::Password = "";
messageall(2,"The Server Has Been Unlocked");
echo("---SERVER UNLOCKED BY " @ %sender.namebase @ "!! ---");
}
}

 

I would also like to be able to type "/lock *password here*" and set my own pass. Thanks folks.

Tuesday, June 14, 2005 at 8:44:14 AM

Racer, look in the prefs file. You can paste much of what's in the prefs file to change the settings. For example you can lock the console by addeing this to the terminal or dos window.

$Pref::Server::Password = "lemon";

The game will be password protected with the word lemon

$Pref::Server::Password = "";

Unlocks the game

$Pref::Server::Name = "Nap's ModWiz Server";
Will cahnge the server name to Nap's ModWiz Server

Number of players in server. (Be careful, if I used this more that once it would crash my game)
$Pref::Server::MaxPlayers = 15;

Hope this helps!

 

Tuesday, June 14, 2005 at 10:00:45 AM

From my admin script:

 

                                        
function unlock()
{
$Pref::Server::Password = "";
messageall(10,"The server was unlocked",10);
}

 

 

                                        
function lock(%msg)
{
$Pref::Server::Password = %msg;
messageall(10,"The server was locked",10);
}

 

Just add the if(isAdmin) thingie and put the code in the CodeAction function :)

Less complicated than Ben's, and proves that CL is wrong, I TRY to make everything as simple as possible, but also try to make it work as best as possible :)

@Napalm
The max players thing DOES NOT crash the game (on windows) so your using an older TT as I am, or your Mac doesnt work like it should :)


Last edited: Tuesday, June 14, 2005 at 12:03:15 PM

Tuesday, June 14, 2005 at 12:00:27 PM

Thanks all.

Like this in codeAction?

 

                                        
else if (%code $= "/lock")
call("lockserver",%sender,%msg);
else if (%code $= "/unlock")
call("unlockserver",%sender,%msg);

 

Got it.

 

Last edited: Tuesday, June 14, 2005 at 4:27:34 PM

Tuesday, June 14, 2005 at 4:15:10 PM

No, like this:

 

                                        
else if (%code $= "/lock")
call("lock",%msg);
else if (%code $= "/unlock")
call("unlock");

 

(for my codes)

Remember to add admin protection!


Last edited: Wednesday, June 15, 2005 at 9:52:47 AM

Wednesday, June 15, 2005 at 9:52:18 AM

Does the functions unlock and lock go right before the codeAction? An how do you add admin protection so only admins can do this?

Wednesday, June 15, 2005 at 4:07:13 PM

It's typed in the dos or terminal on the server. Not in the chat window.

 

Thursday, June 16, 2005 at 6:52:30 AM

^ He's talking about the dash code lock and unlock codes on this thread.

Add this:

 

                                        
function unlock()
{
if(!ClientIsAdmin(%sender,"Server Lock command failed only I can do this"))
$Pref::Server::Password = "";
messageall(10,"The server was unlocked",10);
}
Function lock(%msg)
{
if(!ClientIsAdmin(%sender,"Server Lock command failed only I can do this"))
Return;
$Pref::Server::Password = %msg;
messageall(10,"The server was locked",10);
}

 

And add this in with the rest in codeAction:

 

                                        
else if (%code $= "/lock")
call("lock",%msg);
else if (%code $= "/unlock")
call("unlock");

 

 

Last edited: Thursday, June 16, 2005 at 8:02:05 AM

Thursday, June 16, 2005 at 8:00:58 AM

Yea, you forgot the return on the unlock one tough...

If(!ClientIsAdmin(%sender,"Server Lock command failed only I can do this"))
return;


Thursday, June 16, 2005 at 10:31:14 AM

Page : <1> :

insert quote insert url insert email insert image bold italic underline superscript subscript horizontal rule : : Help on using forum codes

Add comment:

HTML is disabled within comments, but ZBB Code is enabled.

Back to the top

Web site designed, maintained and funded by -z- and Dan MacDonald