View Single Post
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 09-04-2022 , 07:01   Re: SideWeapons v0.2 [CS/CZ]
Reply With Quote #13

Quote:
Originally Posted by SoulWeaver16 View Post
ok, i'll take a look at it later

Edit: I checked the page, but something that seems to be a problem and which seemed strange to me not seeing that plugin here is in the same requirements:
"Requirements: ReGameDLL, ReAPI"
There is no support here for that type of plugin, it seems to me
And it doesn't even allow its download, or at least, I don't see a valid link
Got you sir
Then I will send you a version in a regular copy a little later - without Reapi

Edit:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <engine>

const GRENADES_BIT_SUM = ((<< any:CSW_HEGRENADE) | (<< any:CSW_SMOKEGRENADE) | (<< any:CSW_FLASHBANG))

#define IsPlayer(%1)                (1 <= %1 <= MaxClients)
#define IsGrenadeWeaponID(%1)         (GRENADES_BIT_SUM & (1 << any:%1))

enum any:BW_CONTROLLERS
{
    
BW_CONTROLLER_DISTANCE,
    
BW_CONTROLLER_HEIGHT,
    
BW_CONTROLLER_SLOPE,
    
BW_CONTROLLER_ANGLE
}

enum any:BW_STYLES
{
    
BW_STYLE1,
    
BW_STYLE2
}

enum bw_player_models_s szPlayerModel[32], iStyleaStyle1[BW_CONTROLLERS], aStyle2[BW_CONTROLLERS] }

new const 
BW_MODEL_NAME[] = "models/backweapons_classic/backweapons_classic.mdl"
new const BW_MODEL_DEFAULT_POS[BW_CONTROLLERS] = { 151510160 }

new const 
PLAYER_MODEL_LIST[][bw_player_models_s] =
{
    
// "modelname", style, { distance(0~40), height(-5~50), slope(-5~90), angle(0~360) } }

    
"sas_classic",            BW_STYLE1,    { 4154510 }, { 15330160 } },
    { 
"gign_classic",        BW_STYLE1,    { 4154510 }, { 12330160 } },
    { 
"gsg9_classic",        BW_STYLE1,    { 4154510 }, { 17330160 } },
    { 
"urban_classic",        BW_STYLE1,    { 4154510 }, { 11330160 } },

    { 
"terror_classic",        BW_STYLE1,    { 4154510 }, { 13330160 } },
    { 
"leet_classic",        BW_STYLE1,    { 4154510 }, { 20330160 } },
    { 
"guerillaclassic",        BW_STYLE1,    { 15154510 }, { 16330160 } },
    { 
"arctic_classic",        BW_STYLE1,    { 4154510 }, { 5,  330160 } }
}

new const 
BW_MODEL_BODY_INDEX[any:CSW_P90 1] =
{
    
0//
    
0// WEAPON_P228
    
0//
    
10,// WEAPON_SCOUT
    
0// WEAPON_HEGRENADE
    
11,// WEAPON_XM1014
    
0// WEAPON_C4
    
18,// WEAPON_MAC10
    
1// WEAPON_AUG
    
0// WEAPON_SMOKEGRENADE
    
0// WEAPON_ELITE
    
0// WEAPON_FIVESEVEN
    
16,// WEAPON_UMP45
    
8// WEAPON_SG550
    
6// WEAPON_GALIL
    
15,// WEAPON_FAMAS
    
0// WEAPON_USP
    
0// WEAPON_GLOCK18
    
3// WEAPON_AWP
    
4// WEAPON_MP5NAVY
    
14,// WEAPON_M249
    
12,// WEAPON_M3
    
7// WEAPON_M4A1
    
17,// WEAPON_TMP
    
13,// WEAPON_G3SG1
    
0// WEAPON_FLASHBANG
    
0// WEAPON_DEAGLE
    
9// WEAPON_SG552
    
2// WEAPON_AK47
    
0// WEAPON_KNIFE
    
5  // WEAPON_P90
}

new 
Trie:g_tCachedModels

public plugin_init()
{
    
register_plugin("BackWeapons CLASSIC""1.0""Vaqtincha")
    
    for (new 
any:iId CSW_P228szWeaponName[32]; iId <= CSW_P90iId++)
    {
        if (
get_weaponname(iIdszWeaponNamecharsmax(szWeaponName)))
        {
            if (
BW_MODEL_BODY_INDEX[iId] > 0)    
            {
                
RegisterHam(Ham_Item_AttachToPlayerszWeaponName"CBasePlayerItem_AttachToPlayer", .Post true)
            }
            if (
BW_MODEL_BODY_INDEX[iId] > || iId == CSW_KNIFE || IsGrenadeWeaponID(iId))
            {
                
RegisterHam(Ham_Item_HolsterszWeaponName"CBasePlayerItem_Holster", .Post true)
                
RegisterHam(Ham_Item_DeployszWeaponName"CBasePlayerItem_Deploy", .Post false)
            }
        }
    }

    
g_tCachedModels TrieCreate()
    for (new 
ieData[bw_player_models_s]; sizeof(PLAYER_MODEL_LIST); i++) 
    {
        
eData[iStyle] = PLAYER_MODEL_LIST[i][iStyle]
        
VecCopy(PLAYER_MODEL_LIST[i][aStyle1], eData[aStyle1])
        
VecCopy(PLAYER_MODEL_LIST[i][aStyle2], eData[aStyle2])

        
TrieSetArray(g_tCachedModelsPLAYER_MODEL_LIST[i][szPlayerModel], eDatabw_player_models_s)
    }
}

