AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [CS:S] Player pick-up weapon event (https://forums.alliedmods.net/showthread.php?t=216661)

Gecko 05-24-2013 00:04

[CS:S] Player pick-up weapon event
 
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.

exCeeder. 05-31-2013 14:39

Re: [CS:S] Player pick-up weapon event
 
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); 


El Curioso 06-15-2014 16:38

Re: [CS:S] Player pick-up weapon event
 
Perfect exCeeder.

Exactly what I was looking for, big THX!


All times are GMT -4. The time now is 14:28.

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