AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [CS:S] Flashbang Tools (https://forums.alliedmods.net/showthread.php?t=159876)

Dr!fter 06-22-2011 20:08

[CS:S] Flashbang Tools
 
2 Attachment(s)
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 :P

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.

nightrider 06-22-2011 21:47

Re: [CS:S] Flashbang Tools
 
Interesting, thank you for sharing.

away000 06-22-2011 21:53

Re: [CS:S] Flashbang Tools
 
I hope this will open some ways to developers =D Great job man....

Despirator 06-23-2011 01:20

Re: [CS:S] Flashbang Tools
 
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

Bacardi 06-23-2011 03:54

Re: [CS:S] Flashbang Tools
 
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 ?

Dr!fter 06-23-2011 09:44

Re: [CS:S] Flashbang Tools
 
Quote:

Originally Posted by Bacardi (Post 1493976)
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.

Bacardi 06-23-2011 10:06

Re: [CS:S] Flashbang Tools
 
Ok, but I start use that like measure now and works great.

Dr!fter 06-23-2011 10:52

Re: [CS:S] Flashbang Tools
 
Quote:

Originally Posted by Bacardi (Post 1494158)
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.

Bacardi 06-23-2011 13:59

Re: [CS:S] Flashbang Tools
 
goood... http://avatar.hq-picture.com/avatars...ture_11168.jpg

FlexXx 10-28-2011 11:08

Re: [CS:S] Flashbang Tools
 
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.


All times are GMT -4. The time now is 07:03.

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