Raised This Month: $51 Target: $400
 12% 

[help]how to add aura to zclass


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
skakac.33
Member
Join Date: Aug 2009
Old 12-27-2009 , 08:30   [help]how to add aura to zclass
Reply With Quote #1

Hi can someone help me how to add aura (halo effect) on my swarm zombie(by meTaLiCroSS)

aura color: blue
swarm zm .sma:

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

/*================================================================================
 [Customizations]
=================================================================================*/

// Zombie Attributes
new const zclass_name51[] = "Swarm Zombie" // name
new const zclass_info51[] = "You can only Kill/Hurt" // description
new const zclass_model51[] = "zombie_source" // model
new const zclass_clawmodel51[] = "v_knife_zombie.mdl" // claw model

const zclass_health51 3800 // health
const zclass_speed51 260 // speed

const Float:zclass_gravity51 1.0 // gravity
const Float:zclass_knockback51 1.6 // knockback

/*================================================================================
 Customization ends here! Yes, that's it. Editing anything beyond
 here is not officially supported. Proceed at your own risk...
=================================================================================*/

// Variables
new g_iZSwarmIDg_iMaxPlayers

// Cvar pointers
new cvar_dmgmultcvar_surv_dmgmultcvar_blockinfbomb_infect

// Cached cvars
new bool:g_bCvar_Infbomb_InfectFloat:g_flCvar_DmgMultFloat:g_flCvar_SurvDmgMult

// Bools
new bool:g_bIsConnected[33]

// Offsets
const m_pPlayer 41

// Plug info.
#define PLUG_VERSION "0.6"
#define PLUG_AUTH "meTaLiCroSS"

// Macros
#define is_user_valid_connected(%1) (1 <= %1 <= g_iMaxPlayers && g_bIsConnected[%1])

/*================================================================================
 [Init and Precache]
=================================================================================*/

