English Anti flash

7 replies
Goto Page
To the start Previous 1 Next To the start
14.02.14 08:51:00 pm
Up
BestMan
User
Offline Off
Hi. I creating new script, and i can't create anti flash system for class "Flasher". Somebody can help me?
IMG:http://gs4u.net/350x20/cs2d/80.72.36.58:41038.png
14.02.14 09:12:47 pm
Up
JOJ
User
Offline Off
Well do not even know can help CrazyBooy think so but it is unlikely he will be online
14.02.14 09:31:22 pm
Up
Alistaire
User
Offline Off
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:
Code:
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.
IMG:http://i.imgur.com/5zhwOTP.png
14.02.14 09:47:56 pm
Up
BestMan
User
Offline Off
@user Alistaire: I used this and now all classes have it
IMG:http://gs4u.net/350x20/cs2d/80.72.36.58:41038.png
14.02.14 09:49:44 pm
Up
ohaz
User
Offline Off
Add a if query that checks if the "id" has the class Flasher @user BestMan:
https://ohaz.engineer - Software Engineering
14.02.14 09:56:39 pm
Up
Alistaire
User
Offline Off
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.
IMG:http://i.imgur.com/5zhwOTP.png
14.02.14 10:24:48 pm
Up
VADemon
User
Offline Off
@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.
14.02.14 10:44:28 pm
Up
Alistaire
User
Offline Off
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.
IMG:http://i.imgur.com/5zhwOTP.png
To the start Previous 1 Next To the start