PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <superheromod>
new gHeroName[]="Heavy" //hero name
new bool:gHasHeavy[SH_MAXSLOTS+1] //one slot per player
public plugin_init()
{
register_plugin("SUPERHERO Heavy", "0.1", "Jelle")
//cvars
register_cvar("heavy_level", "10");
register_cvar("heavy_health", "500");
register_cvar("heavy_armor", "1000");
register_cvar("heavy_mult", "4");
//create hero!
shCreateHero(gHeroName, "Heavier than most people", "More HP/AP and a nice para", false, "heavy_level");
//register init with server
register_srvcmd("heavy_init", "heavy_init");
//register init with sh mod
shRegHeroInit(gHeroName, "heavy_init");
//set hero functions
shSetMaxHealth(gHeroName, "heavy_health");
shSetMaxArmor(gHeroName, "heavy_armor");
//events
register_event("Damage", "heavy_damage", "b");
}
public heavy_init()
{
new temp[6]; //tempoary variable
read_argv(1,temp,5); //ID of person who picks the hero
new id = str_to_num(temp); //makes string to a number then number to ID
read_argv(2,temp,5); //do they have the power?
new hasPowers = str_to_num(temp);
gHasHeavy[id] = (hasPowers !=0); //returns true or false
if (!hasPowers && gHasHeavy[id] && is_user_alive(id)) //Check if they have power if not remove power
{
shRemHealthPower(id); //removes health
shRemArmorPower(id); //removes armor
}
}
public heavy_damage(id)
{
if (!shModActive() || !is_user_alive(id)) return PLUGIN_CONTINUE;
new damage = read_data(2);
new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart); //witch user, witch weapon, and where has victim been hit
new headshot = bodypart == 1 ? 1 : 0
if(attacker <= 0 || attacker > SH_MAXSLOTS ) return PLUGIN_CONTINUE; //end function if world did the damage
if(gHasHeavy[attacker] && weapon == CSW_M249 && is_user_alive (id)) //if they are alive and have power
{
new extraDamage = floatround(damage * get_cvar_float("heavy_mult") - damage); //calculates extra damage done
if (extraDamage > 0)
{
shExtraDamage(id, attacker, extraDamage, "M249", headshot);
}
}
}
There you go. However, there is no models yet on it. I will add that now.
And if you are looking, Xel0z...
I am not sure if I did the damage thing right.
As it is in the event now, the para is the weapon witch gives you extra damage, right? If not, how do I set it to be the para?
EDIT:
Now I added the weapon models to it:
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <superheromod>
#include <fakemeta> //needed for weapon models
new gHeroName[]="Heavy" //hero name
new bool:gHasHeavy[SH_MAXSLOTS+1] //one slot per player
new g_p_model;
new g_v_model;
public plugin_init()
{
register_plugin("SUPERHERO Heavy", "0.1", "Jelle")
//cvars
register_cvar("heavy_level", "10");
register_cvar("heavy_health", "500");
register_cvar("heavy_armor", "1000");
register_cvar("heavy_mult", "4");
//create hero!
shCreateHero(gHeroName, "Heavier than most people", "More HP/AP and a nice para", false, "heavy_level");
//register init with server
register_srvcmd("heavy_init", "heavy_init");
//register init with sh mod
shRegHeroInit(gHeroName, "heavy_init");
//set hero functions
shSetMaxHealth(gHeroName, "heavy_health");
shSetMaxArmor(gHeroName, "heavy_armor");
//events
register_event("Damage", "heavy_damage", "b");
}
//make people download models!
public plugin_precache()
{
g_p_model = precache_model("models/shmod/heavy/p_gun.mdl");
g_v_model = precache_model("models/shmod/heavy/v_gun.mdl");
}
public heavy_init()
{
new temp[6]; //tempoary variable
read_argv(1,temp,5); //ID of person who picks the hero
new id = str_to_num(temp); //makes string to a number then number to ID
read_argv(2,temp,5); //do they have the power?
new hasPowers = str_to_num(temp);
gHasHeavy[id] = (hasPowers !=0); //returns true or false
if (!hasPowers && gHasHeavy[id] && is_user_alive(id)) //Check if they have power if not remove power
{
shRemHealthPower(id); //removes health
shRemArmorPower(id); //removes armor
}
if (hasPowers) //do they have power?
{
heavy_set_model(id) //if so go set model
}
}
public heavy_set_model(id)
{
if (!shModActive() || !is_user_alive(id) || !gHasHeavy[id]) return;
new clip, ammo, wpnid = get_user_weapon(id, clip, ammo);
if (wpnid == CSW_M249)
{
set_pev(id, pev_viewmodel, engfunc(EngFunc_AllocString, g_v_model)); //view model
set_pev(id, pev_weaponmodel, engfunc(EngFunc_AllocString, g_p_model)); //player model
}
}
public heavy_damage(id)
{
if (!shModActive() || !is_user_alive(id)) return PLUGIN_CONTINUE;
new damage = read_data(2);
new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart); //witch user, witch weapon, and where has victim been hit
new headshot = bodypart == 1 ? 1 : 0
if(attacker <= 0 || attacker > SH_MAXSLOTS ) return PLUGIN_CONTINUE; //end function if world did the damage
if(gHasHeavy[attacker] && weapon == CSW_M249 && is_user_alive (id)) //if they are alive and have power
{
new extraDamage = floatround(damage * get_cvar_float("heavy_mult") - damage); //calculates extra damage done
if (extraDamage > 0)
{
shExtraDamage(id, attacker, extraDamage, "M249", headshot);
}
}
}
You surely want unlimited ammo with the hero right?