public plugin_init()
{
    
// Plugin Register
    
register_plugin("[ZP] Zombie Class: Swarm Zombie"PLUG_VERSIONPLUG_AUTH)
        
    
// Main events
    
register_event("HLTV""event_RoundStart""a""1=0""2=0")
    
    
// Hamsandwich Forwards
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""fw_KnifeAttack")
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_knife""fw_KnifeAttack")
    
    
// Cvars
    
cvar_dmgmult register_cvar("zp_zclass_swarm_damage_mult""1.0")
    
cvar_surv_dmgmult register_cvar("zp_zclass_swarm_surv_damage_mult""2.0")
    
cvar_blockinfbomb_infect register_cvar("zp_zclass_swarm_infbomb_infect""1")
    
    static 
szCvar[30]
    
formatex(szCvarcharsmax(szCvar), "v%s by %s"PLUG_VERSIONPLUG_AUTH)
    
register_cvar("zp_zclass_swarm"szCvarFCVAR_SERVER|FCVAR_SPONLY
    
    
// Vars
    
g_iMaxPlayers get_maxplayers()
}

public 
plugin_precache()
{
    
// Hamsandwich Forwards
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
    
// Register the new class and store ID for reference
    
g_iZSwarmID zp_register_zombie_class(zclass_name51zclass_info51zclass_model51zclass_clawmodel51zclass_health51zclass_speed51zclass_gravity51zclass_knockback51)    
}

/*================================================================================
 [Main Events]
=================================================================================*/

public event_RoundStart()
{
    
g_bCvar_Infbomb_Infect bool:get_pcvar_num(cvar_blockinfbomb_infect)
    
g_flCvar_DmgMult get_pcvar_float(cvar_dmgmult)
    
g_flCvar_SurvDmgMult get_pcvar_float(cvar_surv_dmgmult)
}

/*================================================================================
 [Main Forwards]
=================================================================================*/

public client_putinserver(id)
{
    
// Updating bool
    
g_bIsConnected[id] = true
}

public 
client_disconnect(id)
{
    
// Updating bool
    
g_bIsConnected[id] = false
}

public 
fw_KnifeAttack(knife)
{
    
// We need to block the Knife attack, because
    // when has throwed an Infection bomb it can Kill/Infect
    // with Knife, and will be a bug
    // ----
    // Get knife owner (player)
    
static iPlayer 
    iPlayer 
get_pdata_cbase(knifem_pPlayer4)
    
    
// Non-player entity
    
if(!is_user_valid_connected(iPlayer))
        return 
HAM_IGNORED
    
    
// Swarm zombie class, not a nemesis and has throwed a infection nade
    
if(zp_get_user_zombie_class(iPlayer) == g_iZSwarmID && !zp_get_user_nemesis(iPlayer) && zp_get_user_infection_nade(iPlayer))
        return 
HAM_SUPERCEDE
    
    
return HAM_IGNORED
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamagetype)
{
    
// In the Main ZP plugin, the TakeDamage forward is Superceded, so
    // we need to register this in Precache to get it working again
    // ----
    // Non-player attacker, self kill, killed by world, or isn't make damage by himself
    
if(!is_user_valid_connected(attacker) || victim == attacker || !attacker || attacker != inflictor)
        return 
HAM_IGNORED
        
    
// Swarm zombie class
    
if(zp_get_user_zombie(attacker) && zp_get_user_zombie_class(attacker) == g_iZSwarmID && !zp_get_user_nemesis(attacker))
    {
        
// Get damage result (with survivor and human damage multiplier)
        
static Float:flDamageResult 
        flDamageResult 
zp_get_user_survivor(victim) ? damage g_flCvar_SurvDmgMult damage g_flCvar_DmgMult
        
        
// Making damage again...
        
ExecuteHam(Ham_TakeDamagevictiminflictorattackerflDamageResultdamagetype)
        
        return 
HAM_SUPERCEDE;
    }
        
    return 
HAM_IGNORED
}

/*================================================================================
 [Zombie Plague Forwards]
=================================================================================*/

public zp_user_infect_attempt(victiminfectornemesis)
{
    
// Non-player infection or turned into a nemesis
    
if(!infector || nemesis)    
        return 
PLUGIN_CONTINUE
        
    
// Check Swarm Zombie class and block infection.
    // I'm detecting if is Zombie and isn't Nemesis because
    // can be an infection by zp_infect_user native
    
if(zp_get_user_zombie_class(infector) == g_iZSwarmID && zp_get_user_zombie(infector) && !zp_get_user_nemesis(infector))
    {
        
// With infection grenade then must kill or infect, defined by cvar.
        
if(zp_get_user_infection_nade(infector))
        {
            switch(
g_bCvar_Infbomb_Infect)
            {
                case 
true:     return PLUGIN_CONTINUE // Infect
                
case false:     ExecuteHamB(Ham_Killedvictiminfector0// Kill
            
}
        }
        
        return 
ZP_PLUGIN_HANDLED
    
}
        
    return 
PLUGIN_CONTINUE
}

/*================================================================================
 [Stocks]
=================================================================================*/

stock zp_get_user_infection_nade(id)
{
    static 
iNade
    iNade 
get_grenade(id)
    
    if(
iNade && entity_get_int(iNadeEV_INT_flTimeStepSound) == 1111)
        return 
iNade;
    
    return 
0;

skakac.33 is offline
Old 12-27-2009, 08:49
NiHiLaNTh
This message has been deleted by NiHiLaNTh. Reason: Oh man !
Excalibur.007
Veteran Member
Join Date: Sep 2009
Location: Singapore
Old 12-27-2009 , 18:52   Re: [help]how to add aura to zclass
Reply With Quote #2

Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

/*================================================================================
[Customizations]
=================================================================================*/

// Zombie Attributes
new const zclass_name51[] = "Swarm Zombie" // name
new const zclass_info51[] = "You can only Kill/Hurt" // description
new const zclass_model51[] = "zombie_source" // model
new const zclass_clawmodel51[] = "v_knife_zombie.mdl" // claw model

const zclass_health51 = 3800 // health
const zclass_speed51 = 260 // speed

const Float:zclass_gravity51 = 1.0 // gravity
const Float:zclass_knockback51 = 1.6 // knockback

/*================================================================================
Customization ends here! Yes, that's it. Editing anything beyond
here is not officially supported. Proceed at your own risk...
=================================================================================*/

// Variables
new g_iZSwarmID, g_iMaxPlayers

// Cvar pointers
new cvar_dmgmult, cvar_surv_dmgmult, cvar_blockinfbomb_infect

// Cached cvars
new bool:g_bCvar_Infbomb_Infect, Float:g_flCvar_DmgMult, Float:g_flCvar_SurvDmgMult

// Bools
new bool:g_bIsConnected[33]

// Offsets
const m_pPlayer = 41

// Plug info.
#define PLUG_VERSION "0.6"
#define PLUG_AUTH "meTaLiCroSS"

// Macros
#define is_user_valid_connected(%1) (1 <= %1 <= g_iMaxPlayers && g_bIsConnected[%1])

/*================================================================================
[Init and Precache]
=================================================================================*/

public plugin_init()
{
    // Plugin Register
    register_plugin("[ZP] Zombie Class: Swarm Zombie", PLUG_VERSION, PLUG_AUTH)
    
    // Main events
    register_event("HLTV", "event_RoundStart", "a", "1=0", "2=0")
    
    // Fakemeta Fowards
    register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
    
    // Hamsandwich Forwards
    RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_knife", "fw_KnifeAttack")
    RegisterHam(Ham_Weapon_SecondaryAttack, "weapon_knife", "fw_KnifeAttack")
    
    // Cvars
    cvar_dmgmult = register_cvar("zp_zclass_swarm_damage_mult", "1.0")
    cvar_surv_dmgmult = register_cvar("zp_zclass_swarm_surv_damage_mult", "2.0")
    cvar_blockinfbomb_infect = register_cvar("zp_zclass_swarm_infbomb_infect", "1")
    
    static szCvar[30]
    formatex(szCvar, charsmax(szCvar), "v%s by %s", PLUG_VERSION, PLUG_AUTH)
    register_cvar("zp_zclass_swarm", szCvar, FCVAR_SERVER|FCVAR_SPONLY) 
    
    // Vars
    g_iMaxPlayers = get_maxplayers()
}

public plugin_precache()
{
    // Hamsandwich Forwards
    RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
    
    // Register the new class and store ID for reference
    g_iZSwarmID = zp_register_zombie_class(zclass_name51, zclass_info51, zclass_model51, zclass_clawmodel51, zclass_health51, zclass_speed51, zclass_gravity51, zclass_knockback51)    
}

/*================================================================================
[Main Events]
=================================================================================*/

public event_RoundStart()
{
    g_bCvar_Infbomb_Infect = bool:get_pcvar_num(cvar_blockinfbomb_infect)
    g_flCvar_DmgMult = get_pcvar_float(cvar_dmgmult)
    g_flCvar_SurvDmgMult = get_pcvar_float(cvar_surv_dmgmult)
}

/*================================================================================
[Main Forwards]
=================================================================================*/

public client_putinserver(id)
{
    // Updating bool
    g_bIsConnected[id] = true
}

public client_disconnect(id)
{
    // Updating bool
    g_bIsConnected[id] = false
}

public fw_PlayerPreThink(id)
{
    if( !is_user_alive(id) || !zp_get_user_zombie(id) || zp_get_user_zombie_class(id) != g_iZSwarmID || zp_get_user_nemesis(id))
        return FMRES_IGNORED
    
    // Aura task
    static origin[ 3 ]
    get_user_origin( id, origin )
    
    message_begin( MSG_PVS, SVC_TEMPENTITY, origin )
    write_byte(TE_DLIGHT)
    write_coord(origin[0]) 
    write_coord(origin[1])
    write_coord(origin[2])
    write_byte(10) // Radius
    write_byte(180) // Red
    write_byte(0) // Green
    write_byte(0) // Blue
    write_byte(2) // Life
    write_byte(0)
    message_end()
    // End of Aura Task
}

public fw_KnifeAttack(knife)
{
    // We need to block the Knife attack, because
    // when has throwed an Infection bomb it can Kill/Infect
    // with Knife, and will be a bug
    // ----
    // Get knife owner (player)
    static iPlayer 
    iPlayer = get_pdata_cbase(knife, m_pPlayer, 4)
    
    // Non-player entity
    if(!is_user_valid_connected(iPlayer))
        return HAM_IGNORED
    
    // Swarm zombie class, not a nemesis and has throwed a infection nade
    if(zp_get_user_zombie_class(iPlayer) == g_iZSwarmID && !zp_get_user_nemesis(iPlayer) && zp_get_user_infection_nade(iPlayer))
        return HAM_SUPERCEDE
    
    return HAM_IGNORED
}

public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damagetype)
{
    // In the Main ZP plugin, the TakeDamage forward is Superceded, so
    // we need to register this in Precache to get it working again
    // ----
    // Non-player attacker, self kill, killed by world, or isn't make damage by himself
    if(!is_user_valid_connected(attacker) || victim == attacker || !attacker || attacker != inflictor)
        return HAM_IGNORED
    
    // Swarm zombie class
    if(zp_get_user_zombie(attacker) && zp_get_user_zombie_class(attacker) == g_iZSwarmID && !zp_get_user_nemesis(attacker))
    {
        // Get damage result (with survivor and human damage multiplier)
        static Float:flDamageResult 
        flDamageResult = zp_get_user_survivor(victim) ? damage * g_flCvar_SurvDmgMult : damage * g_flCvar_DmgMult
        
        // Making damage again...
        ExecuteHam(Ham_TakeDamage, victim, inflictor, attacker, flDamageResult, damagetype)
        
        return HAM_SUPERCEDE;
    }
    
    return HAM_IGNORED
}

/*================================================================================
[Zombie Plague Forwards]
=================================================================================*/

public zp_user_infect_attempt(victim, infector, nemesis)
{
    // Non-player infection or turned into a nemesis
    if(!infector || nemesis)    
        return PLUGIN_CONTINUE
    
    // Check Swarm Zombie class and block infection.
    // I'm detecting if is Zombie and isn't Nemesis because
    // can be an infection by zp_infect_user native
    if(zp_get_user_zombie_class(infector) == g_iZSwarmID && zp_get_user_zombie(infector) && !zp_get_user_nemesis(infector))
    {
        // With infection grenade then must kill or infect, defined by cvar.
        if(zp_get_user_infection_nade(infector))
        {
            switch(g_bCvar_Infbomb_Infect)
            {
                case true:     return PLUGIN_CONTINUE // Infect
                    case false:     ExecuteHamB(Ham_Killed, victim, infector, 0) // Kill
                }
        }
        
        return ZP_PLUGIN_HANDLED
    }
    
    return PLUGIN_CONTINUE
}

/*================================================================================
[Stocks]
=================================================================================*/

stock zp_get_user_infection_nade(id)
{
    static iNade
    iNade = get_grenade(id)
    
    if(iNade && entity_get_int(iNade, EV_INT_flTimeStepSound) == 1111)
        return iNade;
    
    return 0;
}
Got it inside my witch plugin.
Excalibur.007 is offline
skakac.33
Member
Join Date: Aug 2009
Old 12-28-2009 , 07:07   Re: [help]how to add aura to zclass
Reply With Quote #3

it's not working
skakac.33 is offline
Merc3y
Member
Join Date: Dec 2009
Old 12-28-2009 , 07:20   Re: [help]how to add aura to zclass
Reply With Quote #4

Quote:
Originally Posted by skakac.33 View Post
it's not working
Can't compile or what ?

If it so add this:

PHP Code:
new Aura33 ], MaxPlayers 
PHP Code:
register_forwardFM_PlayerPreThink"fw_PlayerPreThink" )
register_event"DeathMsg""Die""a" )
 
MaxPlayers get_maxplayers( ) 
PHP Code:
public zp_user_infected_postidinfector )
{
    if ( 
zp_get_user_zombie_classid ) == g_iZSwarmID )
    {
        
Auraid ] = 1
    
}

PHP Code:
public zp_user_humanized_postid )
{
    if ( 
Auraid ] )
    {
        
Auraid  ] = 0
    
}
}
 
public Die( )
{
    for( new 
idid <= g_maxplayersid++ )
    if ( 
Auraid ] )
        
Auraid ] = 0
}
 
public 
fw_PlayerPreThinkid )
{
    if ( !
Auraid ] || !is_user_aliveid ) )
          return
 
    if ( 
zp_get_user_zombie_classid ) == g_iZSwarmID )    
    {
        static 
Float:originF[3]            
        
pev(idpev_originoriginF)
        
// Colored Aura
        
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
        
write_byte(TE_DLIGHT// TE id
        
engfunc(EngFunc_WriteCoordoriginF[0]) // x
        
engfunc(EngFunc_WriteCoordoriginF[1]) // y
        
engfunc(EngFunc_WriteCoordoriginF[2]) // z
        
write_byte(10// radius
        
write_byte(255// r
        
write_byte(0// g
        
write_byte(0)  // b 
        
write_byte(2// life
        
write_byte(0// decay rate
        
message_end()
    }

__________________
How I Wish That I Can Host Without Any Problem.

Last edited by Merc3y; 12-28-2009 at 07:26.
Merc3y is offline
skakac.33
Member
Join Date: Aug 2009
Old 12-28-2009 , 11:22   Re: [help]how to add aura to zclass
Reply With Quote #5

thise are the erorrs:
Quote:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "g_maxplayers" on line 170
Warning: Symbol is assigned a value that is never used: "MaxPlayers" on line 291

1 Error.
Could not locate output file C:\Documents and Settings\Dusan\My Documents\zp_zclass_swarm.amx (compile failed).
and this is .sma
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

/*================================================================================
 [Customizations]
=================================================================================*/

// Zombie Attributes
new const zclass_name51[] = "Swarm Zombie" // name
new const zclass_info51[] = "You can only Kill/Hurt" // description
new const zclass_model51[] = "zombie_source" // model
new const zclass_clawmodel51[] = "v_knife_zombie.mdl" // claw model

const zclass_health51 1800 // health
const zclass_speed51 190 // speed

const Float:zclass_gravity51 1.0 // gravity
const Float:zclass_knockback51 1.0 // knockback

/*================================================================================
 Customization ends here! Yes, that's it. Editing anything beyond
 here is not officially supported. Proceed at your own risk...
=================================================================================*/

// Variables
new g_iZSwarmIDg_iMaxPlayers

// Cvar pointers
new cvar_dmgmultcvar_surv_dmgmultcvar_blockinfbomb_infect

// Cached cvars
new bool:g_bCvar_Infbomb_InfectFloat:g_flCvar_DmgMultFloat:g_flCvar_SurvDmgMult

// Bools
new bool:g_bIsConnected[33]

// Offsets
const m_pPlayer 41

new Aura33 ], MaxPlayers  

// Plug info.
#define PLUG_VERSION "0.6"
#define PLUG_AUTH "meTaLiCroSS"

// Macros
#define is_user_valid_connected(%1) (1 <= %1 <= g_iMaxPlayers && g_bIsConnected[%1])

/*================================================================================
 [Init and Precache]
=================================================================================*/

public plugin_init()
{
    
// Plugin Register
    
register_plugin("[ZP] Zombie Class: Swarm Zombie"PLUG_VERSIONPLUG_AUTH)
        
    
// Main events
    
register_event("HLTV""event_RoundStart""a""1=0""2=0")
    
    
// Hamsandwich Forwards
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""fw_KnifeAttack")
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_knife""fw_KnifeAttack")
    
    
// Cvars
    
cvar_dmgmult register_cvar("zp_zclass_swarm_damage_mult""1.0")
    
cvar_surv_dmgmult register_cvar("zp_zclass_swarm_surv_damage_mult""2.0")
    
cvar_blockinfbomb_infect register_cvar("zp_zclass_swarm_infbomb_infect""1")
    
    static 
szCvar[30]
    
formatex(szCvarcharsmax(szCvar), "v%s by %s"PLUG_VERSIONPLUG_AUTH)
    
register_cvar("zp_zclass_swarm"szCvarFCVAR_SERVER|FCVAR_SPONLY
    
    
// Vars
    
    
register_forwardFM_PlayerPreThink"fw_PlayerPreThink" )
    
register_event"DeathMsg""Die""a" )
 
    
MaxPlayers get_maxplayers( )  
    
g_iMaxPlayers get_maxplayers()
}

public 
plugin_precache()
{
    
// Hamsandwich Forwards
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
    
// Register the new class and store ID for reference
    
g_iZSwarmID zp_register_zombie_class(zclass_name51zclass_info51zclass_model51zclass_clawmodel51zclass_health51zclass_speed51zclass_gravity51zclass_knockback51)    
}

public 
zp_user_infected_postidinfector )
{
    if ( 
zp_get_user_zombie_classid ) == g_iZSwarmID )
    {
        
Auraid ] = 1
    
}
}  

/*================================================================================
 [Main Events]
=================================================================================*/

public event_RoundStart()
{
    
g_bCvar_Infbomb_Infect bool:get_pcvar_num(cvar_blockinfbomb_infect)
    
g_flCvar_DmgMult get_pcvar_float(cvar_dmgmult)
    
g_flCvar_SurvDmgMult get_pcvar_float(cvar_surv_dmgmult)
}

/*================================================================================
 [Main Forwards]
=================================================================================*/

public client_putinserver(id)
{
    
// Updating bool
    
g_bIsConnected[id] = true
}

public 
client_disconnect(id)
{
    
// Updating bool
    
g_bIsConnected[id] = false
}

public 
zp_user_humanized_postid )
{
    if ( 
Auraid ] )
    {
        
Auraid  ] = 0
    
}
}
 
public Die( )
{
    for( new 
idid <= g_maxplayersid++ ) --- this is line 170
    
if ( Auraid ] )
        
Auraid ] = 0
}
 
public 
fw_PlayerPreThinkid )
{
    if ( !
Auraid ] || !is_user_aliveid ) )
          return
 
    if ( 
zp_get_user_zombie_classid ) == g_iZSwarmID )    
    {
        static 
Float:originF[3]            
        
pev(idpev_originoriginF)
        
// Colored Aura
        
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
        
write_byte(TE_DLIGHT// TE id
        
engfunc(EngFunc_WriteCoordoriginF[0]) // x
        
engfunc(EngFunc_WriteCoordoriginF[1]) // y
        
engfunc(EngFunc_WriteCoordoriginF[2]) // z
        
write_byte(10// radius
        
write_byte(0// r
        
write_byte(0// g
        
write_byte(255)  // b 
        
write_byte(2// life
        
write_byte(0// decay rate
        
message_end()
    }


public 
fw_KnifeAttack(knife)
{
    
// We need to block the Knife attack, because
    // when has throwed an Infection bomb it can Kill/Infect
    // with Knife, and will be a bug
    // ----
    // Get knife owner (player)
    
static iPlayer 
    iPlayer 
get_pdata_cbase(knifem_pPlayer4)
    
    
// Non-player entity
    
if(!is_user_valid_connected(iPlayer))
        return 
HAM_IGNORED
    
    
// Swarm zombie class, not a nemesis and has throwed a infection nade
    
if(zp_get_user_zombie_class(iPlayer) == g_iZSwarmID && !zp_get_user_nemesis(iPlayer) && zp_get_user_infection_nade(iPlayer))
        return 
HAM_SUPERCEDE
    
    
return HAM_IGNORED
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamagetype)
{
    
// In the Main ZP plugin, the TakeDamage forward is Superceded, so
    // we need to register this in Precache to get it working again
    // ----
    // Non-player attacker, self kill, killed by world, or isn't make damage by himself
    
if(!is_user_valid_connected(attacker) || victim == attacker || !attacker || attacker != inflictor)
        return 
HAM_IGNORED
        
    
// Swarm zombie class
    
if(zp_get_user_zombie(attacker) && zp_get_user_zombie_class(attacker) == g_iZSwarmID && !zp_get_user_nemesis(attacker))
    {
        
// Get damage result (with survivor and human damage multiplier)
        
static Float:flDamageResult 
        flDamageResult 
zp_get_user_survivor(victim) ? damage g_flCvar_SurvDmgMult damage g_flCvar_DmgMult
        
        
// Making damage again...
        
ExecuteHam(Ham_TakeDamagevictiminflictorattackerflDamageResultdamagetype)
        
        return 
HAM_SUPERCEDE;
    }
        
    return 
HAM_IGNORED
}

/*================================================================================
 [Zombie Plague Forwards]
=================================================================================*/

public zp_user_infect_attempt(victiminfectornemesis)
{
    
// Non-player infection or turned into a nemesis
    
if(!infector || nemesis)    
        return 
PLUGIN_CONTINUE
        
    
// Check Swarm Zombie class and block infection.
    // I'm detecting if is Zombie and isn't Nemesis because
    // can be an infection by zp_infect_user native
    
if(zp_get_user_zombie_class(infector) == g_iZSwarmID && zp_get_user_zombie(infector) && !zp_get_user_nemesis(infector))
    {
        
// With infection grenade then must kill or infect, defined by cvar.
        
if(zp_get_user_infection_nade(infector))
        {
            switch(
g_bCvar_Infbomb_Infect)
            {
                case 
true:     return PLUGIN_CONTINUE // Infect
                
case false:     ExecuteHamB(Ham_Killedvictiminfector0// Kill
            
}
        }
        
        return 
ZP_PLUGIN_HANDLED
    
}
        
    return 
PLUGIN_CONTINUE
}

/*================================================================================
 [Stocks]
=================================================================================*/

stock zp_get_user_infection_nade(id)
{
    static 
iNade
    iNade 
get_grenade(id)
    
    if(
iNade && entity_get_int(iNadeEV_INT_flTimeStepSound) == 1111)
        return 
iNade;
    
    return 
0;


Last edited by skakac.33; 12-28-2009 at 11:28.
skakac.33 is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 12-28-2009 , 11:31   Re: [help]how to add aura to zclass
Reply With Quote #6

Code:
public Die( )
{
    for( new id; id <= g_maxplayers; id++ )
    if ( Aura[ id ] )
        Aura[ id ] = 0
}


-->

Code:
public Die( )
{
    for( new id; id <= MaxPlayers; id++ )
    if ( Aura[ id ] )
        Aura[ id ] = 0
}



But actually why you are doing loop on player death O_o ?
Code:
public Die ( )
{
     new Victim = read_data ( 2 )

     if ( Aura [ Victim ] )
         Aura [ Victim ]  = false
}

__________________


Last edited by NiHiLaNTh; 12-28-2009 at 11:32. Reason: Shit!
NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 12-28-2009 , 11:41   Re: [help]how to add aura to zclass
Reply With Quote #7

All that are bad

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>

/*================================================================================
[Customizations]
=================================================================================*/

// Zombie Attributes
new const zclass_name51[] = "Swarm Zombie" // name
new const zclass_info51[] = "You can only Kill/Hurt" // description
new const zclass_model51[] = "zombie_source" // model
new const zclass_clawmodel51[] = "v_knife_zombie.mdl" // claw model

const zclass_health51 3800 // health
const zclass_speed51 260 // speed

const Float:zclass_gravity51 1.0 // gravity
const Float:zclass_knockback51 1.6 // knockback

/*================================================================================
Customization ends here! Yes, that's it. Editing anything beyond
here is not officially supported. Proceed at your own risk...
=================================================================================*/

// Variables
new g_iZSwarmIDg_iMaxPlayers

// Cvar pointers
new cvar_dmgmultcvar_surv_dmgmultcvar_blockinfbomb_infect

// Cached cvars
new bool:g_bCvar_Infbomb_InfectFloat:g_flCvar_DmgMultFloat:g_flCvar_SurvDmgMult

// Bools
new bool:g_bIsConnected[33]

// Offsets
const m_pPlayer 41

// Plug info.
#define PLUG_VERSION "0.6"
#define PLUG_AUTH "meTaLiCroSS"

// Macros
#define is_user_valid_connected(%1) (1 <= %1 <= g_iMaxPlayers && g_bIsConnected[%1])

/*================================================================================
 [Init and Precache]
=================================================================================*/

public plugin_init()
{
    
// Plugin Register
    
register_plugin("[ZP] Zombie Class: Swarm Zombie"PLUG_VERSIONPLUG_AUTH)
    
    
// Main events
    
register_event("HLTV""event_RoundStart""a""1=0""2=0")
    
    
// Hamsandwich Forwards
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""fw_KnifeAttack")
    
RegisterHam(Ham_Weapon_SecondaryAttack"weapon_knife""fw_KnifeAttack")
    
    
// Cvars
    
cvar_dmgmult register_cvar("zp_zclass_swarm_damage_mult""1.0")
    
cvar_surv_dmgmult register_cvar("zp_zclass_swarm_surv_damage_mult""2.0")
    
cvar_blockinfbomb_infect register_cvar("zp_zclass_swarm_infbomb_infect""1")
    
    static 
szCvar[30]
    
formatex(szCvarcharsmax(szCvar), "v%s by %s"PLUG_VERSIONPLUG_AUTH)
    
register_cvar("zp_zclass_swarm"szCvarFCVAR_SERVER|FCVAR_SPONLY
    
    
// Vars
    
g_iMaxPlayers get_maxplayers()
}

public 
plugin_precache()
{
    
// Hamsandwich Forwards
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
    
    
// Register the new class and store ID for reference
    
g_iZSwarmID zp_register_zombie_class(zclass_name51zclass_info51zclass_model51zclass_clawmodel51zclass_health51zclass_speed51zclass_gravity51zclass_knockback51)    
}

/*================================================================================
 [Main Events]
=================================================================================*/

public event_RoundStart()
{
    
g_bCvar_Infbomb_Infect bool:get_pcvar_num(cvar_blockinfbomb_infect)
    
g_flCvar_DmgMult get_pcvar_float(cvar_dmgmult)
    
g_flCvar_SurvDmgMult get_pcvar_float(cvar_surv_dmgmult)
}

/*================================================================================
 [Main Forwards]
=================================================================================*/

public client_putinserver(id)
{
    
// Updating bool
    
g_bIsConnected[id] = true
}

public 
client_disconnect(id)
{
    
// Updating bool
    
g_bIsConnected[id] = false
}

public 
fw_KnifeAttack(knife)
{
    
// We need to block the Knife attack, because
    // when has throwed an Infection bomb it can Kill/Infect
    // with Knife, and will be a bug
    // ----
    // Get knife owner (player)
    
static iPlayer 
    iPlayer 
get_pdata_cbase(knifem_pPlayer4)
    
    
// Non-player entity
    
if(!is_user_valid_connected(iPlayer))
        return 
HAM_IGNORED
    
    
// Swarm zombie class, not a nemesis and has throwed a infection nade
    
if(zp_get_user_zombie_class(iPlayer) == g_iZSwarmID && !zp_get_user_nemesis(iPlayer) && zp_get_user_infection_nade(iPlayer))
        return 
HAM_SUPERCEDE
    
    
return HAM_IGNORED
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamagetype)
{
    
// In the Main ZP plugin, the TakeDamage forward is Superceded, so
    // we need to register this in Precache to get it working again
    // ----
    // Non-player attacker, self kill, killed by world, or isn't make damage by himself
    
if(!is_user_valid_connected(attacker) || victim == attacker || !attacker || attacker != inflictor)
        return 
HAM_IGNORED
    
    
// Swarm zombie class
    
if(zp_get_user_zombie(attacker) && zp_get_user_zombie_class(attacker) == g_iZSwarmID && !zp_get_user_nemesis(attacker))
    {
        
// Get damage result (with survivor and human damage multiplier)
        
static Float:flDamageResult 
        flDamageResult 
zp_get_user_survivor(victim) ? damage g_flCvar_SurvDmgMult damage g_flCvar_DmgMult
        
        
// Making damage again...
        
ExecuteHam(Ham_TakeDamagevictiminflictorattackerflDamageResultdamagetype)
        
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED
}

/*================================================================================
 [Zombie Plague Forwards]
=================================================================================*/

public zp_user_infected_post(idinfectornemesis)
{
    
// Selected class
    
if(zp_get_user_zombie_class(id) == g_iZSwarmID && !nemesis)
        
set_task(0.1"swarm_aura_task"id__"b")
}

public 
zp_user_infect_attempt(victiminfectornemesis)
{
    
// Non-player infection or turned into a nemesis
    
if(!infector || nemesis)    
        return 
PLUGIN_CONTINUE
    
    
// Check Swarm Zombie class and block infection.
    // I'm detecting if is Zombie and isn't Nemesis because
    // can be an infection by zp_infect_user native
    
if(zp_get_user_zombie_class(infector) == g_iZSwarmID && zp_get_user_zombie(infector) && !zp_get_user_nemesis(infector))
    {
        
// With infection grenade then must kill or infect, defined by cvar.
        
if(zp_get_user_infection_nade(infector))
        {
            switch(
g_bCvar_Infbomb_Infect)
            {
                case 
true:     return PLUGIN_CONTINUE // Infect
                    
case false:     ExecuteHamB(Ham_Killedvictiminfector0// Kill
                
}
        }
        
        return 
ZP_PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}

/*================================================================================
 [Tasks]
=================================================================================*/

public swarm_aura_task(id)
{
    
// Not a Zombie, invalid class id, not alive
    
if(!zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_zombie_class(id) != g_iZSwarmID || !is_user_alive(id))
    {
        
remove_task(id)
        return
    }
    
    
// Retrieve player origin
    
static iOrigin[3]            
    
get_user_origin(idiOrigin)
    
    
// Colored Aura
    
message_begin(MSG_PVSSVC_TEMPENTITYiOrigin)
    
write_byte(TE_DLIGHT// TE id
    
write_coord(iOrigin[0]) // x
    
write_coord(iOrigin[1]) // y
    
write_coord(iOrigin[2]) // z
    
write_byte(10// radius
    
write_byte(0// r
    
write_byte(0// g
    
write_byte(255)  // b 
    
write_byte(2// life
    
write_byte(0// decay rate
    
message_end()
}

/*================================================================================
 [Stocks]
=================================================================================*/

stock zp_get_user_infection_nade(id)
{
    static 
iNade
    iNade 
get_grenade(id)
    
    if(
iNade && entity_get_int(iNadeEV_INT_flTimeStepSound) == 1111)
        return 
iNade;
    
    return 
0;

__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Javivi
AlliedModders Donor
Join Date: Dec 2008
Old 12-28-2009 , 13:05   Re: [help]how to add aura to zclass
Reply With Quote #8

Quote:
Originally Posted by meTaLiCroSS View Post
All that are bad
Better...
PHP Code:
public zp_user_infected_post(idinfectornemesis)
{
    
// Selected class
    
if(zp_get_user_zombie_class(id) == g_iZSwarmID && !nemesis)
        
swarm_aura_task(id)

PHP Code:
public swarm_aura_task(id)
{
    
// Not a Zombie, invalid class id, not alive
    
if(!zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_zombie_class(id) != g_iZSwarmID || !is_user_alive(id))
    {
        
//remove_task(id) Unnecesary
        
return
    }
    
    
// Retrieve player origin
    
static iOrigin[3]            
    
get_user_origin(idiOrigin)
    
    
// Colored Aura
    
message_begin(MSG_PVSSVC_TEMPENTITYiOrigin)
    
write_byte(TE_DLIGHT// TE id
    
write_coord(iOrigin[0]) // x
    
write_coord(iOrigin[1]) // y
    
write_coord(iOrigin[2]) // z
    
write_byte(10// radius
    
write_byte(0// r
    
write_byte(0// g
    
write_byte(255)  // b 
    
write_byte(2// life
    
write_byte(0// decay rate
    
message_end()

    
set_task(0.1"swarm_aura_task"id)

remove_task(id) remove ALL user task (task setted by others plugins too)
__________________
Javivi is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 12-28-2009 , 13:31   Re: [help]how to add aura to zclass
Reply With Quote #9

Quote:
Originally Posted by Javivi View Post
Better...
PHP Code:
public zp_user_infected_post(idinfectornemesis)
{
    
// Selected class
    
if(zp_get_user_zombie_class(id) == g_iZSwarmID && !nemesis)
        
swarm_aura_task(id)

PHP Code:
public swarm_aura_task(id)
{
    
// Not a Zombie, invalid class id, not alive
    
if(!zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_zombie_class(id) != g_iZSwarmID || !is_user_alive(id))
    {
        
//remove_task(id) Unnecesary
        
return
    }
    
    
// Retrieve player origin
    
static iOrigin[3]            
    
get_user_origin(idiOrigin)
    
    
// Colored Aura
    
message_begin(MSG_PVSSVC_TEMPENTITYiOrigin)
    
write_byte(TE_DLIGHT// TE id
    
write_coord(iOrigin[0]) // x
    
write_coord(iOrigin[1]) // y
    
write_coord(iOrigin[2]) // z
    
write_byte(10// radius
    
write_byte(0// r
    
write_byte(0// g
    
write_byte(255)  // b 
    
write_byte(2// life
    
write_byte(0// decay rate
    
message_end()

    
set_task(0.1"swarm_aura_task"id)

remove_task(id) remove ALL user task (task setted by others plugins too)
More bad o.O

My one is better, you are calling the task all the time.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Javivi
AlliedModders Donor
Join Date: Dec 2008
Old 12-28-2009 , 13:50   Re: [help]how to add aura to zclass
Reply With Quote #10

Its the same i think o.q.

But should not use remove_task(id).

Use task ids
__________________
Javivi 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 11:50.


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