I made a small plugin that tells who blinded who...
It can easily be modified to do something serious like only reporting those who throws team blinds. In the first 10 seconds of a game, if someone team blinds, something ATAC:ky like kicking/banning/jailing could be done. Just an example. I didn't bother implementing any of that. Just wanted to find out a way to detect who blinds who. Seems to work with this. Whoever can borrow this code into ATAC or any other plugin, it's fine by me. Just wanted to share. :-)
Code:
#define PLUGINNAME "Blind"
#define VERSION "0.1"
#define AUTHOR "JGHG"
/*
Copyleft 2005
Plugin topic: <a href="http://www.amxmodx.org/forums/viewtopic.php?p=?" target="_blank" rel="nofollow noopener">http://www.amxmodx.org/forums/viewtopic.php?p=?</a>
PLUGINNAME
==========
blablabla.
/JGHG
VERSIONS
========
?????? 0.1 First version
*/
#include <amxmodx>
#include <engine>
#include <fakemeta>
#define MAXFLASHES 64
#define BLINDED_FULLY 255 // These are alpha values actually...
#define BLINDED_PARTLY 200
#define TEMPENTITY "23"
// Globals below
//new g_flashes[MAXFLASHES]
new g_flashOwners[MAXFLASHES]
new g_nextHead[MAXFLASHES]
new g_head = 0
new g_tail = 0
new g_lastTail = 0
new g_flashCount = 0
// Globals above
public plugin_modules() {
require_module("engine")
require_module("fakemeta")
}
public event_blinded(const ID) {
if (g_tail == 0)
return PLUGIN_CONTINUE
new alpha = read_data(7)
if (alpha != BLINDED_FULLY && alpha != BLINDED_PARTLY)
return PLUGIN_CONTINUE
new duration = read_data(1)
new holdtime = read_data(2)
new flasher[32], name[32]
get_user_name(g_flashOwners[g_head], flasher, 31)
get_user_name(ID, name, 31)
client_print(0, print_chat, "%s is %s blinded by %s, duration: %d, holdtime: %d", name, alpha == BLINDED_FULLY ? "fully" : "partly", flasher, duration, holdtime)
return PLUGIN_CONTINUE
}
public event_flashsmokepuff() {
remove_flash()
return PLUGIN_CONTINUE
}
remove_flash() {
// This is the new tail
g_tail = g_head
// Select next head
g_head = g_nextHead[g_tail]
// Reset this one
g_flashOwners[g_tail] = 0
g_nextHead[g_tail] = 0
g_flashCount--
if (g_flashCount == 0)
g_tail = 0
}
public forward_setmodel(const ENTITY, model[]) {
if (!equal(model, "models/w_flashbang.mdl"))
return FMRES_IGNORED
new owner = entity_get_edict(ENTITY, EV_ENT_owner)
if (owner == 0)
return FMRES_IGNORED
g_flashOwners[g_tail] = owner
g_nextHead[g_lastTail] = g_tail
g_lastTail = g_tail
g_tail = 0
while (g_flashOwners[g_tail])
g_tail++
g_flashCount++
return FMRES_IGNORED
}
public plugin_init() {
register_plugin(PLUGINNAME, VERSION, AUTHOR)
register_event("ScreenFade", "event_blinded", "be", "4=255", "5=255", "6=255", "7>199")
register_event(TEMPENTITY, "event_flashsmokepuff", "a", "1=5", "6=25", "7=6")
register_forward(FM_SetModel, "forward_setmodel")
}
/*
Blinded event:
L 02/07/2005 - 09:50:49: [msglogging.amxx] MessageBegin ScreenFade(98) Arguments
=7 Destination=One(1) Origin={0.000000 0.000000 0.000000} Entity=1 Classname=pla
yer Netname=Johnny got his gun
L 02/07/2005 - 09:50:49: [msglogging.amxx] Arg 1 (Short): 39314
L 02/07/2005 - 09:50:49: [msglogging.amxx] Arg 2 (Short): 8736
L 02/07/2005 - 09:50:49: [msglogging.amxx] Arg 3 (Short): 0
L 02/07/2005 - 09:50:49: [msglogging.amxx] Arg 4 (Byte): 255
L 02/07/2005 - 09:50:49: [msglogging.amxx] Arg 5 (Byte): 255
L 02/07/2005 - 09:50:49: [msglogging.amxx] Arg 6 (Byte): 255
L 02/07/2005 - 09:50:49: [msglogging.amxx] Arg 7 (Byte): 255 (fully blinded, 200 is partly)
L 02/07/2005 - 09:50:49: [msglogging.amxx] MessageEnd ScreenFade(98)
Event of the flash's smokepuff:
L 02/07/2005 - 12:54:39: [msglogging.amxx] MessageBegin tempentity?(23) Arguments=7 Destination=PVS(4) Origin={370.388367 -304.124451 -249.368744} Entity=NULL Classname=NULL Netname=NULL
L 02/07/2005 - 12:54:39: [msglogging.amxx] Arg 1 (Byte): 5
L 02/07/2005 - 12:54:39: [msglogging.amxx] Arg 2 (Coord): 370.388367
L 02/07/2005 - 12:54:39: [msglogging.amxx] Arg 3 (Coord): -304.124451
L 02/07/2005 - 12:54:39: [msglogging.amxx] Arg 4 (Coord): -249.368744
L 02/07/2005 - 12:54:39: [msglogging.amxx] Arg 5 (Short): 88 // model index varies from map to map... don't rely on it
L 02/07/2005 - 12:54:39: [msglogging.amxx] Arg 6 (Byte): 25
L 02/07/2005 - 12:54:39: [msglogging.amxx] Arg 7 (Byte): 6
L 02/07/2005 - 12:54:39: [msglogging.amxx] MessageEnd tempentity?(23)
*/