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(client, entity, Float: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(client, entity, Float:pos[3], &Float:percent)
{
new owner = GetEntPropEnt(entity, Prop_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.