Monthly Target: $400 Donations: $9
 2% 

new héro


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
moilc
Member
Join Date: Jan 2009
Old 07-30-2010 , 08:21   new héro
Reply With Quote #1

Voila je veut me crée un hero qui augmente la force d'une arme par exemple la m249 avec ce site la http://esiana.com/shgen/old.html

Donc je fait le hero et tout va bien.

Le héro marche , dés que je dit au serveur que je veut prendre ce héro là , je gagne l'arme sauf que si je meurt , au round suivant je n'ai plus l'arme comme si le plugin n'avait pas compris qu'il faut que l'arme me soit donner a chaque new round.

Comment faire ?

Voici le plugin :

Code:
//m249! - m249 extra damage

//This hero was made was using jtpizzalover's superhero generator
/* CVARS - copy and paste to shconfig.cfg

//m249 
m249_level 12 
m249_health 150    //Default 100 (no extra health)
m249_armor 200        //Default 150
m249_gravity 1.0    //Default 1.0 = no extra gravity (0.50 is 50% normal gravity, ect.)
m249_speed -1        //Default -1 = no extra speed, this cvar is for all weapons (for faster then normal speed set to 261 or higher)
m249_m249mult 10        //Damage multiplyer for his m249 
*/

#include <amxmodx>
#include <superheromod>
#include <fakemeta> 
new HeroName[] = "m249"
new bool:HasHero[SH_MAXSLOTS+1]
 
new Cvarm249DmgMult 
public plugin_init()
{
    // Plugin Info
    register_plugin("SUPERHERO m249","1.0","LMSH Goku Super Sayen")
    
    // DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
    register_cvar("m249_level", "12")
    register_cvar("m249_health", "150")
    register_cvar("m249_armor", "200")
    register_cvar("m249_gravity", "0")
    register_cvar("m249_speed", "-1")
    Cvarm249DmgMult = register_cvar("m249_m249mult", "10") 

    // FIRE THE EVENT TO CREATE THIS SUPERHERO!
    shCreateHero(HeroName, "m249 extra damage", "m249 extra damage", false, "m249_level")
    
    // REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
    // INIT
    register_srvcmd("m249_init", "m249_init")
    shRegHeroInit(HeroName, "m249_init")
        
    // EVENTS
 
    register_event("CurWeapon", "weapon_change", "be", "1=1")
    register_event("Damage", "m249_damage", "b", "2!0") 
    // Let Server know about the hero's variables
    shSetShieldRestrict(HeroName)
    shSetMaxHealth(HeroName, "m249_health")
    shSetMaxArmor(HeroName, "m249_armor")
    shSetMinGravity(HeroName, "m249_gravity")
    shSetMaxSpeed(HeroName, "m249_speed", "[0]")
}
public plugin_precache()
{ 
    precache_model("models/shmod/m249_v_m249.mdl")
    precache_model("models/shmod/m249_p_m249.mdl")
    precache_model("models/shmod/m249_w_m249.mdl")
    } 
public m249_init()
{
    // First Argument is an id
    new temp[6]
    read_argv(1, temp, 5)
    new id = str_to_num(temp)
    // 2nd Argument is 0 or 1 depending on whether the id has the hero
    read_argv(2, temp, 5)
    new hasPowers = str_to_num(temp) 
    //This hero was made was using jtpizzalover's superhero generator
    // Reset their shield restrict status
    // Shield restrict MUST be before weapons are given out
    shResetShield(id)

    switch(hasPowers)
    {
        case true:
        {
            HasHero[id] = true

            if ( is_user_alive(id) )
            { 
                m249_weapons(id)
                switch_model(id)
            }
        } 
        case false:
        { 
            // Check is needed since this gets run on clearpowers even if user didn't have this hero
    if ( is_user_alive(id) && HasHero[id] )
            {
                // This gets run if they had the power but don't anymore
                engclient_cmd(id, "drop", "weapon_m249") 
                 
                shRemHealthPower(id)
                shRemArmorPower(id)
                shRemGravityPower(id)
                shRemSpeedPower(id)
            }
    HasHero[id] = false 

            }
    } 
}

 

public m249_weapons(id)
{
    if ( !shModActive() || !is_user_alive(id) || !HasHero[id] )
        return

    shGiveWeapon(id, "weapon_m249")
}
switch_model(id)
{
    if ( !shModActive() || !is_user_alive(id) || !HasHero[id] )
        return

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

    if ( wpnid == CSW_M249 )
    {
        set_pev(id, pev_viewmodel2, "models/shmod/m249_v_m249.mdl")
        set_pev(id, pev_weaponmodel2, "models/shmod/m249_p_m249.mdl")
    }
}
public weapon_change(id)
{
    if ( !shModActive() || !HasHero[id] )
        return

    new wpnid = read_data(2)

    if ( wpnid != CSW_M249 )
        return

    switch_model(id)

    new clip = read_data(3)

    // Never Run Out of Ammo!
    if ( clip == 0 )
        shReloadAmmo(id)
}
public m249_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 ( HasHero[attacker] && weapon == CSW_M249 && is_user_alive(id) )
    {
        new damage = read_data(2)
        new headshot = bodypart == 1 ? 1 : 0

        // do extra damage
        new extraDamage = floatround(damage * get_pcvar_float(Cvarm249DmgMult) - damage)
        if ( extraDamage > 0 )
            shExtraDamage(id, attacker, extraDamage, "m249", headshot)
    }
} 


/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg1252\\ deff0\\ deflang1036{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ f0\\ fs16 \n\\ par }
*/
PS:Si vous ne voyez pas que sur le site où je fait mon héro on puisse mettre le héro pour m249 c'est parce que j'ai modifié le plugin pour qu'il marche pour la m249.
__________________
Le forum de ma team (team en construction)

http://team-lmsh.creerforums.fr
http://lebrain.hostei.com/


Last edited by moilc; 07-30-2010 at 08:40. Reason: oublie
moilc is offline
kanatzu
Veteran Member
Join Date: Oct 2007
Location: Sweden
Old 08-01-2010 , 17:24   Re: new héro
Reply With Quote #2

I didn't really understand all.

But as this is JtpizzaLovah's generator... Just... dont
__________________




Quote:
Originally Posted by wrecked_ View Post
Stop saying words before I sodomize you with a cucumber.
kanatzu is offline
Send a message via MSN to kanatzu
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 08-04-2010 , 17:36   Re: new héro
Reply With Quote #3

rip morpheus, plus facile.
Fr33m@n is offline
Reply


Thread Tools
Display Modes

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 12:53.


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