Jump to content

Home

HARDCODE help please


MasterSidious

Recommended Posts

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...