Jump to content

Home

Cvar madness


Dom_152

Recommended Posts

Posted

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?

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

just set the flags to 0 theres no need for internal, it just makes it so you can't tab auto complete, and you really shouldn't archive the pw.

 

showing some code how your getting those files would be nice to see for help.

Posted

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.

Posted

I'll remove those flags as soon as I get my computer back then. And what exactly is wrong with using seta in non jampconfig.cfg files?

Posted

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.

  • 2 weeks later...
Posted

I've set the CVar flags to 0 and it's still not working. Garr this is annoying. It's only this and reading files that are stopping me from completeting my Mod.

Posted

like i said b4, show some of the code where its being used, and how your cvar line looks.

 

Also, are you sure its not set to 0 in jampconfig thats overwriting your default?

Posted

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...

Posted

why is there a space in the cvar names?

 

"mpx_admin1Allow " -> "mpx_admin1Allow"

 

probably not the problem but try it, make sure to delete those from jampconfig also.

Posted

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.

Posted

Those entries in jampconfig are old and overriding your new values. I'd try removing them like ensiform suggested.

 

Also, how are you setting the sess.admin?

Posted

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!

Archived

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

×
×
  • Create New...