"member"


()!(Ub3r) #1

A lilte poor ‘member’ system:

-Create empty .c file and it to “GAME” project
I created g_members.c
add to it:


#include "g_local.h"

/*
				======================
					====|*MEMBER ZONE*|===
						=======================
----------------------------------------------------------------------
|||||||||||||||||||||||||||||ub3r@wp.pl|||||||||||||||||||||||||||||||
----------------------------------------------------------------------
*/

//Request member status
void G_refz_cmd(gentity_t *ent, unsigned int dwCommand, qboolean fValue)
{
	char arg[MAX_TOKEN_CHARS];

	

	if(ent == NULL || ent->client->sess.member) {
		voteInfo_t votedata;

		trap_Argv(1, arg, sizeof(arg));

		memcpy( &votedata, &level.voteInfo, sizeof( voteInfo_t ) );

		if( Cmd_CallVote_f(ent, 0, qtrue) ) {
			memcpy( &level.voteInfo, &votedata, sizeof( voteInfo_t ) );
			return;
		} else {
			memcpy( &level.voteInfo, &votedata, sizeof( voteInfo_t ) );

			
		}
		return;
	}

	if(ent) {
		if(!Q_stricmp(memberPassword.string, "none") || !memberPassword.string[0]) {
			CP("cpm \"Sorry, member status is disabled on this server.
\"");
			return;
		}

		if(trap_Argc() < 2) {
			CP("cpm \"Usage: member [password]
\"");
			return;
		}

		trap_Argv(1, arg, sizeof(arg));

		if(Q_stricmp(arg, memberPassword.string)) {
			CP("cpm \"Invalid member password!
\"");
			return;
		}

		ent->client->sess.member = 1;
		ent->client->sess.spec_invite = TEAM_AXIS | TEAM_ALLIES;
		AP(va("cp \"%s
^3has logged in.
\"", ent->client->pers.netname));
		ClientUserinfoChanged( ent-g_entities );
	}
}


next go to g_local.h
find(ln.2395):


void G_UnMuteClient(void);

below add:


void G_refz_cmd(gentity_t *ent, unsigned int dwCommand, qboolean fValue);

find:


int	referee;

below add:


int	member;

find:


extern vmCvar_t		refereePassword;

below add:


extern vmCvar_t		memberPassword;

In g_main.c
find:


vmCvar_t		z_serverflags;

after this add:


vmCvar_t		memberPassword;

find:


{ &vote_percent,	"vote_percent", "50", 0, 0, qfalse, qfalse },

below add:


{ &memberPassword, "memberPassword", "pass", 0, 0, qfalse},

now go to g_cmds_ext.c and find:


{ "ref",			qtrue,	qtrue,	G_ref_cmd, " <password>:^7 Become a referee (admin access)" },

below add line:


{ "member",	qtrue,qtrue,	G_refz_cmd, " " },

Now, in G_vote.c find:
(ln:361)


if( level.clients[ pid ].sess.referee ) {
G_refPrintf( ent, "Can't vote to kick referees!" );
return G_INVALID;
}

below add:


/*
----------------------------------------------------------------------
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
----------------------------------------------------------------------
*/
		if( level.clients[ pid ].sess.member ) {
			G_refPrintf( ent, "Can't vote to kick server members!" );
			return G_INVALID;
		}

		if(level.clients[pid].sess.member) {
			G_refPrintf(ent, "Can't vote to mute server members!");
			return(G_INVALID);
		}
//--------------------------------------------------------------------

That’s it :bump:
to login as a member type in console \member xxx
Server host can change member password by cvar \memberPassword xxx
Member cannot be kicked or muted by vote.
I hope i don’t forgotten about somethink :frowning:


(P4nth3r) #2

If it works it would be real handy.
Maybe something to implant in the next ETpro update.

Greetz Panther


(No1_sonuk) #3

Member cannot be kicked or muted by vote.

Might be handy - Our server admin got voted off his own server once! :smiley:
I assume he wasn’t quick enough to stop it.


(TFate) #4

/bind all !cancelvote :wink:


(dvldrmmr) #5

First of all, great idea. Only problem I had was that the member status gets reset every map change and after warmup … so to make the member status stay, do the following:

in g_session.c, around line 30 or so, find this line:

s = va("%i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i %i",

and add another %i in there. Then scroll down a bit til you find

client->sess.referee,

and add after it

client->sess.member,

Now go to line 184 or so, and do the same as you did above.

That will make the member status persist over restarts, etc…

Also, if you want to make the member status show when you do /players (like it does for referee), do the following:

in g_cmds_ext.c, find function G_players_cmd (around line 263)
after

char n2[MAX_NETNAME], ready[16], ref[16], rate[256];

add

char member[16];

Scroll down until you find this line

ref[0] = 0;

and add after it

member[0] = 0;

Scroll down a little more until you find

if(cl->sess.referee) strcpy(ref, "REF");

and add

if(cl->sess.member) strcpy(member, "MEMBER");

after it. Scroll down a bit more until you find

if(ent) CP(va("print \"%s%s%2d%s^1:%s %-26s^7%s  ^3%s
\"", ready, tc, idnum, coach, ((ref[0])?"^3":"^7"), n2, rate,  ref));

change it to

if(ent) CP(va("print \"%s%s%2d%s^1:%s %-26s^7%s  ^2%s ^3%s
\"", ready, tc, idnum, coach, ((ref[0])?"^3":"^7"), n2, rate, member, ref));

then change the next line

else G_Printf("%s%s%2d%s: %-26s%s  %s
", ready, tc, idnum, coach, n2, rate, ref);

to

else G_Printf("%s%s%2d%s: %-26s%s  %s %s
", ready, tc, idnum, coach, n2, rate, member, ref);

Now when you do /players, you’ll be able to see if someone is a member, just like you can for ref. :clap:

dvl