void KickThink () { if( !self->k_kicking ) return; if ( self->k_kicking + 60 < g_globalvars.time ) { // Check the 1 minute timeout for kick mode G_sprint( self, 2, "Your %s mode has timed out\n", redtext("kick")); ExitKick( self ); return; } if ( !is_adm( self ) ) { ExitKick( self ); // not admin now, so cancel kick mode, just for sanity return; } }
void NextClient () { int from = 0; if( !self->k_kicking ) return; self->k_playertokick = (self->k_playertokick ? self->k_playertokick : world); from = ( self->k_playertokick != world && self->k_playertokick->ct == ctSpec ); self->k_playertokick = find_plrspc(self->k_playertokick, &from); if ( !self->k_playertokick ) { // try find anyone at least from = 0; self->k_playertokick = find_plrspc(world, &from); } if ( !self->k_playertokick ) { G_sprint(self, 2, "Can't find anybody to kick\n"); ExitKick ( self ); return; } G_sprint(self, 2, "Kick %s %s?\n", redtext(self->k_playertokick->ct == ctPlayer ? "player" : "spectator"), getname(self->k_playertokick)); }
//////////////// // GlobalParams: // self /////////////// void SpectatorDisconnect() { gedict_t *p; if ( self->k_accepted ) { for ( p = world; (p = ( match_in_progress == 2 && !cvar("k_ann") ) ? find_spc( p ) : find_client( p )); ) G_sprint( p, PRINT_HIGH, "Spectator %s left the game\n", self->s.v.netname ); } // s: added conditional function call here if( self->v.elect_type != etNone ) { if ( match_in_progress != 2 ) G_bprint(2, "Election aborted\n"); AbortElect(); } if ( self->wizard ) { ent_remove( self->wizard ); self->wizard = NULL; } if( self->k_kicking ) ExitKick( self ); self->s.v.classname = ""; // Cenobite, so we clear out any specs as they leave self->k_accepted = 0; self->ct = ctNone; }
void AdminKick () { int argc = trap_CmdArgc(); if( !is_adm( self ) ) { G_sprint(self, 2, "You are not an admin\n"); return; } if( self->k_kicking ) { ExitKick( self ); return; } if ( argc >= 2 ) { gedict_t *p; char arg_2[1024], *str; trap_CmdArgv( 1, arg_2, sizeof( arg_2 ) ); if ( !(p = SpecPlayer_by_IDorName( arg_2 )) && !(p = not_connected_by_IDorName( arg_2 )) ) { G_sprint(self, 2, "kick: client %s not found\n", arg_2); return; } if ( DoKick( p, self ) && !strnull( str = params_str(2, -1) ) ) // show reason G_bprint(2, "\x90%s\x91\n", str); return; } G_sprint(self, 2, "Kicking process started\n" "�����������������������\n" "Type \371 to kick, \356 for next, %s to leave\n", redtext("kick")); self->k_kicking = g_globalvars.time; self->k_playertokick = world; NextClient(); }
void ReqAdmin () { // check for election if( is_elected(self, etAdmin) ) { G_sprint(self, 2, "Abort %sion first\n", redtext("elect")); return; } if( is_adm( self ) ) { G_bprint(2, "%s is no longer an %s\n", self->netname, redtext("admin")); if( self->k_kicking ) ExitKick( self ); self->k_admin = 0; // ok, remove all admin flags on_unadmin( self ); return; } if( self->k_adminc ) { G_sprint(self, 2, "%s code canceled\n", redtext("admin")); self->k_adminc = 0; return; } if( !cvar( "k_admins" ) ) { G_sprint(self, 2, "%s on this server!\n", redtext("NO admins")); return; } if ( VIP_IsFlags( self, VIP_ADMIN ) ) // this VIP does't required pass { BecomeAdmin(self, AF_REAL_ADMIN); return; } // parse /admin <pass> if ( trap_CmdArgc() == 2 ) { char arg_2[1024]; char *pass = cvar_string( "k_admincode" ); int till = Q_rint(self->k_adm_lasttime + 5 - g_globalvars.time); if( self->k_adm_lasttime && till > 0 ) { // probably must help against brute force G_sprint(self, 2, "Wait %d second%s!\n", till, count_s(till) ); return; } trap_CmdArgv( 1, arg_2, sizeof( arg_2 ) ); if ( !strnull(pass) && strneq(pass, "none") && streq(arg_2, pass) ) BecomeAdmin(self, AF_REAL_ADMIN); else { G_sprint(self, 2, "%s...\n", redtext("Access denied")); self->k_adm_lasttime = g_globalvars.time; } return; } self->k_adminc = 6; self->k_added = 0; // You can now use numbers to enter code G_sprint(self, 2, "Use %s or %s to enter code\n", redtext("numbers"), redtext("impulses") ); }