Thread: CVARS probs..
View Single Post
Xel0z
Senior Member
Join Date: Apr 2006
Location: Netherlands
Old 09-09-2009 , 13:44   Re: CVARS probs..
Reply With Quote #35

PHP Code:
// Heavy  

/* CVARS - copy and paste to shconfig.cfg 

//Heavy 
heavy_level 25 
heavy_health 500 
heavy_armor 1000 
heavy_m249speed 670 
heavy_mult 4.0 
heavy_healpoints 25 

*/ 

/* 


*   Heavy with a minigun from TF2 
*/ 
 
#include <superheromod> 

new gHeroID 
new const gHeroName[]="Heavy" 
new bool:gHasHeavy[SH_MAXSLOTS+1
new 
gPcvarMultgPcvarHealPoints 
new const g_v_model[] = "models/shmod/heavy_v_m249.mdl" 
new const g_p_model[] = "models/shmod/heavy_p_m249.mdl" 

public plugin_init()  

    
register_plugin("SUPERHERO Heavy""1.0""Lyserinc"
    
    new 
pcvarLevel register_cvar("heavy_level""25"
    new 
pcvarHealth register_cvar("heavy_health""500"
    new 
pcvarArmor register_cvar("heavy_armor""1000"
    new 
pcvarSpeed register_cvar("heavy_m249speed""670"
    
gPcvarMult register_cvar("heavy_mult""4.0"
    
gPcvarHealPoints register_cvar("heavy_healpoints""25"
     
    
gHeroID sh_create_hero(gHeroNamepcvarLevel
    
sh_set_hero_info(gHeroID"Heavy Machinery""HP/AP/Strong m249"
    
sh_set_hero_hpap(gHeroIDpcvarHealthpcvarArmor
    
sh_set_hero_speed(gHeroIDpcvarSpeed, {CSW_M249}) 
     
    
set_task(1.0"heavy_loop"___"b"


public 
sh_hero_init(idheroIDmode

    if (
gHeroID != heroID) return 
     
    switch(
mode
    { 
        case 
SH_HERO_ADD:  
        { 
            
gHasHeavy[id] = true 
            switchmodel
(id
        } 

        case 
SH_HERO_DROP:  
        { 
            
gHasHeavy[id] = false 
        

    } 


public 
plugin_precache()  

    
precache_model(g_v_model
    
precache_model(g_p_model


public 
sh_client_spawn(id)
{
    if (
sh_is_active() && gHasHeavy[id] && is_user_alive(id)) 
    {
        
sh_give_weapon(idCSW_M249)
    }
}    

public 
heavy_loop() 

    if (!
sh_is_active()) return 

    static 
players[SH_MAXSLOTS], playerCountplayer
    get_players
(playersplayerCount"ah"

    for (
0playerCounti++)  
    { 
        
player players[i

        if (
gHasHeavy[player])  
        { 
            
sh_add_hp(playerget_pcvar_num(gPcvarHealPoints)) 
        } 
    } 


public 
client_damage(attackervictimdamagewpnindexhitplace

    if (!
sh_is_active()) return 
    if (!
is_user_alive(victim) || !is_user_connected(attacker)) return 

    if (
gHasHeavy[attacker] && wpnindex == CSW_M249)  
    { 
        new 
headshot hitplace == 
        
new extraDamage floatround(damage get_pcvar_float(gPcvarMult) - damage
        if (
extraDamage 0sh_extra_damage(victimattackerextraDamage"m249"headshot
    } 


public 
weapon_change(id

    if (!
sh_is_active() || !gHasHeavy[id]) return 

    if (
read_data(2) == CSW_M249switchmodel(id


switchmodel(id

    if (!
sh_is_active() || !is_user_alive(id) || !gHasHeavy[id]) return 

    new 
clipammowpnid get_user_weapon(idclipammo)
    
    if (
wpnid == CSW_M249)  
    { 
        
set_pev(idpev_viewmodel2g_v_model)
        
set_pev(idpev_weaponmodel2g_p_model)
    } 

I made some minor mistakes in my previous code.
You should put the models in models/shmod and name them to:
heavy_v_m249.mdl and heavy_p_m249.mdl
__________________
Heroes: TESS-One Working on: Grit (Fixing bugs)
Xel0z is offline
Send a message via MSN to Xel0z