Quote:
Originally Posted by dwartbg
Some servers that I played had the screen flash up in blue when making a frag. I am looking for that particular plugin or at least something similar. Something to indicate when you made a frag.
|
PHP Code:
#pragma semicolon 1
#pragma newdecls required
static const int
FADE_CLR[] = {0, 0, 255, 63}, // Fade color (Red, Green, Blue, Alpha)
DURATION = 500, // Fade duration
HOLDTIME = 0; // Fade hold time
bool bProto;
public void OnPluginStart()
{
bProto = GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf;
HookEvent("player_death", Event_Death);
}
/*
#define USERMSG_RELIABLE (1<<2) // 4 Message will be set to reliable
#define USERMSG_INITMSG (1<<3) // 8 Message will be considered to be an initmsg
#define USERMSG_BLOCKHOOKS (1<<7) // 128 Prevents the message from triggering SourceMod and Metamod hooks
#define FFADE_IN 0x0001 // 1 Just here so we don't pass 0 into the function
#define FFADE_OUT 0x0002 // 2 Fade out (not in)
#define FFADE_MODULATE 0x0004 // 4 Modulate (don't blend)
#define FFADE_STAYOUT 0x0008 // 8 Ignores the duration, stays faded out until new ScreenFade message received
#define FFADE_PURGE 0x0010 // 16 Purges all other fades, replacing them with this one
*/
public void Event_Death(Event event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("attacker"));
if(!client || IsFakeClient(client))
return;
Handle msg = StartMessageOne("Fade", client, 132); // USERMSG_*
if(bProto)
{
PbSetInt(msg, "duration", DURATION);
PbSetInt(msg, "hold_time", HOLDTIME);
PbSetInt(msg, "flags", 0x0001|0x0010); // FFADE_*
PbSetColor(msg, "clr", FADE_CLR);
}
else
{
BfWriteShort(msg, DURATION);
BfWriteShort(msg, HOLDTIME);
BfWriteShort(msg, 0x0001|0x0010); // FFADE_*
BfWriteByte(msg, FADE_CLR[0]);
BfWriteByte(msg, FADE_CLR[1]);
BfWriteByte(msg, FADE_CLR[2]);
BfWriteByte(msg, FADE_CLR[3]);
}
EndMessage();
}
__________________