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

Help Zombie Boomer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
felipemilralze
Senior Member
Join Date: Jul 2011
Location: Brazil
Old 06-02-2014 , 16:30   Help Zombie Boomer
Reply With Quote #1

someone can take the infection to explode and leave only death

PHP Code:
/*================================================================================
 * Please don't change plugin register information.
================================================================================*/
#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#include <colorchat>
#define DAMAGE_TYPE_IS_INFECT
#if defined DAMAGE_TYPE_IS_INFECT
#define GET_DAMAGE_JUST_INFECT
#endif
#define PLUGIN_NAME "[ZP] Zombie Class: Boomer"
#define PLUGIN_VERSION "1.2"
#define PLUGIN_AUTHOR "Jim"
#define Explo_MaxDamage 570
#define Explo_MinDamage 250
#define Sub_Damage_Value (Explo_MaxDamage - Explo_MinDamage)
#define LastZombie_Lower_Health 100
// Self Explosion Zombie Attributes
new const zclass_name[] = { "Boomer Zombie" }
new const 
zclass_info[] = { "Explodes After Death" }
new const 
zclass_model[] = { "zombie_source" }
new const 
zclass_clawmodel[] = { "v_knife_zombie.mdl" }
const 
zclass_health 2750
const zclass_speed 235
const Float:zclass_gravity 1.25
const Float:zclass_knockback 1.95
new const sound_player_die[] = {"player/die1.wav" }
new const 
sound_player_pain[] = { "player/pl_pain2.wav" }
new 
g_exploSpr_1g_exploSpr_2
new g_msgScoreAttribg_msgScoreInfo
new g_zclass_explo
new g_explo_range
new bool:g_can_explo[33], bool:explo_started[33]
public 
plugin_init()
{
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
g_explo_range register_cvar("zp_boomer_explo_range""275.0")
    
register_event("ResetHUD","NewRound","be")
    
register_event("DeathMsg""Death""a")
    
g_msgScoreAttrib get_user_msgid("ScoreAttrib")
    
g_msgScoreInfo get_user_msgid("ScoreInfo")
}
public 
plugin_precache()
{
 
engfunc(EngFunc_PrecacheSoundsound_player_die)
 
engfunc(EngFunc_PrecacheSoundsound_player_pain)
 
g_exploSpr_1 engfunc(EngFunc_PrecacheModel"sprites/fexplo1.spr")
 
g_exploSpr_2 engfunc(EngFunc_PrecacheModel"sprites/explode1.spr")
 
 
g_zclass_explo zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockback)
}
public 
zp_user_infected_post(idinfector)
{
 if (
zp_get_user_zombie_class(id) == g_zclass_explo && !zp_get_user_nemesis(id))
 {
  
g_can_explo[id] = true
  ColorChat
(idGREEN,"[ZP]^x01 You are a^x03 Boomer Zombie^x01. You will explode after you die killing near players!")
 }
}
public 
zp_user_humanized_post(id)
{
 
g_can_explo[id] = false
}
public 
client_PreThink(id)
{
 if (!
g_can_explo[id])
  return 
PLUGIN_CONTINUE
 
 
if (zp_get_user_last_zombie(id) && (get_user_health(id) < LastZombie_Lower_Health))
 {
  
g_can_explo[id] = false
  explo_process
(id)
 }
 
 if (
is_user_alive(id))
  return 
PLUGIN_CONTINUE
 
 
if (explo_started[id])
 {
  
//new name[32]
  //get_user_name(id, name, 31)
  //client_print(0, print_chat, "*** %s has exploded!", name)
  
  
g_can_explo[id] = false
  explo_started
[id] = false
  explo_process
(id)
 }
 
 return 
PLUGIN_CONTINUE
}
public 
explo_process(id)
{
 new 
Float:origin[3]
 
pev(idpev_originorigin)
 
create_sprite(origing_exploSpr_1)
 
create_sprite(origing_exploSpr_2)
 
create_explo2(origin)
 
 new 
target[32], Float:t_range[32], numFloat:range
 range 
get_pcvar_float(g_explo_range)
 
zp_get_in_range_target(idtargett_rangenumrange2)
 
 new 
Float:velocity[3]
 new 
damagehealtharmorkillsfragsdeaths
 
 
#if defined DAMAGE_TYPE_IS_INFECT
 
new bool:infect_round
 
if (zp_is_nemesis_round() || zp_is_survivor_round() || zp_is_swarm_round())
  
infect_round false
 
else
  
infect_round true
 
#endif
 
 
kills 0
 
 
for (new 0numi++)
 {
  if (
is_user_alive(target[i]))
  {
   
get_speed_vector_to(idtarget[i], 800.0velocity)
   
velocity[2] += 50.0
   set_pev
(target[i], pev_velocityvelocity)
   
   
damage Explo_MaxDamage floatround(float(Sub_Damage_Value) *  t_range[i] / get_pcvar_float(g_explo_range))
   
health get_user_health(target[i])
   
armor get_user_armor(target[i])
   
   if (
armor 0)
   {
    if (
armor damage)
    {
     
fm_set_user_armor(target[i], armor damage)
     
damage -= floatround(float(damage) / 3.0)
    }
    else
    {
     
fm_set_user_armor(target[i], 0)
     
damage -= floatround(float(armor) / 3.0)
    }
   }
   
   if (
health damage)
   {
    
#if defined GET_DAMAGE_JUST_INFECT
    
if (!infect_round || zp_get_user_last_human(target[i]))
    {
     
fm_set_user_health(target[i], health damage)
     
PlaySound(target[i], sound_player_pain)
    }
    else
    {
     
kills++
     
zp_infect_user(target[i])
     
frags get_user_frags(target[i])
     
deaths get_user_deaths(target[i]) + 1
     fm_set_user_deaths
(target[i], deaths)
     
FixDeadAttrib(target[i])
     
Update_ScoreInfo(target[i], fragsdeaths)
    }
    
#else
    
fm_set_user_health(target[i], health damage)
    
PlaySound(target[i], sound_player_pain)
    
#endif
   
}
   else
   {
    
kills++
    
    
#if defined DAMAGE_TYPE_IS_INFECT
    
if (!infect_round || zp_get_user_last_human(target[i]))
    {
     
fm_set_user_health(target[i], 0)
     
PlaySound(target[i], sound_player_die)
     
frags get_user_frags(target[i]) + 1
     deaths 
get_user_deaths(target[i])
     
fm_set_user_frags(target[i], frags)
    }
    else
    {
     
zp_infect_user(target[i])
     
frags get_user_frags(target[i])
     
deaths get_user_deaths(target[i]) + 1
     fm_set_user_deaths
(target[i], deaths)
    }
    
#else
    
fm_set_user_health(target[i], 0)
    
PlaySound(target[i], sound_player_die)
    
frags get_user_frags(target[i]) + 1
    deaths 
get_user_deaths(target[i])
    
fm_set_user_frags(target[i], frags)
    
#endif
    
    
FixDeadAttrib(target[i])
    
Update_ScoreInfo(target[i], fragsdeaths)
   }
  }
 }
 
 
zp_set_user_ammo_packs(idzp_get_user_ammo_packs(id) + kills)
 
frags get_user_frags(id) + kills
 
 
if (is_user_alive(id))
 {
  
fm_set_user_health(id0)
  
PlaySound(idsound_player_die)
 }
 
 
deaths get_user_deaths(id)
 
fm_set_user_frags(idfrags)
 
FixDeadAttrib(id)
 
Update_ScoreInfo(idfragsdeaths)
}
public 
client_connect(id)
{
 
g_can_explo[id] = false
 explo_started
[id] = false
 
 
return PLUGIN_CONTINUE
}
public 
client_disconnect(id)
{
 
g_can_explo[id] = false
 explo_started
[id] = false
 
 
return PLUGIN_CONTINUE
}
public 
NewRound(id)
{
 
g_can_explo[id] = false
 explo_started
[id] = false
}
public 
Death()
{
 new 
player read_data(2)
 if (
g_can_explo[player])
  
explo_started[player] = true
}
stock zp_get_in_range_target(idtarget[32], Float:target_range[32], &target_numFloat:rangeflag 0// flag: 0=Different, 1=Zombie, 2=Human
{
 new 
Float:origin1[3], Float:origin2[3]
 
pev(idpev_originorigin1);
 
 
target_num 0
 
 
static iFloat:i_range
 
for (1<= 32i++)
 {
  if ((
!= id) && is_user_alive(i))
  {
   
pev(ipev_originorigin2);
   
i_range get_distance_f(origin1origin2);
   
   if (
i_range <= range)
   {
    if ((
flag == 0) && (zp_get_user_zombie(id) != zp_get_user_zombie(i)))
    {
     
target[target_num] = i
     target_range
[target_num] = i_range
     target_num
++
    }
    else if ((
flag == 1) && zp_get_user_zombie(i))
    {
     
target[target_num] = i
     target_range
[target_num] = i_range
     target_num
++
    }
    else if ((
flag == 2) && !zp_get_user_zombie(i))
    {
     
target[target_num] = i
     target_range
[target_num] = i_range
     target_num
++
    }
   }
  }
 }
}
stock get_speed_vector_to(ent1ent2Float:speedFloat:new_velocity[3])
{
 if(!
pev_valid(ent1) || !pev_valid(ent2))
  return 
0;
 
 static 
Float:origin1[3]
 
pev(ent1,pev_origin,origin1)
 static 
Float:origin2[3]
 
pev(ent2,pev_origin,origin2)
 
 
new_velocity[0] = origin2[0] - origin1[0];
 
new_velocity[1] = origin2[1] - origin1[1];
 
new_velocity[2] = origin2[2] - origin1[2];
 
 static 
Float:num
 num 
speed vector_length(new_velocity);
    
 
new_velocity[0] *= num;
 
new_velocity[1] *= num;
 
new_velocity[2] *= num;
 
 return 
1;
}
stock fm_set_user_health(indexhealth)
{
 
health set_pev(indexpev_healthfloat(health)) : dllfunc(DLLFunc_ClientKillindex);
 
 return 
1;
}
stock fm_set_user_armor(indexarmor)
{
 
set_pev(indexpev_armorvaluefloat(armor));
 return 
1;
}
stock fm_set_user_frags(indexfrags)
{
 
set_pev(indexpev_fragsfloat(frags));
 
 return 
1;
}
#if defined DAMAGE_TYPE_IS_INFECT
stock fm_set_user_deaths(indexdeaths// Set User Deaths
{
 
set_pdata_int(index444deaths5)
}
#endif
create_sprite(const Float:originF[3], sprite_index)
{
 
// Sprite
 
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
 
write_byte(TE_SPRITE// TE id (Additive sprite, plays 1 cycle)
 
engfunc(EngFunc_WriteCoordoriginF[0]) // x
 
engfunc(EngFunc_WriteCoordoriginF[1]) // y
 
engfunc(EngFunc_WriteCoordoriginF[2]) // z
 
write_short(sprite_index// sprite index
 
write_byte(10// scale in 0.1's
 
write_byte(200// brightness
 
message_end()
}
create_explo2(const Float:originF[3])
{
 
// WTF
 
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
 
write_byte(TE_EXPLOSION2// TE id: 12
 
engfunc(EngFunc_WriteCoordoriginF[0]) // x
 
engfunc(EngFunc_WriteCoordoriginF[1]) // y
 
engfunc(EngFunc_WriteCoordoriginF[2]) // z
 
write_byte(1// starting color
 
write_byte(10// num colors
 
message_end()
}
PlaySound(id, const sound[])
{
 if (
equal(sound[strlen(sound)-4], ".mp3"))
  
client_cmd(id"mp3 play ^"sound/%s^""sound)
 else
  
client_cmd(id"spk ^"%s^""sound)
}
FixDeadAttrib(id// Fix Dead Attrib on scoreboard
{
 
message_begin(MSG_BROADCASTg_msgScoreAttrib)
 
write_byte(id// id
 
write_byte(0// attrib
 
message_end()
}
Update_ScoreInfo(idfragsdeaths// Update Player's Frags and Deaths
{
 
// Update scoreboard with attacker's info
 
message_begin(MSG_BROADCASTg_msgScoreInfo)
 
write_byte(id// id
 
write_short(frags// frags
 
write_short(deaths// deaths
 
write_short(0// class
 
write_short(get_user_team(id)) // team
 
message_end()

felipemilralze is offline
Send a message via MSN to felipemilralze Send a message via Skype™ to felipemilralze
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 21:39.


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