AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Events request [SOLVED!] (https://forums.alliedmods.net/showthread.php?t=76618)

anakin_cstrike 08-27-2008 12:40

Events request [SOLVED!]
 
Hi.
I need an event when a player drops a weapon.
Thanks:)

Arkshine 08-27-2008 12:54

Re: Events request
 
Hooking 'drop' command ?

anakin_cstrike 08-27-2008 13:00

Re: Events request
 
Quote:

Originally Posted by arkshine (Post 676727)
Hooking 'drop' command ?

I want to check the 'entity' droped...if is not a grenade for example..read_data(2) ?

Alka 08-27-2008 15:35

Re: Events request
 
register_forward(FM_SetModel, "fwd_SetModel", 0) - Hook when a model is spawned, check if model contains weapon/... and you can make an extra check, classname, weaponbox.

anakin_cstrike 08-27-2008 16:05

Re: Events request
 
Quote:

Originally Posted by Alka (Post 676838)
register_forward(FM_SetModel, "fwd_SetModel", 0) - Hook when a model is spawned, check if model contains weapon/... and you can make an extra check, classname, weaponbox.

I know...but how to check the weapon droped ?

PrEn1umz 08-27-2008 21:23

Re: Events request
 
not sure.

Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    register_plugin("Drop Weapon Catcher", "0.1.a", "PrEn1umz");
    register_forward(FM_SetModel, "Forward_SetModel");
}

public Forward_SetModel(id, model[])
{   
    if (!pev_valid(id) || !strlen(model))
        return;
   
    static szClassname[33];
    pev(id, pev_classname, szClassname, 32);
}


anakin_cstrike 08-27-2008 21:34

Re: Events request
 
@ PrEn1umz : it's something like this:
PHP Code:

public fw_setmodel(ent,const model[])
{
    if(!
pev_valid(ent))
        return 
FMRES_IGNORED;
    static 
classname[32]
    
pev(ent,pev_classname,classname,31);
    if(!
strcmp(classname"weaponbox") || !strcmp(classname"armoury_entity") || !strcmp(classname"grenade"))
    {
        
// change model
        
return FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;


but is not what i'm looking for...i want an event/function when a player has drop a weapon...and check if the weapon is x for example.

danielkza 08-27-2008 22:22

Re: Events request
 
HamSandwich - Ham_Item_Drop - Look at includes\ham_const.inc

Alka 08-28-2008 02:42

Re: Events request
 
Oh gawd anakin, look here -> http://forums.alliedmods.net/showthr...ghlight=weapon like i said.

anakin_cstrike 08-28-2008 03:35

Re: Events request
 
I know, i know..:oops: thank you.


All times are GMT -4. The time now is 04:11.

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