## ETPub PCR alpha hacks (etpub_pcr_ah) ## (C) 2006-2007 PatheticCockroach.com ## This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License ## Derivative works may only be done if they are distributed with their source code. ## ## The original etpub_pcr_ah source and binaries can be found around http://www.patheticcockroach.com/etserver/etpub_pcr.php ## ## Note : ETPub PCR alpha hacks are just small modifications for ETPub (http://www.etpub.org) Ok, this !finger/!userinfo is a bit confusing... so I think the best solution is to make !finger a disambiguation function. |***** ETPub ******|***** etpub_pcr_ah ****|****** No Quarter *****|***** meaning ********| | !finger | !test | --- | show admin level | | !userinfo | !userinfo | !finger | show IP, GUID, etc | | --- | !finger | --- | disambiguation | |******************|***********************|***********************|**********************| !finger : FLAG : f g_tyranny : no USAGE : !finger DESCRIPTION : tell the user to use either !test or !userinfo !test : FLAG : f (like !finger) g_tyranny : no USAGE : !test (NAME|SLOT) DESCRIPTION : Echoes the adminlevel of target to everyone. ------------------------- MODIFICATION STARTS HERE src\game\g_shrubbot.c (line 122) **** AFTER {"swap", G_shrubbot_swap, 'w', 0, "swap the teams", ""}, **** ADD {"test", G_shrubbot_test, 'w', 0, "display the admin level of a user", "[^3name|slot#^7]"}, (line 3400) **** BEFORE /* * This function facilitates the SP define. SP() is similar to CP except that * it prints the message to the server console if ent is not defined. */ **** ADD qboolean G_shrubbot_test(gentity_t *ent, int skiparg) { int i, l = 0; char *lname = NULL; int pids[MAX_CLIENTS]; char name[MAX_NAME_LENGTH], err[MAX_STRING_CHARS]; gentity_t *vic; if(Q_SayArgc() < 2+skiparg) { SPC("^/test usage: ^7!test [name|slot#]"); return qfalse; } Q_SayArgv(1+skiparg, name, sizeof(name)); if(ClientNumbersFromString(name, pids) != 1) { G_MatchOnePlayer(pids, err, sizeof(err)); SPC(va("^/test: ^7%s", err)); return qfalse; } vic = &g_entities[pids[0]]; // Dens: if someone is incog, feel free to show level 0 if(!_shrubbot_admin_higher(ent, vic) && !G_shrubbot_permission(vic, SBF_INCOGNITO)) { SPC("^/test: ^7sorry, but your intended victim has a higher admin" " level than you do"); return qfalse; } if(_shrubbot_immutable(ent, vic)) { SPC("^/test: ^7sorry, but your intended victim is immune to shrubbot commands"); return qfalse; } // Get the level number for(i=0; g_shrubbot_admins[i]; i++) { if(!Q_stricmp(g_shrubbot_admins[i]->guid, vic->client->sess.guid)) { if(G_shrubbot_permission(vic, SBF_INCOGNITO)) { break; } l = g_shrubbot_admins[i]->level; break; } } // Get the label for the level number for(i=0; g_shrubbot_levels[i]; i++) { if (g_shrubbot_levels[i]->level == l) { lname = g_shrubbot_levels[i]->name; break; } } AP(va("chat \"^/test: ^7%s^7 is a level %d user %s%s^7%s\" -1", vic->client->pers.netname, l, (lname) ? "(" : "", (lname) ? lname : "", (lname) ? ")" : "")); return qtrue; } src\game\g_shrubbot.h : (line 113) **** AFTER qboolean G_shrubbot_swap(gentity_t *ent, int skiparg); **** ADD qboolean G_shrubbot_test(gentity_t *ent, int skiparg); src\game\g_shrubbot.c (line 42) **** REPLACE {"finger", G_shrubbot_finger, 'f', 0, "display the admin level of a user", "[^3name|slot#^7]"}, **** WITH {"finger", G_shrubbot_finger, 'f', 0, "disambiguation", ""}, (line 2269) **** REPLACE qboolean G_shrubbot_finger(gentity_t *ent, int skiparg) { [...] } **** WITH qboolean G_shrubbot_finger(gentity_t *ent, int skiparg) { SPC("^/finger: ^7did you mean ^d!test^7 or ^d!userinfo^7 ?"); return qtrue; }