Hello, I would like to be able to make two model changes in this code
PHP Code:
register_event("CurWeapon", "weapon_change", "be", "1=1")
register_event("Damage", "batman_damage", "b", "2!0")
//----------------------------------------------------------------------------
public sh_hero_init(id, heroID, mode)
{
if ( gHeroID != heroID ) return
switch(mode) {
case SH_HERO_ADD: {
gHasBatman[id] = true
batman_giveweapons(id)
switch_model(id)
}
case SH_HERO_DROP: {
gHasBatman[id] = false
batman_dropweapons(id)
}
}
sh_debug_message(id, 1, "%s %s", gHeroName, mode ? "ADDED" : "DROPPED")
}
//------------------------------------------------------------------
public weapon_change(id)
{
//do nothing if client does not have hero or sh is off
if ( !sh_is_active() || !gHasBatman[id] ) return
new weaponID = read_data(2)
if (weaponID !=CSW_KNIFE) return
switch_model(id)
//the read data is reading the weapon the client has out
new weaponID = read_data(2)
//and if the client does not have the m4a1 out just do nothing
if (weaponID !=CSW_XM1014) return
switch_model(id)
if (read_data(3) == 0)
{
sh_reload_ammo(id, 1)
}
}
//---------------------------------------------------------------------
switch_model(id)
{
//if the sh mod is off the client is dead or he does not have the hero we do not want to let him have the weapon model!
if (!sh_is_active() || !is_user_alive(id) || !gHasBatman[id] ) return
//and now we check again if he still has the m4a1 out
if (get_user_weapon(id) == CSW_XM1014)
{
//now he has all the requirements to have the weapon model so we also need to give it to him
set_pev(id, pev_viewmodel2, gBatItaca)
set_pev(id, pev_weaponmodel2, gBatItaca2)
}
if (get_user_weapon(id) == CSW_KNIFE)
{
set_pev(id, pev_viewmodel2, gBatKnife)
}
}