Forum
CS2D Scripts Anti flashAnti flash
7 replies 1
EDIT: There's an easier way:
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
addhook('projectile', 'projectileHook')
function projectileHook(id, wpn)
if wpn == 52 then
local ox, oy = player(id, 'x'), player(id, 'y')
parse('setpos '..id..' 0 0')
timer(0, 'parse', 'setpos '..id..' '..ox..' '..oy)
end
end
This teleports the player away from his flashbang for one frame, which renders him safe for the millisecond it takes for the grenade to explode after projectileHook is called.
The timer(0, ...) is crucial in this script; it takes a tiny amount of time for Lua to call this function. I don't know how good/bad this will work on laggy servers, but from what I've tested it seems the player WILL be flashed for a brief second, until the server catches up with the wrongly flashed player.
I assumed only flashers had access to flash grenades. If this isn't the case you should know what to do.
VADemon has written
@ Alistaire does the flash really go away after the player is ported back? I've made an antiflash by removing the flashbang as a projectile, but I had to remove the flashbang ~150ms before, because else the change would hit clients AFTER flashbangs explosion > the player is blind though.
Test it for yourself, it works.
1