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

[CSS] - How to detect when a player drops a weapon?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Remy Lebeau
Senior Member
Join Date: Dec 2009
Location: Sydney, Australia
Old 11-15-2012 , 17:19   [CSS] - How to detect when a player drops a weapon?
Reply With Quote #1

Hi all,

I've been trying to work out how to detect when a player drops a weapon. I can't find any particular event that I can hook onto to determine this.

Any help appreciated!
Remy Lebeau is offline
Remy Lebeau
Senior Member
Join Date: Dec 2009
Location: Sydney, Australia
Old 11-15-2012 , 17:26   Re: [CSS] - How to detect when a player drops a weapon?
Reply With Quote #2

don't mind me. CS_OnCSWeaponDrop seems to be the way to go
Remy Lebeau is offline
Remy Lebeau
Senior Member
Join Date: Dec 2009
Location: Sydney, Australia
Old 11-15-2012 , 18:56   Re: [CSS] - How to detect when a player drops a weapon?
Reply With Quote #3

ok, so I'm using:

Code:
public Action:CS_OnCSWeaponDrop(client, weaponIndex)
{
	if(weaponIndex == 0)
	{
		new String:NameNaughty[64];
		GetClientName( client, NameNaughty, 64 );
		PrintToChatAll("%f Has been a naughty wisp!  They shall no longer be hidden", NameNaughty);
		ServerCommand( "sm_beacon #%d 1", GetClientUserId( client ) );
		War3_SetBuff(client,fInvisibilitySkill,thisRaceID, 1.0);
	}
}
(Don't worry about the war3 stuff) - I'm trying to catch when a player drops a USP specifically ... The information I've been able to find suggests that USP should be weaponIndex 0 (in fact, when I tested it, dropping a USP returns a weaponIndex of 0), however this code doesn't seem to catch players who drop a USP.

Ideas?

Last edited by Remy Lebeau; 11-15-2012 at 19:23.
Remy Lebeau is offline
minimoney1
SourceMod Donor
Join Date: Dec 2010
Old 11-15-2012 , 20:02   Re: [CSS] - How to detect when a player drops a weapon?
Reply With Quote #4

Quote:
Originally Posted by Remy Lebeau View Post
ok, so I'm using:

Code:
public Action:CS_OnCSWeaponDrop(client, weaponIndex)
{
	if(weaponIndex == 0)
	{
		new String:NameNaughty[64];
		GetClientName( client, NameNaughty, 64 );
		PrintToChatAll("%f Has been a naughty wisp!  They shall no longer be hidden", NameNaughty);
		ServerCommand( "sm_beacon #%d 1", GetClientUserId( client ) );
		War3_SetBuff(client,fInvisibilitySkill,thisRaceID, 1.0);
	}
}
(Don't worry about the war3 stuff) - I'm trying to catch when a player drops a USP specifically ... The information I've been able to find suggests that USP should be weaponIndex 0 (in fact, when I tested it, dropping a USP returns a weaponIndex of 0), however this code doesn't seem to catch players who drop a USP.

Ideas?
The weapon index is specifically (I believe) the entity index of the weapon that's dropped. You need to do something like GetEntityClassname() and check if it's "weapon_usp". That way you can tell if it's a USP or not.
__________________
Need help? PM me or add me on Steam.
My Steam




Quote:
Originally Posted by Rp.KryptoNite View Post
For some reason his Plugin never worked for me ,
@credits were added
im not stealing any plugins dude its my THING
minimoney1 is offline
Remy Lebeau
Senior Member
Join Date: Dec 2009
Location: Sydney, Australia
Old 11-16-2012 , 00:26   Re: [CSS] - How to detect when a player drops a weapon?
Reply With Quote #5

Fantastic - that was exactly it. Thanks!
Remy Lebeau is offline
Reply



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 05:42.


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