Forum

> > CS2D > Scripts > Anti flash
Forums overviewCS2D overview Scripts overviewLog in to reply

English Anti flash

7 replies
To the start Previous 1 Next To the start

old Anti flash

BestMan
User Off Offline

Quote
Hi. I creating new script, and i can't create anti flash system for class "Flasher". Somebody can help me?

old Re: Anti flash

JOJ
User Off Offline

Quote
Well do not even know can help CrazyBooy think so but it is unlikely he will be online

old Re: Anti flash

Alistaire
User Off Offline

Quote
You can't make a flashbang not flash persons. You could check for people in range of the flashbang and flash them seperately with flashplayer, and leave the people with the Flasher class, or only leave the thrower of the flashbang.

EDIT: There's an easier way:
1
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.

old Re: Anti flash

Alistaire
User Off Offline

Quote
user ohaz has written
Add a if query that checks if the "id" has the class Flasher @user BestMan:


I assumed only flashers had access to flash grenades. If this isn't the case you should know what to do.

old Re: Anti flash

VADemon
User Off Offline

Quote
@user 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.

old Re: Anti flash

Alistaire
User Off Offline

Quote
user VADemon has written
@user 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.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview