Raised This Month: $12 Target: $400
 3% 

[CS:S] Flashbang Tools


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 06-22-2011 , 20:08   [CS:S] Flashbang Tools
Reply With Quote #1

This extension adds some useful forwards sourcepawn for flashbangs. Ive had it for a very long time. But found it mostly useless to me and thought others would find it useless as well (It was originally for learning). But recently I've noticed people trying to do things with flashbangs. Removing the sound when you are flashed. Grabbing info when it detonates etc... So I decided to release it.

Note: I only tested in windows. It was a rather rushed release everything still compiled the signatures for windows were correct.

Forwards:
PHP Code:
/**
* @param client        Client index
* @param distance    How far the flash is from the player which will effect the volume and length of the "deafen"

* @return             Plugin_Handled or higher to block. Plugin_Changed if distance was changed. Plugin_Continue to ignore.
*  
*/
forward Action:OnDeafen(client, &Float:distance);

/**
* @param entity        The flashbang entity

* @return             Plugin_Handled or higher to block. Anything else to ignore
*  
*/
forward Action:OnFlashDetonate(entity);

/**
* @param client        Client index
* @param entity        The flashbang entity
* @param pos        The position vector of the flashbang
* @param percent    The percent?

* @return             Plugin_Handled or higher to ignore player. Plugin_Changed if percent was changed. Plugin_Continue to ignore 

*/
forward Action:OnGetPercentageOfFlashForPlayer(cliententityFloat:pos[3], &Float:percent); 
I have no clue how the percent for OnGetPercentageOfFlashForPlayer works. I tried changing it and couldn't notice any changes (its been awhile since i tried) but you can try it

Example:
PHP Code:
#include <sourcemod>
#include <flashtools>

public Action:OnDeafen(client, &Float:distance)
{
    
//Dont "Deafen" anyone
    
return Plugin_Handled;
}
public 
Action:OnGetPercentageOfFlashForPlayer(cliententityFloat:pos[3], &Float:percent)
{
    new 
owner GetEntPropEnt(entityProp_Send"m_hOwnerEntity");
    new 
team GetClientTeam(client);
    new 
team2 GetClientTeam(owner);
    
//Dont team flash but flash the owner
    
if(team == team2 && owner != client)
    {
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;
}
public 
Action:OnFlashDetonate(entity)
{
    new 
bool:cookies false;
    
    
//Stop Detonate
    
if(cookies)
        return 
Plugin_Handled;
    
    return 
Plugin_Continue;
    

I couldn't think of anything useful for OnFlashDetonate i guess its useful for getting info from the flashbang or stopping one from detonating for some reason.

You only need flashbang-tools.zip for most stuff unless you need to recompile.
Attached Files
File Type: zip flashbang-tools-src.zip (24.6 KB, 1907 views)
File Type: zip flashtools-0.0.3.zip (57.1 KB, 2957 views)

Last edited by Dr!fter; 08-16-2012 at 12:32.
Dr!fter is offline
nightrider
SourceMod Donor
Join Date: Dec 2008
Old 06-22-2011 , 21:47   Re: [CS:S] Flashbang Tools
Reply With Quote #2

Interesting, thank you for sharing.
__________________
[SIGPIC][/SIGPIC] the pantless
I am the Night Rider!, I'm a fuel-injected suicide machine.
I am a rocker! I am a roller!, I am an out-of-controller!


nightrider is offline
away000
Veteran Member
Join Date: Sep 2010
Old 06-22-2011 , 21:53   Re: [CS:S] Flashbang Tools
Reply With Quote #3

I hope this will open some ways to developers =D Great job man....
away000 is offline
Despirator
Senior Member
Join Date: Jun 2011
Location: Kazakhstan ->Shymkent
Old 06-23-2011 , 01:20   Re: [CS:S] Flashbang Tools
Reply With Quote #4

awesome, thank you. I'll try

you forgot attach the include file

Edit:
It works very well, I was looking for it long time

Edit:
Found another way to stop a flash beep sound http://forums.alliedmods.net/showthread.php?p=1493993

Last edited by Despirator; 06-24-2011 at 10:55. Reason: removed attach
Despirator is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 06-23-2011 , 03:54   Re: [CS:S] Flashbang Tools
Reply With Quote #5

Wierd...
PHP Code:
forward Action:OnDeafen(client, &Float:time); 
the further away flashbang explode, time is much bigger than flashbang what explode on your feet.
Hope I explained it well

*edit
It measure like range ?

Last edited by Bacardi; 06-23-2011 at 03:58.
Bacardi is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 06-23-2011 , 09:44   Re: [CS:S] Flashbang Tools
Reply With Quote #6

Quote:
Originally Posted by Bacardi View Post
Wierd...
PHP Code:
forward Action:OnDeafen(client, &Float:time); 
the further away flashbang explode, time is much bigger than flashbang what explode on your feet.
Hope I explained it well

*edit
It measure like range ?
Ill have a look it might be wrong. I a) didn't really care what they were and didn't look into it much before. b) assumed things. So ill have a look.
Dr!fter is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 06-23-2011 , 10:06   Re: [CS:S] Flashbang Tools
Reply With Quote #7

Ok, but I start use that like measure now and works great.
Bacardi is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 06-23-2011 , 10:52   Re: [CS:S] Flashbang Tools
Reply With Quote #8

Quote:
Originally Posted by Bacardi View Post
Ok, but I start use that like measure now and works great.
Indeed it looks like it is distance. It checks if the distance is within a radius then "deafens" accordingly.

From IDA:
PHP Code:
v6 134;
v4 a2;
if ( 
a2 <= 600.0 || (v6 135v4 <= 800.0) || (v6 136v4 <= 1000.0) ) 
So anything less than 600 has the highest deafen anything over 1000 units away doesn't deafen.

I also had a look at the percentage thing it seems it just returns 1.0 if the player will be blind and returns 0.0 if they will not be.

I updated the include file and changed the extension source code to change that time for OnDeafen is actually distance. Thanks for pointing it out. I also attached the inc file its in the main zip.
Dr!fter is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 06-23-2011 , 13:59   Re: [CS:S] Flashbang Tools
Reply With Quote #9

goood...
Bacardi is offline
FlexXx
New Member
Join Date: Oct 2011
Old 10-28-2011 , 11:08   Re: [CS:S] Flashbang Tools
Reply With Quote #10

is it possible to change the collision of the flash ?
cause they collide with other people but not with yourself and i want to also collide it with myself.
would be nice if someone can help me.
FlexXx is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode