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

Get player and weapon id in WeapPickup Event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cuttlas
Senior Member
Join Date: Jan 2015
Old 12-26-2023 , 00:01   Get player and weapon id in WeapPickup Event
Reply With Quote #1

register_event("WeapPickup", "weapon_pickup", "b");

how to get a player and weapon ID in the WeapPickup Event?

public weapon_pickup( iEntity )

what is iEntity? I tested it as player ID, but with no success, I tested it as weapon ID and tried to get the player ID like this: new id = pev( iEntity , pev_owner ); no success.

thank you, brothers
__________________
To Infinity n Beyond

Last edited by Cuttlas; 12-26-2023 at 02:33.
Cuttlas is offline
WATCH_D0GS UNITED
Senior Member
Join Date: Jan 2023
Old 12-26-2023 , 06:44   Re: Get player and weapon id in WeapPickup Event
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <fakemeta>

new Weapon[32]

public 
plugin_init()
{
    
register_plugin("On_Show_Weapon_Icon","1.0","N/A")
    
register_event("WeapPickup","Event_WeapPickup","b")
}

public 
Event_WeapPickup(const id)
{
    
// Called when picking up a dropped weapon
    // Called when purchasing a weapon
    // NOT called when switching weapons

    
Weapon[id] = read_data(1)
    
client_print(id,print_chat,"%d",Weapon[id])

__________________
💻Know Our New Blog👄
🔗tube2downs.blogspot.com
WATCH_D0GS UNITED is offline
Old 12-26-2023, 07:09
Cuttlas
This message has been deleted by Cuttlas.
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-26-2023 , 08:16   Re: Get player and weapon id in WeapPickup Event
Reply With Quote #3

Quote:
Originally Posted by WATCH_D0GS UNITED View Post
PHP Code:
#include <amxmodx>
#include <fakemeta>

new Weapon[32]

public 
plugin_init()
{
    
register_plugin("On_Show_Weapon_Icon","1.0","N/A")
    
register_event("WeapPickup","Event_WeapPickup","b")
}

public 
Event_WeapPickup(const id)
{
    
// Called when picking up a dropped weapon
    // Called when purchasing a weapon
    // NOT called when switching weapons

    
Weapon[id] = read_data(1)
    
client_print(id,print_chat,"%d",Weapon[id])

Player indexes can be from 1 to 32 (assuming a 32-slot server). Indexing the Weapon array with id = 32 will cause an index out-of-bounds error. Weapon should have size 33, not 32.
__________________

Last edited by HamletEagle; 12-26-2023 at 08:16.
HamletEagle is offline
Old 12-26-2023, 08:56
WATCH_D0GS UNITED
This message has been deleted by WATCH_D0GS UNITED.
Old 12-26-2023, 09:03
WATCH_D0GS UNITED
This message has been deleted by WATCH_D0GS UNITED. Reason: forget
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 11:36.


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