Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ==================
- G_SayTo
- ==================
- */
- static void G_SayTo(gentity_t *ent, gentity_t *other, int mode, const char *name, const char *message, char *sound, qboolean override) {
- qboolean ghost = qfalse;
- qboolean spec = qfalse;
- qboolean adminchat = qfalse;
- qboolean srcadmin = qfalse;
- qboolean dstadmin = qfalse;
- const char* type;
- const char* chat;
- const char* color;
- if (!other) {
- return;
- }
- if (!other->inuse) {
- return;
- }
- if (!other->client) {
- return;
- }
- if (other->client->pers.connected != CON_CONNECTED) {
- return;
- }
- if (mode == SAY_TEAM && !OnSameTeam(ent, other)) {
- return;
- }
- if (!override) {
- if (ent->client->sess.muted) {
- return;
- }
- if (ent->client->sess.modData->penalty) {
- return;
- }
- }
- if (ent->client->sess.modData->adminref == -1) {
- srcadmin = 2;
- } else {
- srcadmin = ent->client->sess.modData->adminref;
- }
- if (other->client->sess.modData->adminref == -1) {
- dstadmin = 2;
- } else {
- dstadmin = other->client->sess.modData->adminref;
- }
- if (G_IsClientChatIgnored(other->s.number, ent->s.number) && mode != SAY_ADMIN_ALL && mode != SAY_ADMIN_ONLY) {
- return;
- }
- if ((mode == SAY_ADMIN_ALL || mode == SAY_ADMIN_ONLY) && srcadmin < 2 && !override) {
- return;
- }
- if (mode == SAY_ADMIN_ONLY && dstadmin < 2) {
- return;
- }
- if ((mode == SAY_REF_ALL || mode == SAY_REF_ONLY) && srcadmin == 0 && !override) {
- return;
- }
- if (mode == SAY_REF_ONLY && dstadmin == 0) {
- return;
- }
- if (mode == SAY_CLAN_ONLY && !ent->client->sess.modData->clan && !override) {
- return;
- }
- if (mode == SAY_CLAN_ONLY && (!other->client->sess.modData->clan && other->client->sess.modData->adminref < 2 && other->client->sess.modData->adminref > -1)) {
- return;
- }
- if (!level.intermissiontime && !level.intermissionQueued) {
- // Spectators cant talk to alive people
- if (ent->client->sess.team == TEAM_SPECTATOR) {
- spec = qtrue;
- }
- if (level.gametypeData->respawnType == RT_NONE) {
- // Dead people cant talk to alive people
- if (!spec && G_IsClientDead(ent->client)) {
- ghost = qtrue;
- }
- // If the client we are talking to is alive then a check
- // must be made to see if this talker is alowed to speak to this person
- if (ent->s.number != other->s.number && !G_IsClientDead(other->client) && !G_IsClientSpectating(other->client) && (ghost || spec) && mode != SAY_ADMIN_ALL && mode != SAY_ADMIN_ONLY && !g_voiceTalkingGhosts.integer) {
- return;
- }
- }
- }
- chat = "";
- color = "";
- type = "";
- // Visitor
- if(ent->client->sess.modData->clan == 0 && ent->client->sess.modData->adminref == 0) {
- type = "^1** ^7Visitor ^1** ";
- }
- // Clan
- if (ent->client->sess.modData->clan == 1 && ent->client->sess.modData->adminref < 3 && ent->client->sess.modData->adminref < 2 && ent->client->sess.modData->adminref < 1) {
- type = "^1** ^7Clan ^1** ";
- }
- // Referee
- else if (ent->client->sess.modData->adminref == 1 && ent->client->sess.modData->clan == 1) {
- type = "^1** ^7Referee ^1** ";
- }
- // Admin
- else if (ent->client->sess.modData->adminref == 2 && ent->client->sess.modData->clan == 1) {
- type = "^1** ^7Admin ^1** ";
- }
- // Sysop
- else if (ent->client->sess.modData->adminref == 3 && ent->client->sess.modData->clan == 1) {
- type = "^1** ^7Sysop ^1** ";
- }
- if (mode == SAY_TEAM) {
- chat = "tchat";
- } else {
- chat = "chat";
- }
- if (mode == SAY_ADMIN_TELL) {
- color = "^7";
- adminchat = qtrue;
- if (g_anonymousAdmin.integer && dstadmin < 2) {
- name = "";
- }
- } else if (mode == SAY_ADMIN_ALL) {
- color = "^7";
- type = "^5*admin* ^7";
- if (sv_modClient.integer || other->client->sess.modData->versionVerified) {
- chat = "achat";
- } else {
- chat = "chat";
- adminchat = qtrue;
- }
- if (g_anonymousAdmin.integer && dstadmin < 2) {
- name = "";
- }
- } else if (mode == SAY_ADMIN_ONLY) {
- type = "^6*admins only* ^7";
- if (sv_modClient.integer || other->client->sess.modData->versionVerified) {
- chat = "achat";
- } else {
- chat = "chat";
- adminchat = qtrue;
- }
- } else if (mode == SAY_REF_ALL) {
- color = "^7";
- type = "^3*referee* ^7";
- if (sv_modClient.integer || other->client->sess.modData->versionVerified) {
- chat = "achat";
- } else {
- chat = "chat";
- adminchat = qtrue;
- }
- } else if (mode == SAY_REF_ONLY) {
- type = "^6*referees only* ^7";
- if (sv_modClient.integer || other->client->sess.modData->versionVerified) {
- chat = "achat";
- } else {
- chat = "chat";
- adminchat = qtrue;
- }
- } else if (mode == SAY_CLAN_ALL) {
- color = "^7";
- type = "^1*clan* ^7";
- } else if (mode == SAY_CLAN_ONLY) {
- type = "^1*clan only* ^7";
- } else if (ghost) {
- type = "*ghost* ";
- } else if (spec) {
- type = "*spec* ";
- }
- trap_SendServerCommand(other - g_entities, va("%s %d \"%s%s%s%s\"", chat, ent->s.number, type, name, color, message));
- if (adminchat) {
- G_LocalSound(other->s.number, "sound/misc/menus/quit_request.wav");
- }
- if (g_voiceCommandsEnabled.integer && sound[0]) {
- if (g_voiceCommandsEnabled.integer == 1 && sv_modClient.integer || other->client->sess.modData->versionVerified) {
- trap_SendServerCommand(other - g_entities, va("sound %i \"%s\"", ent->client->sess.team, sound));
- } else {
- G_LocalSound(other->s.number, sound);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement