Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
cmd.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void ClientCommand_macro_write_aliases (float fh)
int ignore_add_player (entity this, entity ignore, bool to_db_too)
 Adds a player to the ignore list of another player.
void ignore_clearall (entity this)
void ignore_list_send (entity this)
void ignore_list_update_on_connection (entity this)
 Updates ignore list of all the players.
bool ignore_playerindb (entity this, entity pl)
 Checks if pl is permanently ignored by this.
bool ignore_playerinlist (entity this, entity pl)
 Checks if pl is ignored by this (permanently or for the current match)
void ignore_remove_player (entity this, entity ignore, bool from_db_too)
 Removes a player from the ignore list of another player.
string MapVote_Suggest (entity this, string m)

Variables

int autocvar_sv_clientcommand_antispam_count
float autocvar_sv_clientcommand_antispam_time
float cmd_floodtime
string ignore_list
const int IGNORE_LIST_SEND_NOW = -1
float ignore_list_send_time
const int IGNORE_MAXPLAYERS = 16

Function Documentation

◆ ClientCommand_macro_write_aliases()

void ClientCommand_macro_write_aliases ( float fh)

Definition at line 1156 of file cmd.qc.

1157{
1158 FOREACH(CLIENT_COMMANDS, true, { CMD_Write_Alias("qc_cmd_cmd", it.m_name, it.m_description); });
1159}
#define CMD_Write_Alias(execute, command, description)
Definition generic.qh:34
#define FOREACH(list, cond, body)
Definition iter.qh:19

References CMD_Write_Alias, and FOREACH.

Referenced by GENERIC_COMMAND().

◆ ignore_add_player()

int ignore_add_player ( entity this,
entity ignore,
bool to_db_too )

Adds a player to the ignore list of another player.

Parameters
[in]thisignore list owner
[in]ignoreplayer to add to the ignore list
[in]to_db_toowhether to add ignore to db too (permanent ignore) or not
Returns
status of the operation:
  • 0: ignore not added (can happen only when trying to add too many permanent ignores)
  • 1: ignore added as temporary (only for the current match)
  • 2: ignore added as permanent (to the db too)

Definition at line 88 of file cmd.qc.

89{
90 int r = 1;
91 // permanent ignores work if both the player and the sender have a stats UID
92 if (to_db_too && ignore.crypto_idfp && ignore.crypto_idfp != "" && this.crypto_idfp && this.crypto_idfp != "")
93 {
94 for (int j = 0; j < IGNORE_MAXPLAYERS; ++j)
95 {
96 string pos = db_get(ServerProgsDB, strcat("/ignore/", this.crypto_idfp, "/", ftos(j)));
97 if(pos == "")
98 {
99 db_put(ServerProgsDB, strcat("/ignore/", this.crypto_idfp, "/", ftos(j)), ignore.crypto_idfp);
100 r = 2;
101 break;
102 }
103 }
104 if (r != 2)
105 return 0;
106 }
107
108 string list = cons(this.ignore_list, ftos(etof(ignore)));
109 strcpy(this.ignore_list, list);
110
111 this.ignore_list_send_time = time + 0.2;
112
113 return r;
114}
string ignore_list
Definition main.qh:130
float ignore_list_send_time
Definition cmd.qh:9
const int IGNORE_MAXPLAYERS
Definition cmd.qh:11
float time
string crypto_idfp
ERASEABLE string db_get(int db, string key)
Definition map.qh:91
ERASEABLE void db_put(int db, string key, string value)
Definition map.qh:101
string ftos(float f)
#define etof(e)
Definition misc.qh:25
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define strcpy(this, s)
Definition string.qh:52
ERASEABLE string cons(string a, string b)
Definition string.qh:276
float ServerProgsDB
Definition world.qh:128

References cons(), crypto_idfp, db_get(), db_put(), entity(), etof, ftos(), ignore_list, ignore_list_send_time, IGNORE_MAXPLAYERS, ServerProgsDB, strcat(), strcpy, and time.

Referenced by ClientCommand_ignore(), and ignore_list_update_on_connection().

◆ ignore_clearall()

void ignore_clearall ( entity this)

Definition at line 176 of file cmd.qc.

177{
178 for(int j = 0; j < IGNORE_MAXPLAYERS; ++j)
179 {
180 string pos = db_get(ServerProgsDB, strcat("/ignore/", this.crypto_idfp, "/", ftos(j)));
181 if(pos != "")
182 {
183 db_remove(ServerProgsDB, strcat("/ignore/", this.crypto_idfp, "/", ftos(j)));
184 FOREACH_CLIENT(it != this && IS_REAL_CLIENT(it),
185 {
186 if(pos == it.crypto_idfp)
187 {
188 // permanent ignores already removed from db, remove only from list now
189 ignore_remove_player(this, it, false);
191 }
192 });
193 }
194 }
195}
void ignore_remove_player(entity this, entity ignore, bool from_db_too)
Removes a player from the ignore list of another player.
Definition cmd.qc:47
#define db_remove(db, key)
Definition map.qh:98
#define IS_REAL_CLIENT(v)
Definition utils.qh:17
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50

References crypto_idfp, db_get(), db_remove, entity(), FOREACH_CLIENT, ftos(), ignore_list_send_time, IGNORE_MAXPLAYERS, ignore_remove_player(), IS_REAL_CLIENT, ServerProgsDB, strcat(), and time.

Referenced by ClientCommand_clear_ignores().

◆ ignore_list_send()

void ignore_list_send ( entity this)

Definition at line 168 of file cmd.qc.

169{
170 ClientData_Touch(this, false);
171 // changing ignore_list_send_time to IGNORE_LIST_SEND_NOW is needed
172 // to send ignore_list correctly in ClientData_Send
174}
const int IGNORE_LIST_SEND_NOW
Definition cmd.qh:8
void ClientData_Touch(entity e, bool to_spectators_too)
Definition client.qc:185

References ClientData_Touch(), entity(), IGNORE_LIST_SEND_NOW, and ignore_list_send_time.

Referenced by PlayerFrame().

◆ ignore_list_update_on_connection()

void ignore_list_update_on_connection ( entity this)

Updates ignore list of all the players.

It's meant to be called when player 'this' connects.

Definition at line 153 of file cmd.qc.

154{
155 if (!this)
156 return;
157
158 FOREACH_CLIENT(it != this && IS_REAL_CLIENT(it),
159 {
160 if (ignore_playerindb(this, it))
161 ignore_add_player(this, it, false); // update ignore list of the connecting player
162
163 if (ignore_playerindb(it, this))
164 ignore_add_player(it, this, false); // update ignore list of other players
165 });
166}
int ignore_add_player(entity this, entity ignore, bool to_db_too)
Adds a player to the ignore list of another player.
Definition cmd.qc:88
bool ignore_playerindb(entity this, entity pl)
Checks if pl is permanently ignored by this.
Definition cmd.qc:117

References entity(), FOREACH_CLIENT, ignore_add_player(), ignore_playerindb(), and IS_REAL_CLIENT.

Referenced by ClientConnect().

◆ ignore_playerindb()

bool ignore_playerindb ( entity this,
entity pl )

Checks if pl is permanently ignored by this.

Definition at line 117 of file cmd.qc.

118{
119 if(this.crypto_idfp && this.crypto_idfp != "" && pl.crypto_idfp && pl.crypto_idfp != "")
120 {
121 string thelist = "";
122 for(int j = 0; j < IGNORE_MAXPLAYERS; ++j)
123 {
124 string pos = db_get(ServerProgsDB, strcat("/ignore/", this.crypto_idfp, "/", ftos(j)));
125 thelist = cons(thelist, pos);
126 }
127
128 return ((thelist != "") ? PlayerInList(pl, thelist) : false);
129 }
130 return false;
131}
bool PlayerInList(entity player, string list)
Definition client.qc:1045

References cons(), crypto_idfp, db_get(), entity(), ftos(), IGNORE_MAXPLAYERS, PlayerInList(), ServerProgsDB, and strcat().

Referenced by ignore_list_update_on_connection().

◆ ignore_playerinlist()

bool ignore_playerinlist ( entity this,
entity pl )

Checks if pl is ignored by this (permanently or for the current match)

Definition at line 134 of file cmd.qc.

135{
136 if (!this.ignore_list || this.ignore_list == "")
137 return false;
138
139 string theid = ftos(etof(pl));
140
141 // we use a tempstring here because if the input string of FOREACH_WORD is strzoned
142 // then it can no longer be strunzoned and updated correctly
143 string ignore_list_copy = strcat(this.ignore_list);
144 FOREACH_WORD(ignore_list_copy, it == theid,
145 return true;
146 );
147
148 return false;
149}
#define FOREACH_WORD(words, cond, body)
Definition iter.qh:33

References entity(), etof, FOREACH_WORD, ftos(), ignore_list, and strcat().

Referenced by ClientCommand_ignore(), and Say().

◆ ignore_remove_player()

void ignore_remove_player ( entity this,
entity ignore,
bool from_db_too )

Removes a player from the ignore list of another player.

Parameters
[in]thisignore list owner
[in]ignoreplayer to remove from the ignore list
[in]from_db_toowhether to remove player from db too (permanent ignore) or not

Definition at line 47 of file cmd.qc.

