Quote:
Originally Posted by hmmmmm
PHP Code:
public Action OnPlayerRunCmd(int client, int& buttons)
{
int pressedButtons = GetEntProp(client, Prop_Data, "m_afButtonPressed");
if(pressedButtons & IN_ATTACK2)
{
//Code
}
return Plugin_Continue;
}
This would tell you when +attack2 was initially pressed. The prop exists in CS:GO, you'll have to check if it exists in CS:S. If not you can always just keep track of last buttons to find out when the button is pressed.
EDIT: After thinking about it this might not be the most accurate method since clicking the button might not always correspond to the secondary attack happening, might need a different method.
|
This might be a longshot but.
Is the button press in the same gameframe of the sound being emitted?
if so we can use the button press to determine which attack is being performed?
example in my own way
[Framestart]
OnPlayerRunCmd
Source Processing buttons
Starts attack
SoundHook checks
SoundEmitted
[frameend]
it maywork.
Quote:
Originally Posted by Komodo3000
@Lux
You mean hooking the swing sound of knife attack? That actually would be possible but i never used this method. Where do i get the path of the swing sound?
|
Its in old syntax sorry i prefer it.
PHP Code:
public OnPluginStart()
{
AddNormalSoundHook(SoundHook);
}
public Action:SoundHook(iClients[64], &iNumClients, String:sSampleFile[PLATFORM_MAX_PATH], &iEntity, &iChannel, &Float:fVolume, &fLevel, &iPitch, &iFlags)
{
//checks for sounds
//Note besure to optimize heavily this will forward all sounds that are emitted!
//like storing ent refs of already checked entitys that are not knife or client
}
I'm not a css coder so its just a shot in the dark of how i would go about doing it in l4d2
hope this helps
__________________