Raised This Month: $ Target: $400
 0% 

Weaponbox Data


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Phant
Veteran Member
Join Date: Sep 2009
Location: New Jersey
Old 11-16-2013 , 04:17   Re: Weaponbox Data
Reply With Quote #1

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
 
#define PLUGIN "Test"
#define VERSION "0.0"
#define AUTHOR "KORD_12.7"
 
#define IsValidPev(%0) (pev_valid(%0) == 2)
 
#define m_rgpPlayerItems_CWeaponBox 34
 
public plugin_init()
{
        
register_plugin(PLUGINVERSIONAUTHOR)
       
        
RegisterHam(Ham_Spawn"weaponbox""Weaponbox_Spawn_Post"true);
        
register_forward(FM_SetModel"FakeMeta_SetModel"false);
       
        
state WeaponBox_Disabled;
}
 
public 
Weaponbox_Spawn_Post(const iWeaponBox)
{
        if (
IsValidPev(iWeaponBox))
        {
                
state (IsValidPev(pev(iWeaponBoxpev_owner))) WeaponBox_Enabled;
        }
       
        return 
HAM_IGNORED;
}
 
public 
FakeMeta_SetModel(const iEntity) <WeaponBox_Enabled>
{
        
state WeaponBox_Disabled;
       
        if (!
IsValidPev(iEntity))
        {
                return 
FMRES_IGNORED;
        }
       
        
#define MAX_ITEM_TYPES  6
       
        
for (new iiItemMAX_ITEM_TYPESi++)
        {
                
iItem get_pdata_cbase(iEntitym_rgpPlayerItems_CWeaponBox i4);
               
                if (
IsValidPev(iItem/* && needed weapon check */)
                {
                        
//engfunc(EngFunc_SetModel, iEntity, "MY_MODEL.mdl");
                        
return FMRES_SUPERCEDE;
                }
        }
       
        return 
FMRES_IGNORED;
}
 
public 
FakeMeta_SetModel(const iEntity) <WeaponBox_Disabled>
{
        return 
FMRES_IGNORED;

Code by (thanks to) KORD_12.7.
Phant is offline
Send a message via ICQ to Phant
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-16-2013 , 12:03   Re: Weaponbox Data
Reply With Quote #2

SetModel is sent twice on weaponbox
When weaponbox is spawned, you can't retrieve storage and model.

What you can do without hooking weaponbox spawn is :

On SetModel, check if entity class is "weaponbox", and check is model is not weaponbox.mdl, then you can work on that weaponx and its pdatas.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 23:17.


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