Raised This Month: $ Target: $400
 0% 

Models won't change for unknown reason...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NexusReaper69
Member
Join Date: Mar 2008
Old 03-31-2008 , 03:35   Models won't change for unknown reason...
Reply With Quote #1

Well i have this hero, and i have looked at it multiple times to try to find out why the models aren't changing, compared it to heroes i have made where the models do change, and i still don't see why it's not working, can anyone see what the problem is?

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

/*

//Five-0 Cvars
five0_level 30
five0_health 500    //How much health Five-0 has (Def. 500)
five0_armor 500        //How much armor Five-0 has (Def. 500)
five0_glockmult 3.0    //How much damage Five-0's glock does (Def. 3.0)
five0_mp5mult 3.0    //How Much damage Five-0's mp5 does (Def. 3.0)

*/

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <engine>
#include <superheromod>

#define PLUGIN "Five-0"
#define VERSION "1.0"
#define AUTHOR "Vendetter"

new HeroName[] = "Five-0"
new bool:HasFive0[SH_MAXSLOTS+1]
new Float:gPunchAngle[3] = {0.0,0.0,0.0}

public plugin_init()
{
    register_plugin("Five-0", "1.0", "Vendetter")
    //Hero
    shCreateHero(HeroName, "Glock and MP5", "Rock Out with you Glock Out!", false, "five0_level")
    register_srvcmd("five0_init", "five0_init")
    shRegHeroInit(HeroName, "five0_init")
    //Cvars
    register_cvar("five0_level", "30")
    register_cvar("five0_armor", "500")
    register_cvar("five0_health", "500")
    register_cvar("five0_glockmult", "3.0")
    register_cvar("five0_mp5mult", "3.0")
    //Events
    register_event("CurWeapon", "weapon_change", "be", "1=1")
    register_event("ResetHUD", "new_spawn", "b")
    register_event("Damage", "event_damage", "b")
    //Power Sets
    shSetMaxArmor(HeroName, "five0_armor")
    shSetMaxHealth(HeroName, "five0_health")
}

public plugin_precache()
{
    precache_model("models/shmod/five0_v_glock18.mdl")
    precache_model("models/shmod/five0_v_mp5navy.mdl")
}

public five0_init(id)
{
    new temp[6];
    read_argv(1,temp,5);
    new id =str_to_num(temp);
    
    read_argv(2,temp,5);
    new hasPowers = str_to_num(temp);
    
    shResetShield(id)
    
    switch(hasPowers)
    {
        case true:
        {
            HasFive0[id] = true
            
            if( is_user_alive(id) )
            {
                five0_weapons(id)
                switch_model(id)
            }
        }
        case false:
        {
            if( is_user_alive(id) && HasFive0[id] )
            {
                shRemArmorPower(id)
                shRemHealthPower(id)
                engclient_cmd(id, "drop", "weapon_glock")
                engclient_cmd(id, "drop", "weapon_mp5")
            }
            HasFive0[id] = false
        }
    }
}

switch_model(id)
{
    if ( !shModActive() || !is_user_alive(id) || !HasFive0[id] )
        return

    new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)

    if ( wpnid == CSW_MP5NAVY )
    {
        set_pev(id, pev_viewmodel2, "models/shmod/five0_v_mp5navy.mdl")
    }
    
    if ( wpnid == CSW_GLOCK18 )
    {
        set_pev(id, pev_viewmodel2, "models/shmod/five0_v_glock18.mdl")
    }
}

public client_PreThink(id)
{
    if(HasFive0[id] && is_user_alive(id))
    {
        entity_set_vector(id,EV_VEC_punchangle,gPunchAngle);
    }
}

public weapon_change(id)
{
    if ( !shModActive() || !HasFive0[id] )
        return

    new wpnid = read_data(2)

    if ( wpnid == CSW_MP5NAVY )
        return
        
    if ( wpnid == CSW_GLOCK18 )
        return
            
    switch_model(id)
    
    new clip = read_data(3)

    if ( clip == 0 )
        shReloadAmmo(id)
}

