Raised This Month: $ Target: $400
 0% 

Hero: Tony Montana


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NexusReaper69
Member
Join Date: Mar 2008
Old 03-03-2008 , 04:39   Hero: Tony Montana
Reply With Quote #1

Hey I'm getting better at this, just one issue that i can never seem to solve even with help, the weapon models won't change. Does anyone see what the problem is?

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

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

#define PLUGIN "Tony Montana"
#define VERSION "1.0"
#define AUTHOR "Vendetter"

#define AMMO_MODE 0

// Hero
new gHeroName[] = "Tony Montana"
new bool:gHasTonyMontana[SH_MAXSLOTS+1]
// Models
new g_p_model
new g_v_model
// Recoil
new Float:gPunchAngle[3] = {0.0,0.0,0.0}
// Switch Model
new bool:ModelWeaponLoaded

public plugin_init()
{
    register_plugin("Tony Montana", "1.0", "Vendetter");
    
    register_cvar("montana_level", "10");
    
    shCreateHero(gHeroName, "M4A1 Power-Up", "Say Hello To My Little Friend", false, "montana_level");
    
    register_srvcmd("montana_init", "montana_init");
    
    shRegHeroInit(gHeroName, "montana_init");
    
    register_event("CurWeapon", "Event_weapon","be","1=1");
    register_event("ResetHUD", "new_spawn","b");
}

public plugin_precache()
{
    g_p_model = precache_model("models/shmod/p_tonymontana_m4.mdl")
    g_v_model = precache_model("models/shmod/v_tonymontana_m4.mdl")
}

public montana_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);
    
    gHasTonyMontana[id] = (hasPowers != 0);
    
    if(hasPowers)
    {
        weapon_change(id)
    }
}

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

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

    if(wpnid == CSW_M4A1)
    {
        set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, g_v_model));
        set_pev(id, pev_weaponmodel, engfunc(EngFunc_AllocString, g_p_model));
    }
}

public Event_weapon(id)
{
    new clip = read_data(3);

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

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

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

    if ( read_data(2) != CSW_M4A1 )
        return

        if ( ModelWeaponLoaded )
            switch_model(id)

        if ( read_data(3) == 0 )
            shReloadAmmo(id, AMMO_MODE)
}

public tonymontana_weapons(id)
{
    if ( !shModActive() || !gHasTonyMontana[id] ) return
        shGiveWeapon(id, "weapon_m4a1")
}

public new_spawn(id)
{
    if ( shModActive() && is_user_alive(id) && gHasTonyMontana[id] )
    {
        set_task(0.1, "tonymontana_weapons", id)
    }
}
NexusReaper69 is offline
NexusReaper69
Member
Join Date: Mar 2008
Old 03-03-2008 , 06:05   Re: Hero: Tony Montana
Reply With Quote #2

These are the models incase you need to test it
Attached Files
File Type: rar models.rar (862.5 KB, 94 views)
NexusReaper69 is offline
NexusReaper69
Member
Join Date: Mar 2008
Old 03-03-2008 , 14:24   Re: Hero: Tony Montana
Reply With Quote #3

Well I have tried every other way of setting models i could find and nothing works... so if someone can figure it out i will be extremely grateful because im just not getting anywhere with this...
NexusReaper69 is offline
NexusReaper69
Member
Join Date: Mar 2008
Old 03-03-2008 , 22:14   Re: Hero: Tony Montana
Reply With Quote #4

someone please help me figure this out!
NexusReaper69 is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 03-04-2008 , 06:41   Re: Hero: Tony Montana
Reply With Quote #5

put switch_model(id) in event_weapon
__________________
yang is offline
Send a message via AIM to yang
NexusReaper69
Member
Join Date: Mar 2008
Old 03-04-2008 , 10:32   Re: Hero: Tony Montana
Reply With Quote #6

Code:
public Event_weapon(id)
{
    new clip = read_data(3);

    if (clip == 0)
    {
        shReloadAmmo(id);
        switch_model(id);
    }
}
like that? cuz if so that didn't work
NexusReaper69 is offline
NexusReaper69
Member
Join Date: Mar 2008
Old 03-04-2008 , 11:00   Re: Hero: Tony Montana
Reply With Quote #7

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

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

#define PLUGIN "Tony Montana"
#define VERSION "1.0"
#define AUTHOR "Vendetter"

// Hero
new gHeroName[] = "Tony Montana"
new bool:gHasTonyMontana[SH_MAXSLOTS+1]
// Models
new g_v_model
// Recoil
new Float:gPunchAngle[3] = {0.0,0.0,0.0}

public plugin_init()
{
    register_plugin("Tony Montana", "1.0", "Vendetter");
    
    register_cvar("montana_level", "10");
    
    shCreateHero(gHeroName, "M4A1 Power-Up", "Say Hello To My Little Friend", false, "montana_level");
    
    register_srvcmd("montana_init", "montana_init");
    
    shRegHeroInit(gHeroName, "montana_init");
    
    register_event("CurWeapon", "weapon_change","be","1=1");
    register_event("ResetHUD", "new_spawn","b");
}

public plugin_precache()
{
    g_v_model = precache_model("models/shmod/v_montana_m4.mdl")
}

public montana_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);
    
    gHasTonyMontana[id] = (hasPowers != 0);
    
    if(hasPowers)
    {
        weapon_change(id)
    }
}

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

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

    if(wpnid == CSW_M4A1)
    {
        set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, g_v_model));
    }
}

public Event_weapon(id)
{
    new clip = read_data(3)

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

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

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

    new wpnid = read_data(2)

    if ( wpnid != CSW_M4A1 )
        return
        
    switch_model(id)
    Event_weapon(id)
    
    new clip = read_data(3)

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

public tonymontana_weapons(id)
{
    if ( !shModActive() || !is_user_alive(id) || !gHasTonyMontana[id] )
        return
    
    shGiveWeapon(id, "weapon_m4a1")
}

public new_spawn(id)
{
    if ( shModActive() && is_user_alive(id) && gHasTonyMontana[id] )
    {
        set_task(0.1, "tonymontana_weapons", id)
    }
}
that's what my code looks like as of now, everything still works except for the models still
NexusReaper69 is offline
Guilty Spark
Member
Join Date: Jan 2008
Location: clansolo.com
Old 03-06-2008 , 03:20   Re: Hero: Tony Montana
Reply With Quote #8

Quote:
Originally Posted by NexusReaper69 View Post
Code:
public Event_weapon(id)
{
    new clip = read_data(3);

    if (clip == 0)
    {
        shReloadAmmo(id);
        switch_model(id);
    }
}
like that? cuz if so that didn't work
No offense, but it looks as if you've just copied and pasted most of this from other heroes. What that code right there says is that any time ANY weapon has an event (reload, fire, zoom in, etc) it will check if the ammo is 0, and reload it / change the model to whatever you have. You need to get the user's weapon using something like "new weapon = read_data(2)" and compare it to the gun you want to give unlimited ammo / a model to.

Something a bit like this:
Code:
public event_weapon(id)
{
    new weapon = read_data(2);
    new clip = read_data(3);
    
    if ( weapon == CSW_M4A1 )
    {
        switch_model(id);
        if ( clip == 0 ) shReloadAmmo(id);
    }
}
You also might want to throw in a check to see if the user is alive and that the superhero mod is active, or else your hero will continue to have its effects even when SH is disabled.
__________________
Superhero Mod ([S0|0]) - 63.209.37.33:27015
[IMG]http://img157.**************/img157/1031/guiltyspark2tn9.png[/IMG]
Guilty Spark is offline
Send a message via AIM to Guilty Spark
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 23:02.


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