Jump to content

Home

Cvar madness


Dom_152

Recommended Posts

Right I have 3 Cvars that govern what commands Admins can and can't use. but for some reason in my function that checks their admin status etc. The values in the Cvars are always 0 meaning the Admins can't do anything. I don't know why it is doing this. I am setting them correctly in the Server Config. Any ideas as to what might be the cause?

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

CVAR_ARCHIVE, means store in jampconfig.cfg and/or jampserver.cfg depending if your using jamp or jampDed. i know what they are and 'server.cfg' is just a random config that isnt used by the game at all other than you calling +exec server.cfg and i hate when people use seta in non jampconfig.cfg files.

Link to comment
Share on other sites

too many cvars. nor is it needed when u use seta it makes a copy in jampconfig and then its always set to that until another seta is hit with same cvar, set will override it but not forever on quit it will override it again. also if you overflow than among other configs, you will be getting the Recursive Error: MAX_CVARS notice all the time and wont be able to run :). i see a bunch of fools running JA+ and their whole server.cfg's are seta seta seta seta seta seta seta seta seta ... there's no need. slider mentioned a while back that his mod runs best with seta well, then thats kind of his fault for poor coding but yeah. because most other q3 engine games even i recommend using set instead of seta where you can.

Link to comment
Share on other sites

  • 2 weeks later...

In Jampconfig the Cvars are being shown as "NULL"

 

Here is the offending code:

 

qboolean G_CheckAdmin(gentity_t *ent, int command)
{
int Bitvalues = 0;

/*if(!ent->client->sess.admin == ADMIN_NO_ADMIN)
{
	return qtrue;
}
else
{
	return qfalse;
}*/

//New as of 14th June 2006
//Check if the person is even logged into an admin state

CmdEnt(ent-g_entities, va("print \"Admin1: %i\nAdmin2: %i\nAdmin3: %i\n\"", mpx_admin1Allow.integer, mpx_admin2Allow.integer, mpx_admin3Allow.integer));

if(ent->client->sess.admin == ADMIN_NO_ADMIN)
{
	return qfalse;
}

//Right they are admin so lets check what sort so we can assign bitvalues
if(ent->client->sess.admin == ADMIN_1)
{
	Bitvalues = mpx_admin1Allow.integer;
}
if(ent->client->sess.admin == ADMIN_2)
{
	Bitvalues = mpx_admin2Allow.integer;
}
if(ent->client->sess.admin == ADMIN_3)
{
	Bitvalues = mpx_admin3Allow.integer;
}
if(ent->client->sess.admin == ADMIN_MOD)
{
	Bitvalues = MOD_CMDS;
}	

//If the Bitvalues 0 then return false cos no commands can be allowed if it's 0
if(Bitvalues == 0)
{
	return qfalse;
}

//Got the Bitvalues so lets check if the command given is included in the Bitvalue
if(Bitvalues & command)
{
	return qtrue; //Command is allowed so return true
}
else
{
	return qfalse;
}

}

 

And the Cvar definition:

{ &mpx_admin1Allow, "mpx_admin1Allow ", "0", 0 , 0, qfalse  },
{ &mpx_admin2Allow, "mpx_admin2Allow ", "0", 0 , 0, qfalse  },
{ &mpx_admin3Allow, "mpx_admin3Allow ", "0", 0 , 0, qfalse  },

 

As you can see there the Cvar is called mpx_admin1Allow... but in jampconfig it says mpx_admin1Allowed "NULL"... Odd...

Link to comment
Share on other sites

I'll try it.

 

Well it worked because it now shows the right values that I set in the server.cfg. But it's not affecting the commands I can use... I can't seem to use any at all.

 

EDIT: Scratch that, thats because of another function I had disabled for something earlier.

Link to comment
Share on other sites

I'm adding it into the session struct and editing g_session accordingly.

It's finally wokring! All because of a typo lol. Thanks for all your help. Now I've jsut gotta learn how to read multi line files properly and I'm done!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...