public 
plugin_precache() 
{
    
precache_model(BW_MODEL_NAME)
}

public 
CBasePlayerItem_AttachToPlayer(const pItem, const pPlayer)
{
    if (
pItem <= || !is_user_alive(pPlayer))
        return

    
SetModelByWeaponId(pItem)
    
SetModelPosByPlayerModel(pPlayerpItem)

    if (
get_pdata_cbase(pPlayer3735) != pItem
    {
        
set_pev(pItempev_effects0)
    }
}

public 
CBasePlayerItem_Deploy(const pItem)
{
    if (
pItem <= 0)
        return
    
    new 
any:iId get_pdata_int(pItem434)

    if (
iId == CSW_KNIFE
    {
        
SetModelPosByWeaponType(get_pdata_cbase(pItem414), 3)
    }
    else if (
IsGrenadeWeaponID(iId)) 
    {
        
SetModelPosByWeaponType(get_pdata_cbase(pItem414), 4)
    }
    else 
    {
        
set_pev(pItempev_effectsEF_NODRAW)
    }
}

public 
CBasePlayerItem_Holster(const pItem)
{
    if (
pItem <= 0)
        return
    
    new 
any:iId get_pdata_int(pItem434)

    if (
iId == CSW_KNIFE
    {
        
SetModelPosByWeaponType(get_pdata_cbase(pItem414), -3)
    }
    else if (
IsGrenadeWeaponID(iId)) 
    {
        
SetModelPosByWeaponType(get_pdata_cbase(pItem414), -4)
    }
    else
    {
        if (
pev(pItempev_modelindex) == 0
        {
            
SetModelByWeaponId(pItem)
            
SetModelPosByPlayerModel(get_pdata_cbase(pItem414), pItem)
        }
        
        
set_pev(pItempev_effects0)
    }
}

stock SetModelPosByWeaponType(const pPlayer, const iValue)
{
    if (!
IsPlayer(pPlayer))
        return
    
    new 
iDispBackItem get_pdata_cbase(pPlayer3685)
    while (
pev_valid(pBackItem))
    {
        
iDis pev(pBackItempev_controller_0);
        if (
iDis 0)
            
set_pev(pBackItempev_controller_0iDis iValue)    
        
        
pBackItem get_pdata_cbase(pBackItem424)
    }
}

stock SetModelByWeaponId(const pItem)
{
    
engfunc(EngFunc_SetModelpItemBW_MODEL_NAME)
    
set_pev(pItempev_bodyBW_MODEL_BODY_INDEX[get_pdata_int(pItem434)])
}

public 
client_PostThink(pPlayer)
{
    if (!
is_user_alive(pPlayer))
        return;
    
    new 
pBackItem get_pdata_cbase(pPlayer3685);

    if (!
pev_valid(pBackItem))
        return;
    
    new 
FxR,G,BRenderAmount
    get_user_rendering
(pPlayerFxR,G,BRenderAmount);
    
set_rendering(pBackItemFxR,G,BRenderAmount);
}

stock SetModelPosByPlayerModel(const pPlayer, const pItem)
{
    if (!
IsPlayer(pPlayer))
        return
    
    new 
eData[bw_player_models_s], szModel[32]
    
get_user_info(pPlayer"model"szModelcharsmax(szModel))
    
    if (
TrieGetArray(g_tCachedModelsszModeleDatabw_player_models_s))
    {
        for (new 
BW_CONTROLLER_DISTANCEBW_CONTROLLERSi++)
        {
            
set_pev(pItempev_controller_0 ieData[iStyle] == BW_STYLE1 eData[aStyle1][i] : eData[aStyle2][i])
        }
    }
    else
    {
        for (new 
BW_CONTROLLER_DISTANCEBW_CONTROLLERSi++) 
        {
            
set_pev(pItempev_controller_0 iBW_MODEL_DEFAULT_POS[i])
        }
    }
}

stock VecCopy(const vecIn[], vecOut[])
{
    for (new 
BW_CONTROLLER_DISTANCEBW_CONTROLLERSi++) 
    {
        
vecOut[i] = vecIn[i]
    }

Attached Files
File Type: zip backweapons_classic.zip (4.52 MB, 98 views)
__________________
МультиМод CS 83.222.97.124:27015


Last edited by MayroN; 09-04-2022 at 07:42.
MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN