Raised This Month: $ Target: $400
 0% 

Hooking player actions (+reload, +attack2, etc)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Mitchell
~lick~
Join Date: Mar 2010
Old 04-07-2014 , 16:38   Re: Hooking player actions (+reload, +attack2, etc)
Reply With Quote #10

I dont under stand how it's expensive to use OnPlayerRunCmd?
something like this to make a toggle command:
Code:
public Action:OnPlayerRunCmd(iClient, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
	if (!IsClientConnected(iClient) || !IsClientInGame(iClient) || !IsPlayerAlive(iClient)) return Plugin_Continue;
	static bool:bIsInAttack[MAXPLAYERS+1];
	if (!bIsInAttack[iClient] && buttons & IN_ATTACK)
	{
		bIsInAttack[iClient] = true;
		SomeOtherFunction(iClient);
	}
	else
	{
		bIsInAttack[iClient] = false;
	}
	return Plugin_Continue;
}
bit tired so it might be wrong

Last edited by Mitchell; 04-07-2014 at 16:49.
Mitchell is offline
 



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 13:10.


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