PDA

View Full Version : HARDCODE help please


MasterSidious
01-30-2004, 02:50 AM
How do I create a boolean command that returns true if they are an admin( they enter the correct password) or false (they don't enter the correct password)?
The cmd will be in the format of /amlogin <password>

A nice example of this would be good casue I'm kind of a noobie :)

Thanks in advance.

MasterSidious
01-30-2004, 02:54 AM
Someone please give me of an example of a declared array with the password as the second parameter. The command is always the "0" parameter, so the pass would be "1". The password is stored in the array and when the command is entered by the user it looks for the other parameter "the password".

Thanks :)

MasterSidious
01-30-2004, 03:30 AM
I'm so newbie, this is what I came up with so far:
void Cmd_amlogin_f (gentity_t *ent) // amlogin cmd
{
char *msg;
qboolean AdminPass( gentity_t *ent ) {
if ( !ad_adminpass.integer ) { // ad_adminpassword is the set password variable
msg = "^3Wrong ^1Password!\n";
am_pass = qfalse; // not an admin
}
else
{
msg = "^1You are now ^3logged in.\n";
am_pass = qtrue; // it was the right password so you're an admin
}



// Tell them they are logged in.
if(am_pass)
trap_SendServerCommand( ent-g_entities, va("print \"%s\"", msg)); // tell them
}
}

How would I even go about making something like this work? Any help would be GREATLY appreciated here guys :D