Calificación:
  • 0 voto(s) - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
Compartir Facebook
Sma desconocido
#1

Código:
#include <amxmodx>
#include <hamsandwich>
#include <reapi>
#include <fakemeta>
#include <xs>

enum
{
    normal,
    slower,
    medium
}

new const GrenadeClassNames[][] =
{
    "weapon_flashbang",
    "weapon_hegrenade",
    "weapon_smokegrenade"
}

new const Float:VelocityMultiplier[] =
{
    1.0,
    0.5,
    0.7
}

new HandleThrowType[MAX_PLAYERS+1]
new bool:g_bIsFreezeTime

public plugin_init()
{
    new const PluginVersion[] = "1.0"
    register_plugin("Pop Grenades",PluginVersion,"EFFx/HamletEagle")

    register_event("HLTV", "freezeTimeStart", "a", "1=0", "2=0")
    register_logevent("freezeTimeEnd", 2, "1=Round_Start")

    for(new i; i < sizeof GrenadeClassNames; i++)
    {
        RegisterHam(Ham_Item_Deploy, GrenadeClassNames[i], "CBasePlayerWpn_Deploy", false)
        RegisterHam(Ham_Weapon_SecondaryAttack, GrenadeClassNames[i], "CBasePlayerWpn_SecondaryAttack", false)
    }
}

public CBasePlayerWpn_Deploy(const grenadeEntity)
{
    HandleThrowType[get_member(grenadeEntity, m_pPlayer)] = normal
}

public freezeTimeStart()
{
    g_bIsFreezeTime = true
}

public freezeTimeEnd()
{
    g_bIsFreezeTime = false
}

public CBasePlayerWpn_SecondaryAttack(const grenadeEntity)
{
    if(pev_valid(grenadeEntity) && !g_bIsFreezeTime)
    {
        new id = get_member(grenadeEntity, m_pPlayer)
        new buttons = pev(id, pev_button)

        if(buttons & IN_ATTACK)
        {
            HandleThrowType[id] = medium
        }
        else
        {
            HandleThrowType[id] = slower
        }

        ExecuteHamB(Ham_Weapon_PrimaryAttack, grenadeEntity)
    }
}

public grenade_throw(id, grenadeEntity, grenadeWeaponIndex)
{
    if(pev_valid(grenadeEntity))
    {
        new Float:grenadeVelocity[3]
        pev(grenadeEntity, pev_velocity, grenadeVelocity)

        new Float:multiplier = VelocityMultiplier[HandleThrowType[id]]
        xs_vec_mul_scalar(grenadeVelocity, multiplier, grenadeVelocity)
        set_pev(grenadeEntity, pev_velocity, grenadeVelocity)

        HandleThrowType[id] = normal
    }
}

Que sere ese plugins?
#2

https://forums.alliedmods.net/showthread.php?t=292795
Responder




Usuarios navegando en este tema: 1 invitado(s)