/* SV_Kick_f Kick a user off of the server */ static void SV_Kick_f (void) { client_t *cl; int argc = Cmd_Argc (); const char *reason; if (argc < 2) { SV_Printf ("usage: kick <name/userid>\n"); return; } if (!(cl = SV_Match_User (Cmd_Argv (1)))) return; // print directly, because the dropped client won't get the // SV_BroadcastPrintf message if (argc > 2) { reason = Cmd_Args (2); SV_BroadcastPrintf (PRINT_HIGH, "%s was kicked: %s\n", cl->name, reason); SV_ClientPrintf (1, cl, PRINT_HIGH, "You were kicked from the game: %s\n", reason); } else { SV_BroadcastPrintf (PRINT_HIGH, "%s was kicked\n", cl->name); SV_ClientPrintf (1, cl, PRINT_HIGH, "You were kicked from the game\n"); } SV_DropClient (cl); }
//qmb: snowboard void Host_Snowboard_f (void) { if (cmd_source == src_command) { Cmd_ForwardToServer (); return; } if (!allowcheats) { SV_ClientPrintf("No cheats allowed, use sv_cheats 1 and restart level to enable.\n"); return; } if (pr_global_struct->deathmatch && !host_client->privileged) return; if (sv_player->v.movetype != MOVETYPE_SNOWBOARD) { sv_player->v.movetype = MOVETYPE_SNOWBOARD; SV_ClientPrintf ("snowboard ON\n"); } else { sv_player->v.movetype = MOVETYPE_WALK; SV_ClientPrintf ("snowboard OFF\n"); } }
void Host_Noclip_f (void) { if (cmd_source == src_command) { Cmd_ForwardToServer (); return; } if (!allowcheats) { SV_ClientPrintf("No cheats allowed, use sv_cheats 1 and restart level to enable.\n"); return; } if (pr_global_struct->deathmatch && !host_client->privileged) return; if (sv_player->v.movetype != MOVETYPE_NOCLIP) { noclip_anglehack = true; sv_player->v.movetype = MOVETYPE_NOCLIP; SV_ClientPrintf ("noclip ON\n"); } else { noclip_anglehack = false; sv_player->v.movetype = MOVETYPE_WALK; SV_ClientPrintf ("noclip OFF\n"); } }
// 2000-04-30 NVS HANDSHAKE SRV<->CL/QC<->CL by Maddes void Host_NVS_Request_f (void) { float value; if (cmd_source == src_command) // this a client remote only command { Con_Printf("%s is not valid from the console\n", Cmd_Argv(0)); return; } if (Cmd_Argc() < 2) // not enough arguments { SV_ClientPrintf("%s: not enough arguments\n", Cmd_Argv(0)); SV_ClientPrintf("Syntax: %s <version>\n", Cmd_Argv(0)); return; } Con_DPrintf("Server received NVS client version %s from client %i\n", Cmd_Argv(1), NUM_FOR_EDICT(host_client->edict)); // 2001-12-24 Keeping full backwards compatibility by Maddes start if (sv_compatibility->value) // do not reply, like the original Quake executable { return; } // 2001-12-24 Keeping full backwards compatibility by Maddes end // get and check value value = Q_atof(Cmd_Argv(1)); if (value < 0) { SV_ClientPrintf ("Only positive NVS versions are accepted.\n"); return; } // determine and store client NVS versions host_client->nvs_cmax = value; host_client->nvs_cclc = (value < MAX_NVS_VERSION) ? value : MAX_NVS_VERSION; host_client->nvs_csvc = (value < nvs_current_ssvc->value) ? value : nvs_current_ssvc->value; // check client against required version if (NVS_RejectClient()) { return; } // tell client the NVS versions, only when necessary or when client changes during a running game // NECESSARY (GOOD) HACK: This is a special case were not the client's SVC is of importance if (host_client->nvs_cclc || nvs_current_ssvc->value || host_client->spawned) { MSG_WriteByte (&host_client->message, svc_extra_version); MSG_WriteByte (&host_client->message, VERSION_NVS); MSG_WriteFloat (&host_client->message, nvs_current_ssvc->value); MSG_WriteFloat (&host_client->message, host_client->nvs_csvc); MSG_WriteFloat (&host_client->message, host_client->nvs_cclc); Con_DPrintf("Server sends NVS versions SSVC %1.2f CSVC %1.2f CCLC %1.2f to client %i\n", nvs_current_ssvc->value, host_client->nvs_csvc, host_client->nvs_cclc, NUM_FOR_EDICT(host_client->edict)); } }
/* ================= SV_Msg_f Change the message level for a client ================= */ static void SV_Msg_f (void) { if (Cmd_Argc() != 2) { SV_ClientPrintf (host_client, PRINT_HIGH, "Current msg level is %i\n", host_client->messagelevel); return; } host_client->messagelevel = atoi(Cmd_Argv(1)); SV_ClientPrintf (host_client, PRINT_HIGH, "Msg level set to %i\n", host_client->messagelevel); }
static void SV_ConSay (const char *prefix, client_t *client) { char *p; dstring_t *text; int j; if (Cmd_Argc () < 2) return; p = Hunk_TempAlloc (strlen (Cmd_Args (1)) + 1); strcpy (p, Cmd_Args (1)); if (*p == '"') { p++; p[strlen (p) - 1] = 0; } text = dstring_new (); dstring_copystr (text, prefix); dstring_appendstr (text, "\x8d "); // arrow j = strlen (text->str); dstring_appendstr (text, p); SV_Printf ("%s\n", text->str); while (text->str[j]) text->str[j++] |= 0x80; // non-bold text if (client) { if (client->state >= cs_zombie) { SV_ClientPrintf (1, client, PRINT_CHAT, "\n"); // bell SV_ClientPrintf (1, client, PRINT_HIGH, "%s\n", text->str); SV_ClientPrintf (1, client, PRINT_CHAT, "%s", ""); // bell } } else { for (j = 0, client = svs.clients; j < MAX_CLIENTS; j++, client++) { if (client->state < cs_zombie) continue; SV_ClientPrintf (0, client, PRINT_HIGH, "%s\n", text->str); if (*prefix != 'I') // beep, except for Info says SV_ClientPrintf (0, client, PRINT_CHAT, "%s", ""); } if (sv.recorders) { sizebuf_t *dbuf; dbuf = SVR_WriteBegin (dem_all, 0, strlen (text->str) + 7); MSG_WriteByte (dbuf, svc_print); MSG_WriteByte (dbuf, PRINT_HIGH); MSG_WriteString (dbuf, va ("%s\n", text->str)); MSG_WriteByte (dbuf, svc_print); MSG_WriteByte (dbuf, PRINT_CHAT); MSG_WriteString (dbuf, ""); } } }
/* ================== Host_Noclip_f ================== */ void Host_Noclip_f (void) { if (cmd_source == src_command) { Cmd_ForwardToServer (); return; } if (pr_global_struct->deathmatch) return; //johnfitz -- allow user to explicitly set noclip to on or off switch (Cmd_Argc()) { case 1: if (sv_player->v.movetype != MOVETYPE_NOCLIP) { noclip_anglehack = true; sv_player->v.movetype = MOVETYPE_NOCLIP; SV_ClientPrintf ("noclip ON\n"); } else { noclip_anglehack = false; sv_player->v.movetype = MOVETYPE_WALK; SV_ClientPrintf ("noclip OFF\n"); } break; case 2: if (Q_atof(Cmd_Argv(1))) { noclip_anglehack = true; sv_player->v.movetype = MOVETYPE_NOCLIP; SV_ClientPrintf ("noclip ON\n"); } else { noclip_anglehack = false; sv_player->v.movetype = MOVETYPE_WALK; SV_ClientPrintf ("noclip OFF\n"); } break; default: Con_Printf("noclip [value] : toggle noclip mode. values: 0 = off, 1 = on\n"); break; } //johnfitz }
/* ================== SV_ConSay_f ================== */ void SV_ConSay_f(void) { client_t *client; int j; char *p; char text[1024]; if (Cmd_Argc () < 2) return; if(dmMode.value==DM_SIEGE) strcpy (text, "GOD SAYS: "); else strcpy (text, "ServerAdmin: "); p = Cmd_Args(); if (*p == '"') { p++; p[strlen(p)-1] = 0; } strcat(text, p); for (j = 0, client = svs.clients; j < MAX_CLIENTS; j++, client++) { if (client->state != cs_spawned) continue; SV_ClientPrintf(client, PRINT_CHAT, "%s\n", text); } }
/* ================== SV_Kick_f Kick a user off of the server ================== */ void SV_Kick_f (void) { int i; client_t *cl; int uid; uid = atoi(Cmd_Argv(1)); for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) { if (!cl->state) continue; if (cl->userid == uid) { SV_BroadcastPrintf (PRINT_HIGH, "%s was kicked\n", cl->name); // print directly, because the dropped client won't get the // SV_BroadcastPrintf message SV_ClientPrintf (cl, PRINT_HIGH, "You were kicked from the game\n"); SV_DropClient (cl); pr_global_struct->time = sv.time; pr_global_struct->self = EDICT_TO_PROG(sv_player); PR_ExecuteProgram (pr_global_struct->ClientKill); return; } } Con_Printf ("Couldn't find user number %i\n", uid); }
void SV_PTrack_f (void) { int i; edict_t *ent, *tent; if (!host_client->spectator) return; if (Cmd_Argc() != 2) { // turn off tracking host_client->spec_track = 0; ent = EDICT_NUM(host_client - svs.clients + 1); tent = EDICT_NUM(0); ent->v.goalentity = EDICT_TO_PROG(tent); return; } i = atoi(Cmd_Argv(1)); if (i < 0 || i >= MAX_CLIENTS || svs.clients[i].state != cs_spawned || svs.clients[i].spectator) { SV_ClientPrintf (host_client, PRINT_HIGH, "Invalid client to track\n"); host_client->spec_track = 0; ent = EDICT_NUM(host_client - svs.clients + 1); tent = EDICT_NUM(0); ent->v.goalentity = EDICT_TO_PROG(tent); return; } host_client->spec_track = i + 1; // now tracking ent = EDICT_NUM(host_client - svs.clients + 1); tent = EDICT_NUM(i + 1); ent->v.goalentity = EDICT_TO_PROG(tent); }
static void Host_Pause_f (void) { if (cmd_source == src_command) { CL_Cmd_ForwardToServer (); return; } if (!pausable->int_val) SV_ClientPrintf ("Pause not allowed.\n"); else { sv.paused ^= 1; if (sv.paused) { SV_BroadcastPrintf ("%s paused the game\n", PR_GetString (&sv_pr_state, SVstring (sv_player, netname))); } else { SV_BroadcastPrintf ("%s unpaused the game\n", PR_GetString (&sv_pr_state, SVstring (sv_player, netname))); } // send notification to all clients MSG_WriteByte (&sv.reliable_datagram, svc_setpause); MSG_WriteByte (&sv.reliable_datagram, sv.paused); } }
void SV_ConSay_f(void) { client_t *client; int j; char *p; char text[1024]; if (Cmd_Argc () < 2) return; Q_strcpy (text, "console: "); p = Cmd_Args(); if (*p == '"') { p++; p[Q_strlen(p)-1] = 0; } Q_strcat(text, p); for (j = 0, client = svs.clients; j < MAX_CLIENTS; j++, client++) { if (client->state != cs_spawned) continue; SV_ClientPrintf(client, PRINT_CHAT, "%s\n", text); } }
/* ================== SV_Kick_f Kick a user off of the server ================== */ static void SV_Kick_f (void) { if (!svs.initialized) { Com_Printf ("No server running.\n"); return; } if (Cmd_Argc() != 2) { Com_Printf ("Usage: kick <userid>\n"); return; } if (!SV_SetPlayer ()) return; //r1: ignore kick message on connecting players (and those with no name) if (sv_client->state == cs_spawned && sv_client->name[0]) SV_BroadcastPrintf (PRINT_HIGH, "%s was kicked\n", sv_client->name); // print directly, because the dropped client won't get the // SV_BroadcastPrintf message SV_ClientPrintf (sv_client, PRINT_HIGH, "You were kicked from the game\n"); SV_DropClient (sv_client); sv_client->lastmessage = svs.realtime; // min case there is a funny zombie }
/* ================== SV_ConSay_f ================== */ void SV_ConSay_f( void ) { char *p, text[MAX_SYSPATH]; sv_client_t *client; int i; if( Cmd_Argc() < 2 ) return; if( !svs.clients || sv.background ) { Msg( "^3No server running.\n" ); return; } Q_strncpy( text, "console: ", MAX_SYSPATH ); p = Cmd_Args(); if( *p == '"' ) { p++; p[Q_strlen(p) - 1] = 0; } Q_strncat( text, p, MAX_SYSPATH ); for( i = 0, client = svs.clients; i < sv_maxclients->integer; i++, client++ ) { if( client->state != cs_spawned ) continue; SV_ClientPrintf( client, PRINT_CHAT, "%s\n", text ); } }
/* * Kick a user off of the server */ void SV_Kick_f(void) { if (!svs.initialized) { Com_Printf("No server running.\n"); return; } if (Cmd_Argc() != 2) { Com_Printf("Usage: kick <userid>\n"); return; } if (!SV_SetPlayer()) { return; } if ((sv_client->state == cs_spawned) && *sv_client->name) { SV_BroadcastPrintf(PRINT_HIGH, "%s was kicked\n", sv_client->name); } /* print directly, because the dropped client won't get the SV_BroadcastPrintf message */ SV_ClientPrintf(sv_client, PRINT_HIGH, "You were kicked from the game\n"); SV_DropClient(sv_client); sv_client->lastmessage = svs.realtime; /* min case there is a funny zombie */ }
/* ================== SV_Kick_f Kick a user off of the server ================== */ void SV_Kick_f( void ) { if( Cmd_Argc() != 2 ) { Msg( "Usage: kick <userid> | <name>\n" ); return; } if( !SV_SetPlayer( )) return; if( NET_IsLocalAddress( svs.currentPlayer->netchan.remote_address )) { Msg( "The local player cannot be kicked!\n" ); return; } SV_BroadcastPrintf( PRINT_HIGH, "%s was kicked\n", svs.currentPlayer->name ); SV_ClientPrintf( svs.currentPlayer, PRINT_HIGH, "You were kicked from the game\n" ); SV_DropClient( svs.currentPlayer ); Log_Printf( "Kick: \"%s<%i><%s><>\" was kicked by \"Console\"\n", svs.currentPlayer->name, svs.currentPlayer->userid, SV_GetClientIDString ( svs.currentPlayer ) ); // min case there is a funny zombie svs.currentPlayer->lastmessage = host.realtime; }
/* ================== SV_ShowServerinfo_f Dumps the serverinfo info string ================== */ void SV_ShowServerinfo_f (void) { // Info_Print (Cvar_Serverinfo()); // r1ch: this is a client issued command ! char *s; char *p; int flip; s = Cvar_Serverinfo(); // skip beginning \\ char s++; flip = 0; p = s; // make it more readable while (p[0]) { if (p[0] == '\\') { if (flip) p[0] = '\n'; else p[0] = '='; flip ^= 1; } p++; } SV_ClientPrintf (sv_client, PRINT_HIGH, "%s\n", s); // end r1ch fix }
/* ================== SV_ConSay_f ================== */ static void SV_ConSay_f(void) { client_t *client; int j; char *p; char text[1024]; if (Cmd_Argc () < 2) return; if (!svs.initialized) { Com_Printf ("No server running.\n"); return; } strcpy (text, "console: "); p = Cmd_Args(); if (*p == '"') { p++; p[strlen(p)-1] = 0; } strncat(text, p, 1014); for (j = 0, client = svs.clients; j < maxclients->integer; j++, client++) { if (client->state != cs_spawned) continue; SV_ClientPrintf(client, PRINT_CHAT, "%s\n", text); } }
void SV_Kick_f (void) { int i; client_t *cl; int uid; uid = atoi(Cmd_Argv(1)); for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) { if (!cl->state) continue; if (cl->userid == uid) { SV_BroadcastPrintf (PRINT_HIGH, "%s was kicked\n", cl->name); // print directly, because the dropped client won't get the // SV_BroadcastPrintf message SV_ClientPrintf (cl, PRINT_HIGH, "You were kicked from the game\n"); SV_DropClient (cl); return; } } Con_Printf ("Couldn't find user number %i\n", uid); }
/* * ================== SV_ConSay_f ================== */ void SV_ConSay_f(void) { client_t *client; int j; char *p; char text[1024]; if (Cmd_Argc() < 2) return; Q_strncpyz(text, "console: ", sizeof(text)); p = Cmd_Args(); if (*p == '"') { p++; p[strlen(p) - 1] = 0; } strncat(text, p, sizeof(text) - strlen(text) - 1); for (j = 0, client = svs.clients; j < maxclients->value; j++, client++) { if (client->state != cs_spawned) continue; SV_ClientPrintf(client, PRINT_CHAT, "%s\n", text); } }
/* Host_God_f Sets client to godmode */ static void Host_God_f (void) { if (cmd_source == src_command) { CL_Cmd_ForwardToServer (); return; } if (*sv_globals.deathmatch && !host_client->privileged) return; SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) ^ FL_GODMODE; if (!((int) SVfloat (sv_player, flags) & FL_GODMODE)) SV_ClientPrintf ("godmode OFF\n"); else SV_ClientPrintf ("godmode ON\n"); }
void SV_God_f (void) { if (!sv_allow_cheats) { Con_Printf ("You must run the server with -cheats to enable this command.\n"); return; } if (!SV_SetPlayer ()) return; sv_player->v.flags = (int)sv_player->v.flags ^ FL_GODMODE; if (!((int)sv_player->v.flags & FL_GODMODE) ) SV_ClientPrintf (host_client, PRINT_HIGH, "godmode OFF\n"); else SV_ClientPrintf (host_client, PRINT_HIGH, "godmode ON\n"); }
static void Host_Notarget_f (void) { if (cmd_source == src_command) { Cmd_ForwardToServer (); return; } if (*sv_globals.deathmatch || skill.integer > 2) return; sv_player->v.flags = (int)sv_player->v.flags ^ FL_NOTARGET; if (!((int)sv_player->v.flags & FL_NOTARGET) ) SV_ClientPrintf (0, "notarget OFF\n"); else SV_ClientPrintf (0, "notarget ON\n"); }
/* ================== Host_God_f Sets client to godmode ================== */ static void Host_God_f (void) { if (cmd_source == src_command) { Cmd_ForwardToServer (); return; } if (*sv_globals.deathmatch || *sv_globals.coop || skill.integer > 2) return; sv_player->v.flags = (int)sv_player->v.flags ^ FL_GODMODE; if (!((int)sv_player->v.flags & FL_GODMODE) ) SV_ClientPrintf (0, "godmode OFF\n"); else SV_ClientPrintf (0, "godmode ON\n"); }
void Host_Notarget_f (void) { if (cmd_source == src_command) { Cmd_ForwardToServer (); return; } if (pr_global_struct->deathmatch && !host_client->privileged) return; sv_player->v.flags = (int)sv_player->v.flags ^ FL_NOTARGET; if (!((int)sv_player->v.flags & FL_NOTARGET) ) SV_ClientPrintf ("notarget OFF\n"); else SV_ClientPrintf ("notarget ON\n"); }
/* ================== Host_God_f Sets client to godmode ================== */ void Host_God_f (void) { if (cmd_source == src_command) { Cmd_ForwardToServer (); return; } if (pr_global_struct->deathmatch && !host_client->privileged) return; sv_player->v.flags = (int)sv_player->v.flags ^ FL_GODMODE; if (!((int)sv_player->v.flags & FL_GODMODE) ) SV_ClientPrintf ("godmode OFF\n"); else SV_ClientPrintf ("godmode ON\n"); }
static void Host_Say (qboolean teamonly) { client_t *client; client_t *save; int j; char *p; char text[64]; qboolean fromServer = false; if (cmd_source == src_command) { if (cls.state == ca_dedicated) { fromServer = true; teamonly = false; } else { CL_Cmd_ForwardToServer (); return; } } if (Cmd_Argc () < 2) return; save = host_client; p = Hunk_TempAlloc (strlen (Cmd_Args (1)) + 1); strcpy (p, Cmd_Args (1)); // remove quotes if present if (*p == '"') { p++; p[strlen (p) - 1] = 0; } // turn on color set 1 if (!fromServer) snprintf (text, sizeof (text), "%c%s: ", 1, save->name); else snprintf (text, sizeof (text), "%c<%s> ", 1, hostname->string); j = sizeof (text) - 2 - strlen (text); // -2 for /n and null terminator if ((int) strlen (p) > j) p[j] = 0; strcat (text, p); strcat (text, "\n"); for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++) { if (!client || !client->active || !client->spawned) continue; if (teamplay->int_val && teamonly && SVfloat (client->edict, team) != SVfloat (save->edict, team)) continue; host_client = client; SV_ClientPrintf ("%s", text); } host_client = save; Sys_Printf ("%s", &text[1]); }
static void Host_Notarget_f (void) { if (cmd_source == src_command) { CL_Cmd_ForwardToServer (); return; } if (*sv_globals.deathmatch && !host_client->privileged) return; SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) ^ FL_NOTARGET; if (!((int) SVfloat (sv_player, flags) & FL_NOTARGET)) SV_ClientPrintf ("notarget OFF\n"); else SV_ClientPrintf ("notarget ON\n"); }
/* SV_God_f Sets client to godmode */ static void SV_God_f (void) { if (!sv_allow_cheats) { SV_Printf ("You must run the server with -cheats to enable this command.\n"); return; } if (!SV_SetPlayer ()) return; SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) ^ FL_GODMODE; if (!((int) SVfloat (sv_player, flags) & FL_GODMODE)) SV_ClientPrintf (1, host_client, PRINT_HIGH, "godmode OFF\n"); else SV_ClientPrintf (1, host_client, PRINT_HIGH, "godmode ON\n"); }
/* ===================== SV_KickClient From R1Q2 ===================== */ void SV_KickClient (client_t *cl, const char *reason, const char *cprintf) { if (reason && cl->state == cs_spawned && cl->name[0]) SV_BroadcastPrintf (PRINT_HIGH, "%s was dropped: %s\n", cl->name, reason); if (cprintf) SV_ClientPrintf (cl, PRINT_HIGH, "%s", cprintf); Com_Printf ("Dropping %s, %s.\n", cl->name, reason ? reason : "SV_KickClient"); SV_DropClient (cl); }