public five0_weapons(id)
{
    if ( !shModActive() || !is_user_alive(id) || !HasFive0[id] )
        return
    
    shGiveWeapon(id, "weapon_mp5navy")
    shGiveWeapon(id, "weapon_glock18")
}

public new_spawn(id)
{
    if ( shModActive() && is_user_alive(id) && HasFive0[id] )
    {
        set_task(0.1, "five0_weapons", id)
    }
}

public Event_damage(id)
{
    if ( !shModActive() || !is_user_alive(id) )
        return

    new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
        
    if(attacker <= 0 || attacker > SH_MAXSLOTS )
        return

    if( HasFive0[attacker] && weapon == CSW_MP5NAVY && is_user_alive(id) )
    {
        new damage = read_data(2)
        new headshot = bodypart == 1 ? 1 : 0
        
        new extraDamage = floatround(damage * get_cvar_float("five0_mp5mult") - damage);
    
        if (extraDamage > 0)
            shExtraDamage( id, attacker, extraDamage, "mp5navy", headshot );
    }
    
    if ( HasFive0[attacker] && weapon == CSW_GLOCK18 && is_user_alive(id) )
    {
        new damage = read_data(2)
        new headshot = bodypart == 1 ? 1 : 0
        
        new extraDamage = floatround(damage * get_cvar_float("five0_glockmult") - damage);
        
        if (extraDamage > 0)
            shExtraDamage( id, attacker, extraDamage, "glock18", headshot );
    }
}
__________________
NexusReaper69 is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 04-01-2008 , 03:39   Re: Models won't change for unknown reason...
Reply With Quote #2

Code:
public weapon_change(id)
{
    if ( !shModActive() || !HasFive0[id] )
        return

    new wpnid = read_data(2)

    if ( wpnid == CSW_MP5NAVY )
        return
        
    if ( wpnid == CSW_GLOCK18 )
        return
            
    switch_model(id)
    
    new clip = read_data(3)

    if ( clip == 0 )
        shReloadAmmo(id)
}
how many times have u been asking for model changing help...

look at that statement and it doesn't make logical sense.

hint: return
__________________
yang is offline
Send a message via AIM to yang
NexusReaper69
Member
Join Date: Mar 2008
Old 04-01-2008 , 11:41   Re: Models won't change for unknown reason...
Reply With Quote #3

I asked for model changing help once or twice when I first started but I had it working after that and then I asked again because it wasn't making any sense to me as to why it wasn't working this time. I'm still not sure I get it but I'll try to figure it out.
__________________
NexusReaper69 is offline
NexusReaper69
Member
Join Date: Mar 2008
Old 04-01-2008 , 12:04   Re: Models won't change for unknown reason...
Reply With Quote #4

alright well i found out that the model changes when you run out of ammo lol
__________________
NexusReaper69 is offline
NexusReaper69
Member
Join Date: Mar 2008
Old 04-01-2008 , 12:14   Re: Models won't change for unknown reason...
Reply With Quote #5

fixed the models, any one have an idea as to why the damage doesn't work?
__________________
NexusReaper69 is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 04-01-2008 , 22:32   Re: Models won't change for unknown reason...
Reply With Quote #6

nexus, what yang is saying is this: you are checking if the weapon out is the glock or mp5navy, then if it IS ending the function, if IS NOT then going to your change model function which only changes the model if the weapon IS glock or mp5navy. See? your own programming logic fails to allow for our functions to preform correctly.
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
NexusReaper69
Member
Join Date: Mar 2008
Old 04-02-2008 , 01:59   Re: Models won't change for unknown reason...
Reply With Quote #7

i fixed the models but the dmage isn't working now it's still doing normal damage
__________________
NexusReaper69 is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 04-02-2008 , 20:53   Re: Models won't change for unknown reason...
Reply With Quote #8

register_event("Damage", "event_damage", "b")

and

public Event_damage(id)

see the problem?
__________________
yang is offline
Send a message via AIM to yang
NexusReaper69
Member
Join Date: Mar 2008
Old 04-03-2008 , 05:42   Re: Models won't change for unknown reason...
Reply With Quote #9

ooooo very clever! i can't believe i missed that
__________________
NexusReaper69 is offline
Reply



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 14:02.


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