PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
enum
{
ARM_MP5,
ARM_TMP,
ARM_P90,
ARM_MAC10,
ARM_AK47,
ARM_SG552,
ARM_M4A1,
ARM_AUG,
ARM_SCOUT,
ARM_G3SG1,
ARM_AWP,
ARM_M3,
ARM_XM1014,
ARM_M249,
ARM_FLASHBANG,
ARM_HEGRENADE,
ARM_KEVLAR,
ARM_ASSAULT,
ARM_SMOKEGRENADE
}
new const ArmouryEntityModels[][] =
{
"models/w_mp5.mdl",
"models/w_tmp.mdl",
"models/w_p90.mdl",
"models/w_mac10.mdl",
"models/w_ak47.mdl",
"models/w_sg552.mdl",
"models/w_m4a1.mdl",
"models/w_aug.mdl",
"models/w_scout.mdl",
"models/w_g3sg1.mdl",
"models/w_awp.mdl",
"models/w_m3.mdl",
"models/w_xm1014.mdl",
"models/w_m249.mdl",
"models/w_flashbang.mdl",
"models/w_hegrenade.mdl",
"models/w_kevlar.mdl",
"models/w_assault.mdl",
"models/w_smokegrenade.mdl"
}
const XO_CArmoury = 4
const m_iType = 34
new const BlacklistedItems = (1 << ARM_FLASHBANG) | (1 << ARM_SMOKEGRENADE)
new const CArmoury[] = "armoury_entity"
public plugin_init()
{
register_event("HLTV", "OnNewRoundEvent", "a", "1=0", "2=0")
}
public OnNewRoundEvent()
{
new items[ARM_SMOKEGRENADE + 1]
new index
for(new i = ARM_MP5; i <= ARM_SMOKEGRENADE; i++)
{
if(BlacklistedItems & (1 << i))
{
continue
}
items[index++] = i
}
new itemIndex = random_num(0, index - 1)
new item = items[itemIndex]
new newModel[64]
copy(newModel, charsmax(newModel), ArmouryEntityModels[itemIndex])
new target = -1
while((target = find_ent_by_class(target, CArmoury)))
{
if(pev_valid(target))
{
set_pdata_int(target, m_iType, item, XO_CArmoury)
engfunc(EngFunc_SetModel, target, newModel)
}
}
}
Here you go.
c4, knife, pistols, famas, galil, shield can't be added to an armoury_entity.
To blacklist an item add it inside BlacklistedItems, following the pattern:
| (1 << ARM_*).
Don't test alone, HLTV event isn't fired unless the game starts(or if you do, type "kill" once in console).
In case something goes wrong, double check the models names, I probably made some typos.
To enable the plugin only in certain maps use a custom plugins.ini file.
__________________