Raised This Month: $ Target: $400
 0% 

Changing color of death msg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bibu
Veteran Member
Join Date: Sep 2010
Old 10-23-2010 , 15:21   Changing color of death msg
Reply With Quote #1

I would like to change the color of death msg for cs.

It's for example like that:

(red)bibi (weapon) (blue)Player

Can someone show me how to change the color of that without changing something in the teams? That it can look like:

(red)bibi (weapon) (red)Player (player is still ct)

or

(white)bibi (weapon) (white)Player

or reverse

(blue)bibi (weapon) (red)Player (player is still ct)
bibu is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 10-23-2010 , 16:06   Re: Changing color of death msg
Reply With Quote #2

When exactly do you want to change the message? Do you want to change colors of all death messages?
__________________
hleV is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 10-23-2010 , 17:07   Re: Changing color of death msg
Reply With Quote #3

Quote:
Originally Posted by hleV View Post
When exactly do you want to change the message? Do you want to change colors of all death messages?
I would like to change all death messages, that i can customize it with the color, cvars like that for example:

amx_t_kill blue (default: red)
amx_ct_kill red (default: blue)

Should support those 3 colors: red, blue, gray
bibu is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 10-23-2010 , 18:38   Re: Changing color of death msg
Reply With Quote #4

  • amx_cdmc <1|0> - enabled/disabled;
  • amx_cdmc_t <1|2|3> - red/blue/gray;
  • amx_cdmc_ct <1|2|3>.
Code:
#include <amxmodx> new g_iTeam[33]; new g_iTeamInfo; new g_pColors[3]; public plugin_init() {         register_plugin("Custom Death Message Colors", "1.0", "hleV");         g_pColors[0] = register_cvar("amx_cdmc", "1");         g_pColors[1] = register_cvar("amx_cdmc_t", "3");         g_pColors[2] = register_cvar("amx_cdmc_ct", "1");         g_iTeamInfo = get_user_msgid("TeamInfo");         new const szDeathMsg[] = "DeathMsg";         register_message(get_user_msgid(szDeathMsg), "msgDeathMsg");         register_event(szDeathMsg, "eventDeathMsg", "a"); } public msgDeathMsg() {         if (!get_pcvar_num(g_pColors[0]))                 return;         new const iKiller = get_msg_arg_int(1);         new const iVictim = get_msg_arg_int(2);         if (iKiller && iKiller != iVictim)                 fnSetTeamInfo(iKiller, get_pcvar_num(g_pColors[(g_iTeam[iKiller] = get_user_team(iKiller))]));         fnSetTeamInfo(iVictim, get_pcvar_num(g_pColors[(g_iTeam[iVictim] = get_user_team(iVictim))])); } public eventDeathMsg() {         if (!get_pcvar_num(g_pColors[0]))                 return;         new const iKiller = read_data(1);         new const iVictim = read_data(2);         if (iKiller && iKiller != iVictim)                 fnSetTeamInfo(iKiller, g_iTeam[iKiller]);         fnSetTeamInfo(iVictim, g_iTeam[iVictim]); } fnSetTeamInfo(iClient, const iTeam) {         static const s_szTeams[][] =         {                 "",                 "TERRORIST",                 "CT",                 "SPECTATOR"         };         message_begin(MSG_ALL, g_iTeamInfo, _, iClient);         write_byte(iClient);         write_string(s_szTeams[iTeam]);         message_end(); }
__________________

Last edited by hleV; 10-24-2010 at 03:54.
hleV is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-23-2010 , 18:39   Re: Changing color of death msg
Reply With Quote #5

Quote:
Originally Posted by bibu View Post
without changing something in the teams?
Doubtful if possible at all (which I don't believe is possible).
__________________
fysiks is offline
Jacob
Senior Member
Join Date: Oct 2010
Old 10-23-2010 , 19:18   Re: Changing color of death msg
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Doubtful if possible at all (which I don't believe is possible).
agree.

Last edited by Jacob; 10-28-2010 at 05:29.
Jacob is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-23-2010 , 20:12   Re: Changing color of death msg
Reply With Quote #7

@hlev: I'm not sure that would work. Did you test it? Registering the death message, afaik, is effectively hooking it in post so the message was already sent. Can't modify it after it's been sent already.
__________________
fysiks is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-23-2010 , 23:08   Re: Changing color of death msg
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
@hlev: I'm not sure that would work. Did you test it? Registering the death message, afaik, is effectively hooking it in post so the message was already sent. Can't modify it after it's been sent already.
register_message() is pre hook.
register_event() is post hook.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-24-2010 , 00:02   Re: Changing color of death msg
Reply With Quote #9

Quote:
Originally Posted by Exolent[jNr] View Post
register_message() is pre hook.
register_event() is post hook.
Oh. Nice to know. Also, didn't notice he had both in there.
__________________
fysiks is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 10-24-2010 , 03:55   Re: Changing color of death msg
Reply With Quote #10

I tested it with only 1 player (myself), so only the victim's name was displayed in custom color.
__________________
hleV is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:16.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode