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);
}
}
}(...)
|