Raised This Month: $32 Target: $400
 8% 

[CS:S] Player pick-up weapon event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gecko
SourceMod Donor
Join Date: Nov 2010
Location: Vancouver, Canada
Old 05-24-2013 , 00:04   [CS:S] Player pick-up weapon event
Reply With Quote #1

I'm trying to hook into an Event that occurs when a player picks up a weapon. Is there any event that exists for something like this?

EDIT: Oops, I was looking at the Generic Source events, should've been looking at the CS:S events.
__________________
"My brain is so left-sided, it isn't even funny... at all."

Last edited by Gecko; 05-24-2013 at 00:09.
Gecko is offline
exCeeder.
Junior Member
Join Date: May 2013
Location: .
Old 05-31-2013 , 14:39   Re: [CS:S] Player pick-up weapon event
Reply With Quote #2

PHP Code:
public OnPluginStart()
{
    
HookEvent("item_pickup"OnItemPickup);
}


public 
Action:OnItemPickup(Handle:event, const String:name[], bool:dontBroadcast)
{
    
/* Your code here */

You have two variants to get their weapons:
PHP Code:
    new client GetClientOfUserId(GetEventInt(event"userid"));

    
/* Variant 1 */
    /* Print weaponname without "weapon_" */
    
new String:ItemName[32];
    
GetEventString(event,"item",ItemName,sizeof(ItemName));
    
    
PrintToChat(client,"item: %s"ItemName);
    
    
/* Variant 2 */
    /* Print weaponname with "weapon_" */
    
new String:sWeapon[32];
    
GetClientWeapon(clientsWeaponsizeof(sWeapon));
    
    
PrintToChat(client,"weapon: %s"sWeapon); 
__________________
Best regards,
eXceeder

Last edited by exCeeder.; 05-31-2013 at 16:14.
exCeeder. is offline
El Curioso
Member
Join Date: Nov 2013
Location: Spain
Old 06-15-2014 , 16:38   Re: [CS:S] Player pick-up weapon event
Reply With Quote #3

Perfect exCeeder.

Exactly what I was looking for, big THX!
El Curioso 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 17:46.


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