View Single Post
Author Message
JuanitoAlimana
Senior Member
Join Date: Aug 2021
Old 07-20-2023 , 21:59   Reapi Weapon Models
Reply With Quote #1

Hello. I've recently started using this weapon models replacement plugin but I can't seem to manage to make it so only users with ADMIN_LEVEL_A can use the skins. I'm not that familiar with ReAPI and everytime I try I get "Invalid player" errors and stuff. Here's the code.

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

#define PLUGIN  "[Reapi] Replace Weapon Models"
#define VERSION "1.0"
#define AUTHOR  "[N]drs"

#define rg_get_weapon_id(%0) get_member(get_member(get_member(%0, m_pPlayer), m_pActiveItem), m_iId)

new const szV_Model[] = "models/custom/v_usp.mdl"
new const szP_Model[] = "models/custom/p_usp.mdl"


public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHookChain(RG_CBasePlayerWeapon_DefaultDeploy"OnPlayerChangeWeapon_Pre"false)
}

public 
plugin_precache()
{
    
precache_model(szV_Model)
    
precache_model(szP_Model)
}

public 
OnPlayerChangeWeapon_Pre(const iEntityszViewModel[], szWeaponModel[])
{
    switch(
rg_get_weapon_id(iEntity))
    {
        case 
CSW_USP:
        {
            
SetHookChainArg(2ATYPE_STRINGszV_Model)
            
SetHookChainArg(3ATYPE_STRINGszP_Model)
        }
    }

    return 
HC_CONTINUE

If you guys can help me out, I will be extremely happy. Thanks!
JuanitoAlimana is online now