Raised This Month: $ Target: $400
 0% 

entity does not apear


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
man_s_our
Senior Member
Join Date: Jul 2017
Location: aim_taliban
Old 04-10-2018 , 17:08   entity does not apear
Reply With Quote #1

I edited the backweapons plugin so that it will be compatible with the custom weapons and models.
but the backweapon ent does not apear, what's wrong with this code?
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <engine>


#define PLUGIN    "Back Weapons"
#define AUTHOR    "hoboman313/cheap_suit"
#define VERSION    "1.87"

#define MAX_PLAYERS         32
#define OFFSET_PRIMARYWEAPON     116
#define OFFSET_WEAPONTYPE     43
#define EXTRAOFFSET_WEAPONS     4
#define OFFSET_AUTOSWITCH     509
#define OFFSET_SHIELD         510
#define HAS_SHIELD         (1<<24)

#define PRIMARY_WEAPONS (1<<CSW_SCOUT | 1<<CSW_XM1014 | 1<<CSW_MAC10 | 1<<CSW_AUG | 1<<CSW_UMP45 | 1<<CSW_SG550 | 1<<CSW_GALIL | 1<<CSW_FAMAS | 1<<CSW_AWP | 1<<CSW_MP5NAVY | 1<<CSW_M249 | 1<<CSW_M3 | 1<<CSW_M4A1 | 1<<CSW_TMP | 1<<CSW_G3SG1 | 1<<CSW_SG552 | 1<<CSW_AK47 | 1<<CSW_P90)

#define is_weapon_primary(%1)      (PRIMARY_WEAPONS & (1<<%1))
#define cs_get_weapon_type(%1)     get_pdata_int(%1, OFFSET_WEAPONTYPE, EXTRAOFFSET_WEAPONS)
#define cs_get_user_hasprim(%1)    get_pdata_int(%1, OFFSET_PRIMARYWEAPON)
#define cs_get_user_autoswitch(%1) get_pdata_int(%1, OFFSET_AUTOSWITCH)
#define cs_get_user_shield(%1)       (get_pdata_int(%1, OFFSET_SHIELD) & HAS_SHIELD) ? 1 : 0

new g_weapons[][] =
{    
    
"weapon_p228",
    
"weapon_scout",
    
"weapon_hegrenade",
    
"weapon_xm1014",
    
"weapon_c4",
    
"weapon_mac10",
    
"weapon_aug",
    
"weapon_smokegrenade",
    
"weapon_elite",
    
"weapon_fiveseven",
    
"weapon_ump45",
    
"weapon_sg550",
    
"weapon_galil",
    
"weapon_famas",
    
"weapon_usp",
    
"weapon_glock18",
    
"weapon_awp",
    
"weapon_mp5navy",
    
"weapon_m249",
    
"weapon_m3",
    
"weapon_m4a1",
    
"weapon_tmp",
    
"weapon_g3sg1",
    
"weapon_flashbang",
    
"weapon_deagle",
    
"weapon_sg552",
    
"weapon_ak47",
    
"weapon_knife",
    
"weapon_p90"
}

new 
g_weaponent[MAX_PLAYERS+1]
new 
lastwep[MAX_PLAYERS+1]
public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar(PLUGINVERSIONFCVAR_SPONLY|FCVAR_SERVER)
    
    
RegisterHam(Ham_Killed,           "player""bacon_killed")
    
RegisterHam(Ham_Spawn,            "player""bacon_spawn_post"1)
    
RegisterHam(Ham_AddPlayerItem,    "player""bacon_addplayeritem")
    
RegisterHam(Ham_RemovePlayerItem"player""bacon_removeplayeritem")
    
    for(new 
0sizeof g_weaponsi++)
    {
        
RegisterHam(Ham_Item_AttachToPlayerg_weapons[i], "bacon_item_attachtoplayer_post"1)
        
RegisterHam(Ham_Item_Deploy,         g_weapons[i], "bacon_item_deploy_post",         1)
    }
}

public 
client_disconnect(id)
{
    if(
g_weaponent[id] > && pev_valid(g_weaponent[id]))
        
engfunc(EngFunc_RemoveEntityg_weaponent[id])
    
    
g_weaponent[id] = 0
}
backwep(idmodel[])
{    
    
g_weaponent[id] = create_entity("info_target");
    if(
pev_valid(g_weaponent[id]))
    {
        
set_pev(g_weaponent[id], pev_modelmodel)
        
set_pev(g_weaponent[id], pev_classname"backweapon")
        
set_pev(g_weaponent[id], pev_movetypeMOVETYPE_FOLLOW)
        
set_pev(g_weaponent[id], pev_effectsEF_NODRAW)
        
set_pev(g_weaponent[id], pev_aimentid)
    }
}
public 
bacon_killed(ididattackershouldgib)
    
fm_set_entity_visibility(g_weaponent[id], 0)

public 
bacon_addplayeritem(ident)
{
    static 
weaponidweaponid cs_get_weapon_type(ent)
    if(
is_weapon_primary(weaponid) && pev_valid(g_weaponent[id]) && lastwep[id] != weaponid)
    {
        
lastwep[id] = weaponid;
        static 
wepmodel[32];
        
pev(idpev_weaponmodelwepmodelsizeof(wepmodel));
        
remove_entity(g_weaponent[id])
        
backwep(idwepmodel);
        
fm_set_entity_visibility(g_weaponent[id], 0);
    }
    else if(
is_weapon_primary(weaponid) && pev_valid(g_weaponent[id]))
        
fm_set_entity_visibility(g_weaponent[id], 0);
    else if(
is_weapon_primary(weaponid))
    {
        
lastwep[id] = weaponid;
        static 
wepmodel[32];
        
pev(idpev_weaponmodelwepmodelsizeof(wepmodel));
        
backwep(idwepmodel);
        
fm_set_entity_visibility(g_weaponent[id], 0);
    }
}

public 
bacon_removeplayeritem(ident)
{
    if(
is_weapon_primary(cs_get_weapon_type(ent)) && pev_valid(g_weaponent[id]))
        
fm_set_entity_visibility(g_weaponent[id], 0)
}

public 
bacon_spawn_post(id) if(is_user_alive(id))
{
    if(!
cs_get_user_hasprim(id))
        
fm_set_entity_visibility(g_weaponent[id], 0)
}

public 
bacon_item_attachtoplayer_post(entid) if(is_user_alive(id) && !cs_get_user_autoswitch(id))
{
    if(
is_weapon_primary(cs_get_weapon_type(ent)) && pev_valid(g_weaponent[id]))
        
fm_set_entity_visibility(g_weaponent[id], 1)
}

public 
bacon_item_deploy_post(ent)
{
    static 
idid pev(entpev_owner)
    if(
is_user_alive(id)) 
    {
        static 
weaponweapon cs_get_weapon_type(ent)
        if(
is_weapon_primary(weapon) || cs_get_user_shield(id))
            
fm_set_entity_visibility(g_weaponent[id], 0)
        
        else if(
cs_get_user_hasprim(id))
            
fm_set_entity_visibility(g_weaponent[id], 1)
    }
}

stock fm_set_entity_visibility(indexvisible 1
    
set_pev(indexpev_effectsvisible == pev(indexpev_effects) & ~EF_NODRAW pev(indexpev_effects) | EF_NODRAW
__________________
man_s_our 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 19:53.


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