This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Solved Help for add colors in chat for this plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sh4d0ww
Junior Member
Join Date: Mar 2019
Old 06-19-2023 , 15:22   Help for add colors in chat for this plugin
Reply With Quote #1

Hello, for a long time I've been looking for a plugin that shows in the chat when we kill a special infected with a head shot, I even opened a request but I think it was in the wrong place and I couldn't delete it, sorry. I found a similar request HERE
so I took what was described by the user (HarryPotter) and started working on it and I got good results and whenever we kill a special it appears correctly in the chat, but now I would like to give a color to the messages, for example:
({green}"user"{default} killed smoker with head-shot, dmg:90), but in the chat the words green and default are part of the text and the text is the default color
I already have colors.inc on the server (dedicated)

Quote:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>
#include <multicolors>

#define HITGROUP_GENERIC 0
#define HITGROUP_HEAD 1
#define HITGROUP_CHEST 2
#define HITGROUP_STOMACH 3
#define HITGROUP_LEFTARM 4
#define HITGROUP_RIGHTARM 5
#define HITGROUP_LEFTLEG 6
#define HITGROUP_RIGHTLEG 7

#define ZOMBIECLASS_SMOKER 1
#define ZOMBIECLASS_BOOMER 2
#define ZOMBIECLASS_HUNTER 3
#define ZOMBIECLASS_SPITTER 4
#define ZOMBIECLASS_JOCKEY 5
#define ZOMBIECLASS_CHARGER 6
#define ZOMBIECLASS_WITCH 7
#define ZOMBIECLASS_TANK 8


public Plugin myinfo =
{
name = "[L4D & L4D2] XXX",
author = "HarryPotter, EDIT by Sh4d0w",
description = "<->",
version = "0.0",
url = ""
}

public void OnPluginStart()
{
HookEvent("player_hurt", Event_PlayerHurt, EventHookMode_Pre);

}

public void Event_PlayerHurt(Event event, const char[] name, bool dontBroadcast)
{
int victim = GetClientOfUserId(event.GetInt("userid"));
int attacker = GetClientOfUserId(event.GetInt("attacker"));
int dmg = event.GetInt("dmg_health");
int eventhealth = event.GetInt("health");

if (attacker == 0 || victim == 0 || !IsClientInGame(attacker) || !IsClientInGame(victim)
|| GetClientTeam(attacker) != 2 || GetClientTeam(victim) != 3 ) {
return;
}

int zombieClass = GetEntProp(victim, Prop_Send, "m_zombieClass");
int hitgroup = event.GetInt("hitgroup");
if(zombieClass == 1 && eventhealth <= 0 ) //smoker infected player is going to die
{
switch (hitgroup)
{
case HITGROUP_HEAD:
{
PrintToChatAll("%N {green}HeadShot{default} killed %N, dmg: %d", attacker, victim, dmg);
}
}
}(...)

Last edited by Sh4d0ww; 06-20-2023 at 11:34.
Sh4d0ww is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 06-19-2023 , 22:04   Re: Help for add colors in chat for this plugin
Reply With Quote #2

You have to use CPrintToChatAll

[INC] Multi Colors

Usually is the "normal" command + starting with "C"
__________________

Last edited by Marttt; 06-19-2023 at 22:05.
Marttt is offline
Sh4d0ww
Junior Member
Join Date: Mar 2019
Old 06-19-2023 , 22:29   Re: Help for add colors in chat for this plugin
Reply With Quote #3

Quote:
Originally Posted by Marttt View Post
You have to use CPrintToChatAll

[INC] Multi Colors

Usually is the "normal" command + starting with "C"
OMG is very simple thank you, I never writte an plugin, is my first mod
Sh4d0ww 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 07:42.


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