/* ================== Cmd_Say_f ================== based on monkeymod.com 1.31 http://jjaf.de/kingpin/mods/monkey/ 2000-11-21T23:40-jjaf: added yellow team-say on svar "highlight_team" = 1 2000-11-21T23:56-jjaf: added /receiver/-parameter for "say_opponent, -killer ,-p(-ersonal/-layer) ..." */ void Cmd_Say_f (edict_t *ent, qboolean team, qboolean arg0, edict_t *receiver) { /*jjaf*/#define hightlight_code "\r>" int i, j; edict_t *other; char *p; char text[2048]; gclient_t *cl; if (gi.argc () < 2 && !arg0) return; if (!teamplay->value && !((int)(dmflags->value) & (DF_MODELTEAMS /*| DF_SKINTEAMS*/))) team = false; if (team) /*jjaf*/ if (gi.cvar ("highlight_team", "1" , 0)->value) /*jjaf*/ Com_sprintf (text, sizeof(text), "%s:(%s): ", hightlight_code, ent->client->pers.netname); // 2000-11-22T01:00-jjaf: yellow team-msgs /*jjaf*/ else Com_sprintf (text, sizeof(text), ":(%s): ", ent->client->pers.netname); else /*jjaf*/{ /*jjaf*/ if (receiver) /*jjaf*/ Com_sprintf (text, sizeof(text), ":[%s]: ", ent->client->pers.netname); /*jjaf*/ else Com_sprintf (text, sizeof(text), ":%s: ", ent->client->pers.netname); /*jjaf*/} if (arg0) { strcat (text, gi.argv(0)); strcat (text, " "); strcat (text, gi.args()); } else { p = gi.args(); if (*p == '"') { p++; p[strlen(p)-1] = 0; } strcat(text, p); } /*jjaf*/if (disable_anon_text && ((strrchr(text, 13) - text + 1) > 1)) { // 2000-11-22T01:22-jjaf: enable server-set "anon"-text if (!ent->anonwarn) { gi.cprintf(ent, PRINT_CHAT, "anonymous text is not allowed on this server!\n"); ent->anonwarn++; } return; } // don't let text be too long for malicious reasons if (strlen(text) > 150) text[150] = 0; strcat(text, "\n"); if (flood_msgs->value) { cl = ent->client; if (level.time < cl->flood_locktill) { cprintf(ent, PRINT_HIGH, "You can't talk for %d more seconds\n", (int)(cl->flood_locktill - level.time)); return; } i = cl->flood_whenhead - flood_msgs->value + 1; if (i < 0) i = (sizeof(cl->flood_when)/sizeof(cl->flood_when[0])) + i; if (cl->flood_when[i] && level.time - cl->flood_when[i] < flood_persecond->value) { cl->flood_locktill = level.time + flood_waitdelay->value; gi.cprintf(ent, PRINT_CHAT, "Flood protection: You can't talk for %d seconds.\n", (int)flood_waitdelay->value); return; } // if they repeat themselves really quickly, bitch-slap time if (cl->flood_when[cl->flood_whenhead] && (cl->flood_when[cl->flood_whenhead] > level.time - 1) && !strcmp( ent->client->flood_lastmsg, text )) { cl->flood_locktill = level.time + flood_waitdelay->value; gi.cprintf(ent, PRINT_CHAT, "Flood protection: You can't talk for %d seconds.\n", (int)flood_waitdelay->value); return; } cl->flood_whenhead = (cl->flood_whenhead + 1) % (sizeof(cl->flood_when)/sizeof(cl->flood_when[0])); cl->flood_when[cl->flood_whenhead] = level.time; } strcpy( ent->client->flood_lastmsg, text ); if (dedicated->value) gi.cprintf(NULL, PRINT_CHAT, "%s", text); for (j = 1; j <= game.maxclients; j++) { other = &g_edicts[j]; if (!(other->inuse)) continue; if (!(other->client)) continue; if (team) { if (!teamplay->value || ent->client->pers.team!=other->client->pers.team) if (!OnSameTeam(ent, other)) continue; } /*jjaf*/ if (receiver) /*jjaf*/ { /*jjaf*/ if (other != receiver) /*jjaf*/ continue; /*jjaf*/ } gi.cprintf(other, PRINT_CHAT, "%s", text); } }