Senior Member
Join Date: Aug 2017
Location: Kyiv
|
09-04-2022
, 07:01
Re: SideWeapons v0.2 [CS/CZ]
|
#13
|
Quote:
Originally Posted by SoulWeaver16
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 = ((1 << any:CSW_HEGRENADE) | (1 << any:CSW_SMOKEGRENADE) | (1 << 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], iStyle, aStyle1[BW_CONTROLLERS], aStyle2[BW_CONTROLLERS] }
new const BW_MODEL_NAME[] = "models/backweapons_classic/backweapons_classic.mdl"
new const BW_MODEL_DEFAULT_POS[BW_CONTROLLERS] = { 15, 15, 10, 160 }
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, { 4, 15, 45, 10 }, { 15, 33, 0, 160 } },
{ "gign_classic", BW_STYLE1, { 4, 15, 45, 10 }, { 12, 33, 0, 160 } },
{ "gsg9_classic", BW_STYLE1, { 4, 15, 45, 10 }, { 17, 33, 0, 160 } },
{ "urban_classic", BW_STYLE1, { 4, 15, 45, 10 }, { 11, 33, 0, 160 } },
{ "terror_classic", BW_STYLE1, { 4, 15, 45, 10 }, { 13, 33, 0, 160 } },
{ "leet_classic", BW_STYLE1, { 4, 15, 45, 10 }, { 20, 33, 0, 160 } },
{ "guerillaclassic", BW_STYLE1, { 15, 15, 45, 10 }, { 16, 33, 0, 160 } },
{ "arctic_classic", BW_STYLE1, { 4, 15, 45, 10 }, { 5, 33, 0, 160 } }
}
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_P228, szWeaponName[32]; iId <= CSW_P90; iId++)
{
if (get_weaponname(iId, szWeaponName, charsmax(szWeaponName)))
{
if (BW_MODEL_BODY_INDEX[iId] > 0)
{
RegisterHam(Ham_Item_AttachToPlayer, szWeaponName, "CBasePlayerItem_AttachToPlayer", .Post = true)
}
if (BW_MODEL_BODY_INDEX[iId] > 0 || iId == CSW_KNIFE || IsGrenadeWeaponID(iId))
{
RegisterHam(Ham_Item_Holster, szWeaponName, "CBasePlayerItem_Holster", .Post = true)
RegisterHam(Ham_Item_Deploy, szWeaponName, "CBasePlayerItem_Deploy", .Post = false)
}
}
}
g_tCachedModels = TrieCreate()
for (new i, eData[bw_player_models_s]; i < 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_tCachedModels, PLAYER_MODEL_LIST[i][szPlayerModel], eData, bw_player_models_s)
}
}
public plugin_precache()
{
precache_model(BW_MODEL_NAME)
}
public CBasePlayerItem_AttachToPlayer(const pItem, const pPlayer)
{
if (pItem <= 0 || !is_user_alive(pPlayer))
return
SetModelByWeaponId(pItem)
SetModelPosByPlayerModel(pPlayer, pItem)
if (get_pdata_cbase(pPlayer, 373, 5) != pItem)
{
set_pev(pItem, pev_effects, 0)
}
}
public CBasePlayerItem_Deploy(const pItem)
{
if (pItem <= 0)
return
new any:iId = get_pdata_int(pItem, 43, 4)
if (iId == CSW_KNIFE)
{
SetModelPosByWeaponType(get_pdata_cbase(pItem, 41, 4), 3)
}
else if (IsGrenadeWeaponID(iId))
{
SetModelPosByWeaponType(get_pdata_cbase(pItem, 41, 4), 4)
}
else
{
set_pev(pItem, pev_effects, EF_NODRAW)
}
}
public CBasePlayerItem_Holster(const pItem)
{
if (pItem <= 0)
return
new any:iId = get_pdata_int(pItem, 43, 4)
if (iId == CSW_KNIFE)
{
SetModelPosByWeaponType(get_pdata_cbase(pItem, 41, 4), -3)
}
else if (IsGrenadeWeaponID(iId))
{
SetModelPosByWeaponType(get_pdata_cbase(pItem, 41, 4), -4)
}
else
{
if (pev(pItem, pev_modelindex) == 0)
{
SetModelByWeaponId(pItem)
SetModelPosByPlayerModel(get_pdata_cbase(pItem, 41, 4), pItem)
}
set_pev(pItem, pev_effects, 0)
}
}
stock SetModelPosByWeaponType(const pPlayer, const iValue)
{
if (!IsPlayer(pPlayer))
return
new iDis, pBackItem = get_pdata_cbase(pPlayer, 368, 5)
while (pev_valid(pBackItem))
{
iDis = pev(pBackItem, pev_controller_0);
if (iDis > 0)
set_pev(pBackItem, pev_controller_0, iDis - iValue)
pBackItem = get_pdata_cbase(pBackItem, 42, 4)
}
}
stock SetModelByWeaponId(const pItem)
{
engfunc(EngFunc_SetModel, pItem, BW_MODEL_NAME)
set_pev(pItem, pev_body, BW_MODEL_BODY_INDEX[get_pdata_int(pItem, 43, 4)])
}
public client_PostThink(pPlayer)
{
if (!is_user_alive(pPlayer))
return;
new pBackItem = get_pdata_cbase(pPlayer, 368, 5);
if (!pev_valid(pBackItem))
return;
new Fx, R,G,B, Render, Amount
get_user_rendering(pPlayer, Fx, R,G,B, Render, Amount);
set_rendering(pBackItem, Fx, R,G,B, Render, Amount);
}
stock SetModelPosByPlayerModel(const pPlayer, const pItem)
{
if (!IsPlayer(pPlayer))
return
new eData[bw_player_models_s], szModel[32]
get_user_info(pPlayer, "model", szModel, charsmax(szModel))
if (TrieGetArray(g_tCachedModels, szModel, eData, bw_player_models_s))
{
for (new i = BW_CONTROLLER_DISTANCE; i < BW_CONTROLLERS; i++)
{
set_pev(pItem, pev_controller_0 + i, eData[iStyle] == BW_STYLE1 ? eData[aStyle1][i] : eData[aStyle2][i])
}
}
else
{
for (new i = BW_CONTROLLER_DISTANCE; i < BW_CONTROLLERS; i++)
{
set_pev(pItem, pev_controller_0 + i, BW_MODEL_DEFAULT_POS[i])
}
}
}
stock VecCopy(const vecIn[], vecOut[])
{
for (new i = BW_CONTROLLER_DISTANCE; i < BW_CONTROLLERS; i++)
{
vecOut[i] = vecIn[i]
}
}
__________________
• МультиМод CS • 83.222.97.124:27015
Last edited by MayroN; 09-04-2022 at 07:42.
|
|