25 int Say(
entity source,
int teamsay,
entity privatesay,
string msgin,
bool floodcontrol)
27 if (!teamsay && !privatesay &&
substring(msgin, 0, 1) ==
" ")
50 msgin = trigger_magicear_processmessage_forallears(source, teamsay, privatesay, msgin);
67 string colorprefix = (strdecolorize(namestr) == namestr) ?
"^3" :
"^7";
69 string msgstr =
"", cmsgstr =
"";
71 int privatemsgprefixlen = 0;
74 bool found_me =
false;
78 string newnamestr = ((teamsay) ?
strcat(colorstr,
"(", colorprefix, namestr, colorstr,
")",
"^7") :
strcat(colorprefix, namestr,
"^7"));
81 if(strdecolorize(it) ==
"/me")
84 newmsgin =
cons(newmsgin, newnamestr);
87 newmsgin =
cons(newmsgin, it);
94 msgstr =
strcat(
"\{1}\{13}* ", colorprefix, namestr,
"^3 tells you: ^7");
95 privatemsgprefixlen =
strlen(msgstr);
96 msgstr =
strcat(msgstr, msgin);
97 cmsgstr =
strcat(colorstr, colorprefix, namestr,
"^3 tells you:\n^7", msgin);
107 msgstr =
strcat(
"\{1}\{13}^4* ",
"^7", msgin);
110 msgstr =
strcat(
"\{1}\{13}", colorstr,
"(", colorprefix, namestr, colorstr,
") ^7", msgin);
111 cmsgstr =
strcat(colorstr,
"(", colorprefix, namestr, colorstr,
")\n^7", msgin);
120 msgstr =
strcat(
"\{1}^4* ^7", msgin);
124 msgstr =
strcat(msgstr, (namestr !=
"") ?
strcat(colorprefix, namestr,
"^7: ") :
"^7");
125 msgstr =
strcat(msgstr, msgin);
129 msgstr =
strcat(strreplace(
"\n",
" ", msgstr),
"\n");
132 string fullmsgstr = msgstr;
133 string fullcmsgstr = cmsgstr;
138 if(floodcontrol && source)
140 float flood_spl, flood_burst, flood_lmax;
162 flood_burst =
max(0, flood_burst - 1);
180 msgstr =
strcat(msgstr,
"\n");
184 if (
time >= source.(flood_field))
186 source.(flood_field) =
max(
time - flood_burst * flood_spl, source.(flood_field)) + lines * flood_spl;
196 if (
time >= source.(flood_field))
197 source.(flood_field) =
max(
time - flood_burst * flood_spl, source.(flood_field)) + flood_spl;
203 source.(flood_field) = flood = 0;
206 string sourcemsgstr, sourcecmsgstr;
211 sourcemsgstr =
strcat(msgstr,
"\n^3FLOOD CONTROL: ^7message too long, trimmed\n");
216 sourcemsgstr = fullmsgstr;
217 sourcecmsgstr = fullcmsgstr;
223 sourcemsgstr = msgstr;
224 sourcecmsgstr = cmsgstr;
227 if (!privatesay && source && !(
IS_PLAYER(source) ||
INGAME(source)) && !game_stopped
234 LOG_INFO(
"NOTE: ", playername(source.netname, source.team,
IS_PLAYER(source)),
"^7 is flooding.");
238 sourcemsgstr =
strcat(privatemsgprefix,
substring(sourcemsgstr, privatemsgprefixlen, -1));
241 if(source &&
CS(source).muted)
250 sprint(source,
strcat(
"^3FLOOD CONTROL: ^7wait ^1",
ftos(source.(flood_field) -
time),
"^3 seconds\n"));
261 if (privatesay && source && !(
IS_PLAYER(source) ||
INGAME(source)) && !game_stopped
270 string event_log_msg =
"";
272 if(sourcemsgstr !=
"" && ret != 0)
276 sprint(source, sourcemsgstr);
277 if(sourcecmsgstr !=
"" && !privatesay)
282 sprint(source, sourcemsgstr);
286 sprint(privatesay, msgstr);
293 sprint(source, sourcemsgstr);
298 event_log_msg = sprintf(
":chat_minigame:%d:%s:%s", source.playerid,
CS(source).active_minigame.netname, msgin);
303 sprint(source, sourcemsgstr);
305 if(sourcecmsgstr !=
"")
312 event_log_msg = sprintf(
":chat_team:%d:%d:%s", source.playerid, source.team, strreplace(
"\n",
" ", msgin));
316 sprint(source, sourcemsgstr);
321 event_log_msg = sprintf(
":chat_spec:%d:%s", source.playerid, strreplace(
"\n",
" ", msgin));
326 sprint(source, sourcemsgstr);
333 event_log_msg = sprintf(
":chat:%d:%s", source.playerid, strreplace(
"\n",
" ", msgin));
349 IL_EACH(((checkitems) ?
g_items : g_locations), ((checkitems) ? (it.target ==
"###item###") : (it.classname ==
"target_location")),
351 if ((it.items == IT_KEY1 || it.items == IT_KEY2) && it.target ==
"###item###")
356 dist = dist.x * axismod.x *
'1 0 0' + dist.y * axismod.y *
'0 1 0' + dist.z * axismod.z *
'0 0 1';
357 float len = vlen2(dist);
360 for (l = 0; l < num_nearest; ++l)
362 if (len < nearest_length[l])
378 num_nearest = num_nearest + 1;
383 for (
int j = 0; j < num_nearest; ++j)
394 if (num_nearest == 0)
397 LOG_TRACE(
"Not seeing any location point, using nearest as fallback.");
414 string ret =
"somewhere";
434 else if(myhealth <= 0 ||
IS_DEAD(
this))
436 return ftos(myhealth);
441 entity wepent = this.(weaponentity);
444 else if(wepent.m_weapon != WEP_Null)
445 return wepent.m_weapon.m_name;
446 else if(wepent.m_switchweapon != WEP_Null)
447 return wepent.m_switchweapon.m_name;
500 case "%": replacement =
"%";
break;
501 case "\\":replacement =
"\\";
break;
502 case "n": replacement =
"\n";
break;
509 case "W": replacement =
GetAmmoName(this.(weaponentity).m_weapon.ammo_type);
break;
510 case "x": replacement = ((cursor_ent.netname ==
"" || !cursor_ent) ?
"nothing" : cursor_ent.netname);
break;
511 case "s": replacement =
ftos(
vlen(this.
velocity - this.velocity_z *
'0 0 1'));
break;
518 replacement =
M_ARGV(2,
string);
524 p = p +
strlen(replacement);
532 text =
strcat(
"\{1}^7", text,
"\n");
548 text =
strcat(
"\{1}^7", text,
"\n");
564 text =
strcat(
"\{1}^7", text,
"\n");
567 if (it.team == team_num)
void dedicated_print(string input)
print(), but only print if the server is not local
#define IL_EACH(this, cond, body)
float nearest_length[NUM_NEAREST_ENTITIES]
float autocvar_g_chat_flood_spl_team
string PlayerHealth(entity this)
string getWrappedLine_remaining
float autocvar_g_chat_flood_lmax_team
int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodcontrol)
message "": do not say, just test flood control return value: 1 = accept 0 = reject -1 = fake accept ...
string GetAmmoName(Resource ammotype)
ClientState CS(Client this)
#define FOREACH_CLIENT(cond, body)
string getWrappedLineLen(float w, textLengthUpToLength_lenFunction_t tw)
float floodcontrol_chatteam
float autocvar_g_chat_flood_lmax_tell
bool autocvar_g_chat_flood_notify_flooder
bool autocvar_g_chat_teamcolors
const float TIMEOUT_ACTIVE
ERASEABLE void DebugPrintToChatAll(string text)
Prints the string to all clients' chat if the server cvar "developer" is not 0.
#define FOREACH_WORD(words, cond, body)
#define IS_REAL_CLIENT(v)
entity nearest_entity[NUM_NEAREST_ENTITIES]
#define CHAT_NOSPECTATORS()
float autocvar_g_chat_flood_burst_team
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
bool autocvar_g_chat_tellprivacy
float autocvar_g_chat_flood_burst
float autocvar_g_chat_flood_spl_tell
entity findnearest(vector point, bool checkitems, vector axismod)
string NearestLocation(vector p)
void GameLogEcho(string s)
ERASEABLE void DebugPrintToChat(entity client, string text)
Print the string to the client's chat if the server cvar "developer" is not 0.
ERASEABLE void PrintToChatTeam(int team_num, string text)
Print the string to chat of all clients of the specified team.
const float NUM_NEAREST_ENTITIES
vector(float skel, float bonenum) _skel_get_boneabs_hidden
string Team_ColorCode(int teamid)
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define MUTATOR_CALLHOOK(id,...)
ERASEABLE void PrintToChat(entity client, string text)
Print the string to the client's chat.
entity weaponentities[MAX_WEAPONSLOTS]
float mapvote_initialized
noref int autocvar_developer
float autocvar_g_chat_flood_spl
ERASEABLE string cons(string a, string b)
bool autocvar_sv_eventlog
void WarpZone_crosshair_trace_plusvisibletriggers(entity pl)
float autocvar_g_chat_flood_lmax
string formatmessage(entity this, string msg)
ERASEABLE void PrintToChatAll(string text)
Prints the string to all clients' chat.
ERASEABLE void DebugPrintToChatTeam(int team_num, string text)
Print the string to chat of all clients of the specified team if the server cvar "developer" is not 0...
float autocvar_g_chat_flood_burst_tell
string WeaponNameFromWeaponentity(entity this,.entity weaponentity)
ERASEABLE string seconds_tostring(float seconds)
float floodcontrol_chattell