Raised This Month: $ Target: $400
 0% 

Whats wrong with this code T-800EditedJelle


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Shippo
Junior Member
Join Date: Oct 2012
Old 07-21-2013 , 04:24   Whats wrong with this code T-800EditedJelle
Reply With Quote #1

Code:
/* Plugin generated by AMXX-Studio */

#include <superheromod>

new gHeroID
new gHeroName[] = "T-800"
new bool:gHasT[SH_MAXSLOTS+1]
new const gParaModel[] = "models/shmod/t800_m249.mdl"
new const gPlayerModel[] = "models/player/t800/t800.mdl"
new const gViewModel[] = "models/shmod/t800_minigun.mdl"

public plugin_init()
{
    //plugin info
    register_plugin("SUPERHERO T-800", "2.2", "Jelle/Bum_Boy16")
    
    //cvars
    new pcvarLevel = register_cvar("t800_level", "10")
    new pcvarHealth = register_cvar("t800_health", "150")
    new pcvarArmor = register_cvar("t800_armor", "150")
    new pcvarGrav = register_cvar("t800_grav", "0.5")
    new pcvarmult = register_cvar("t800_mult", "5")
    
    //create hero!
    gHeroID = sh_create_hero(gHeroName, pcvarLevel)
    sh_set_hero_info(gHeroID, "Change into a T-800", "Get a giant mini gun")
    
    //set hero power
    sh_set_hero_hpap(gHeroID, pcvarHealth, pcvarArmor)
    sh_set_hero_grav(gHeroID, pcvarGrav)
    sh_set_hero_dmgmult(gHeroID, pcvarmult, CSW_M249)
    
    //events
    register_event("CurWeapon", "weapon_change", "be", "1=1")
}


public plugin_precache()
{
    precache_model(gParaModel)
    precache_model(gPlayerModel)
    precache_model(gViewModel)
}

public sh_hero_init(id, heroID, mode)
{
    //if no power return
    if (gHeroID != gHeroID) return
    
    //check if they get or lose power
    switch(mode)
    {
        case SH_HERO_ADD:
        {
            gHasT[id] = true
            switch_model(id)
            t_morph(id)
        }
        case SH_HERO_DROP:
        {
            gHasT[id] = false
            t_unmorph(id)
        }
    }
}

public sh_client_spawn(id)
{
    //if they have power give weapon
    if (gHasT[id])
    {
        t800_weapon(id)
        t_morph(id)
    }
}

t800_weapon(id)
{
    //if client is alive and have power give para
    if (sh_is_active() && is_user_alive(id) && gHasT[id])
    {
        sh_give_weapon(id, CSW_M249, true)
    }
}

switch_model(id)
{
    //if sh off, user is dead or user does nothave power do nothing
    if ( !sh_is_active() || !is_user_alive(id) || !gHasT[id] ) return
    
    //if client has para set model
    if ( get_user_weapon(id) == CSW_M249)
    {
        set_pev(id, pev_viewmodel2, gParaModel)
        set_pev(id, pev_weaponmodel2, gViewModel)
    }
}

public weapon_change(id)
{
    //do nothing if client does not have hero or sh is off
    if ( !sh_is_active() || !gHasT[id] ) return
    
    new weaponID = read_data(2)
    if ( weaponID != CSW_M249 ) return
    
    //go set model
    switch_model(id)
    
    if ( read_data(3) == 0 )
    {
        sh_reload_ammo(id, 1)
    }
}

t_morph(id)
{
    cs_set_user_model(id, gPlayerModel)
}

t_unmorph(id)
{
    cs_reset_user_model(id)
}



Im new here so forgive me if there is something wrong with my post

Last edited by Shippo; 07-21-2013 at 06:38.
Shippo is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:31.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode