// Claire - Claire Redfield from Resident Evil
/* CVARS - copy and paste to shconfig.cfg
//Claire
claire_level 10 // Level
claire_dmgmult 4.0 // Damage multiplyer for her P228
*/
/*
Credits:
Code - Inspired from Hero Master Chief by Spartan-117 and vittu
Player model - Kratisto and troy98 (http://cs.gamebanana.com/skins/143789)
Weapon model - jawharstrike, soul_slayer, Thanez, Soldier11 and Tware (http://cs.gamebanana.com/skins/143770)
Weapon sounds - Vunsunta, fxdarkloki, hk and Itbankrock (http://cs.gamebanana.com/skins/143770)
*/
// 0-follow server sh_reloadmode cvar setting [Default]
// 1-no reload, continuous shooting
// 2-reload, but backpack ammo never depletes
// 3-drop weapon and get a new one with full clip
// 4-normal cs, reload and backpack ammo depletes
#define AMMO_MODE 1
// Comment out to not use the player and P228 models
#define USE_MODELS
// Comment out to not give a free P228
#define GIVE_WEAPON
#include <superheromod>
// GLOBAL VARIABLES
new gHeroID
new const gHeroName[] = "Claire"
new bool:gHasClaire[SH_MAXSLOTS+1]
new bool:gMorphed[SH_MAXSLOTS+1]
#if defined USE_MODELS
new const gModelGun[] = "models/shs/claire_p228.mdl"
new const gModelPlayer[] = "models/player/claire/claire.mdl"
// Additional sounds for Claire's P228 gun model
new const gSound1[] = "weapons/P228/p228_clipin.wav"
new const gSound2[] = "weapons/P228/p228_clipout.wav"
new const gSound3[] = "weapons/P228/p228_hammer.wav"
new const gSound4[] = "weapons/P228/p228_slidepull.wav"
#endif
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Claire", SH_VERSION_STR, "debute")
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
new pcvarLevel = register_cvar("claire_level", "10")
new pcvarGun = register_cvar("claire_dmgmult", "4.0")
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
gHeroID = sh_create_hero(gHeroName, pcvarLevel)
sh_set_hero_info(gHeroID, "Claire with her P228", "Claire Redfield from Resident Evil")
sh_set_hero_dmgmult(gHeroID, pcvarGun, CSW_P228)
#if defined GIVE_WEAPON
sh_set_hero_shield(gHeroID, true)
#endif
// REGISTER EVENTS THIS HERO WILL RESPOND TO!
#if defined GIVE_WEAPON
register_event("ResetHUD", "new_spawn", "b")
#endif
#if AMMO_MODE < 4 || defined USE_MODELS
register_event("CurWeapon", "weapon_change", "be", "1=1")
register_event("DeathMsg", "masterchief_death", "a")
#endif
}
//----------------------------------------------------------------------------------------------
#if defined USE_MODELS
public plugin_precache()
{
precache_model(gModelGun)
precache_model(gModelPlayer)
precache_sound(gSound1)
precache_sound(gSound2)
precache_sound(gSound3)
precache_sound(gSound4)
}
#endif
//----------------------------------------------------------------------------------------------
public sh_hero_init(id, heroID, mode)
{
if ( gHeroID != heroID ) return
switch(mode) {
case SH_HERO_ADD: {
gHasClaire[id] = true
#if defined GIVE_WEAPON
claire_weapons(id)
#endif
#if defined USE_MODELS
switchmodel(id)
claire_morph(id)
#endif
}
case SH_HERO_DROP: {
gHasClaire[id] = false
if ( is_user_alive(id) ) {
#if defined GIVE_WEAPON
sh_drop_weapon(id, CSW_P228, true)
#endif
#if defined USE_MODELS
claire_unmorph(id)
#endif
}
}
}
sh_debug_message(id, 1, "%s %s", gHeroName, mode ? "ADDED" : "DROPPED")
}
//----------------------------------------------------------------------------------------------
public new_spawn(id)
{
if ( shModActive() && is_user_alive(id) && gHasClaire[id] ) {
#if defined GIVE_WEAPON
claire_weapons(id)
#endif
#if defined USE_MODELS
set_task(1.0, "claire_morph", id)
#endif
}
}
//----------------------------------------------------------------------------------------------
#if defined GIVE_WEAPON
claire_weapons(id)
{
if ( sh_is_active() && is_user_alive(id) && gHasClaire[id] ) {
sh_give_weapon(id, CSW_P228)
}
}
#endif
//----------------------------------------------------------------------------------------------
#if AMMO_MODE < 4 || defined USE_MODELS
public weapon_change(id)
{
if ( !sh_is_active() || !gHasClaire[id] ) return
//weaponID = read_data(2)
if ( read_data(2) != CSW_P228 ) return
#if defined USE_MODELS
switchmodel(id)
#endif
#if AMMO_MODE < 4
// Never Run Out of Ammo!
//clip = read_data(3)
if ( read_data(3) == 0 ) {
sh_reload_ammo(id, AMMO_MODE)
}
#endif
}
#endif
//----------------------------------------------------------------------------------------------
#if defined USE_MODELS
switchmodel(id)
{
if ( !sh_is_active() || !is_user_alive(id) || !gHasClaire[id] ) return
if ( get_user_weapon(id) == CSW_P228 ) {
set_pev(id, pev_viewmodel2, gModelGun)
}
}
#endif
//----------------------------------------------------------------------------------------------
public claire_morph(id)
{
if ( !shModActive() || !is_user_alive(id) || !gHasClaire[id] ) return
#if defined AMXX_VERSION
cs_set_user_model(id, "claire")
#else
CS_SetModel(id, "claire")
#endif
gMorphed[id] = true
}
//----------------------------------------------------------------------------------------------
public claire_unmorph(id)
{
if ( gMorphed[id] ) {
#if defined AMXX_VERSION
cs_reset_user_model(id)
#else
CS_ClearModel(id)
#endif
gMorphed[id] = false
}
}
//----------------------------------------------------------------------------------------------
public claire_death()
{
new id = read_data(2)
if ( !gHasClaire[id] )
return
claire_unmorph(id)
}
//----------------------------------------------------------------------------------------------