48{
49 if (from_db_too && ignore.crypto_idfp && ignore.crypto_idfp != "" && this.crypto_idfp && this.crypto_idfp != "")
50 {
51 for(int j = 0; j < IGNORE_MAXPLAYERS; ++j)
52 {
53 string pos = db_get(ServerProgsDB, strcat("/ignore/", this.crypto_idfp, "/", ftos(j)));
54 if(pos == ignore.crypto_idfp)
55 {
56 db_remove(ServerProgsDB, strcat("/ignore/", this.crypto_idfp, "/", ftos(j)));
57 break;
58 }
59 }
60 }
61
62 if (this.ignore_list == "")
63 return;
64
65 string newlist = "";
66 string theid = ftos(etof(ignore));
67
68 // we use a tempstring here because if the input string of FOREACH_WORD is strzoned
69 // then it can no longer be strunzoned and updated correctly
70 string ignore_list_copy = strcat(this.ignore_list);
71 FOREACH_WORD(ignore_list_copy, it != theid,
72 newlist = cons(newlist, it););
73 strcpy(this.ignore_list, newlist);
74
75 this.ignore_list_send_time = time + 0.2;
76}

References cons(), crypto_idfp, db_get(), db_remove, entity(), etof, FOREACH_WORD, ftos(), ignore_list, ignore_list_send_time, IGNORE_MAXPLAYERS, ServerProgsDB, strcat(), strcpy, and time.

Referenced by ClientCommand_unignore(), ClientDisconnect(), and ignore_clearall().

◆ MapVote_Suggest()

string MapVote_Suggest ( entity this,
string m )

Definition at line 130 of file mapvoting.qc.

131{
132 if (m == "")
133 return "That's not how to use this command.";
135 return "Suggestions are not accepted on this server.";
137 return "Can't suggest, voting is already in progress.";
139 if (!m)
140 return "The map you suggested is not available on this server.";
142 return "This server does not allow for recent maps to be played again. Please be patient for some rounds.";
143
145 return "The map you suggested does not support the current gametype.";
146 int i;
147 for (i = 0; i < mapvote_suggestion_ptr; ++i)
148 if (mapvote_maps_suggestions[i] == m)
149 return "This map was already suggested.";
152 else
153 {
156 }
157
158 if (mapvote_maps_suggestions[i] != "")
162
164 GameLogEcho(strcat(":vote:suggested:", m, ":", itos(this.playerid)));
165 return strcat("Suggestion of ", m, " accepted.");
166}
string netname
Definition powerups.qc:20
bool gametypevote
Definition mapvoting.qc:48
const int MAPVOTE_COUNT
Definition constants.qh:52
void GameLogEcho(string s)
Definition gamelog.qc:15
bool autocvar_sv_eventlog
Definition gamelog.qh:3
#define itos(i)
Definition int.qh:6
bool Map_IsRecent(string m)
float MapInfo_CheckMap(string s)
Definition mapinfo.qc:1510
float random(void)
void strunzone(string s)
float floor(float f)
string strzone(string s)
int playerid
Definition client.qh:82
string GameTypeVote_MapInfo_FixName(string m)
Definition mapvoting.qc:103
int mapvote_suggestion_ptr
Definition mapvoting.qc:34
string mapvote_maps_suggestions[MAPVOTE_COUNT]
Definition mapvoting.qc:33
string mapvote_maps_suggesters[MAPVOTE_COUNT]
Definition mapvoting.qc:32
bool autocvar_sv_vote_gametype
Definition mapvoting.qh:24
bool autocvar_g_maplist_votable_suggestions_override_mostrecent
Definition mapvoting.qh:18
bool autocvar_g_maplist_votable_suggestions
Definition mapvoting.qh:17
float mapvote_initialized
Definition mapvoting.qh:46

References autocvar_g_maplist_votable_suggestions, autocvar_g_maplist_votable_suggestions_override_mostrecent, autocvar_sv_eventlog, autocvar_sv_vote_gametype, entity(), floor(), GameLogEcho(), gametypevote, GameTypeVote_MapInfo_FixName(), itos, Map_IsRecent(), MapInfo_CheckMap(), MAPVOTE_COUNT, mapvote_initialized, mapvote_maps_suggesters, mapvote_maps_suggestions, mapvote_suggestion_ptr, netname, playerid, random(), strcat(), strunzone(), and strzone().

Referenced by ClientCommand_suggestmap().

Variable Documentation

◆ autocvar_sv_clientcommand_antispam_count

int autocvar_sv_clientcommand_antispam_count

Definition at line 4 of file cmd.qh.

Referenced by SV_ParseClientCommand().

◆ autocvar_sv_clientcommand_antispam_time

float autocvar_sv_clientcommand_antispam_time

Definition at line 3 of file cmd.qh.

Referenced by SV_ParseClientCommand().

◆ cmd_floodtime

float cmd_floodtime

Definition at line 6 of file cmd.qh.

◆ ignore_list

string ignore_list

Definition at line 7 of file cmd.qh.

◆ IGNORE_LIST_SEND_NOW

const int IGNORE_LIST_SEND_NOW = -1

Definition at line 8 of file cmd.qh.

Referenced by ClientData_Send(), and ignore_list_send().

◆ ignore_list_send_time

float ignore_list_send_time

◆ IGNORE_MAXPLAYERS

const int IGNORE_MAXPLAYERS = 16