PHP Code:
#include <amxmodx>
#include <zombieplague>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#include <fakemeta>
#include <xs>
#define PLUGIN "[EI] Dynamic deagle"
#define VERSION "beta"
#define AUTHOR "twistedeuphoria/Emp`" //edited for usual zombieplague by Doomsday.
#define DEAGLE_COST 150
#define DEAGLE_FROST 1.0
#define DEAGLE_FIRE 3
#define DEAGLE_POWER 300.0
#define DEAGLE_SHOCK 500.0
#define DEAGLE_HEALTH 200
#define DEAGLE_AP_MIN 5
#define DEAGLE_AP_MAX 25
new has_deagle[33]
new g_msgScreenFade
new g_itemid_dd
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
zp_register_extra_item("Dynamic deagle", DEAGLE_COST, ZP_TEAM_HUMAN);
register_event("DeathMsg", "death", "a");
g_msgScreenFade = get_user_msgid("ScreenFade");
RegisterHam(Ham_TakeDamage, "player", "HamPreDamage");
}
public zp_extra_item_selected(idattacker, itemid)
{
if ( itemid == g_itemid_dd )
{
has_deagle[idattacker] = true
give_item(idattacker, "weapon_deagle")
cs_set_user_bpammo(idattacker, CSW_DEAGLE, 254)
}
}
public client_connect(id)
has_deagle[id] = false
public client_disconnect(id)
{
has_deagle[id] = false
}
public death(id)
has_deagle[id] = false
public zp_user_infected_post(id, infector)
has_deagle[id] = false
public HamPreDamage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if( has_deagle[idattacker] && get_user_weapon(idattacker) == CSW_DEAGLE && !zp_get_user_nemesis(this))
{
switch( random(8) )
{
case 1:
{
zp_set_user_frozen(this, 1, DEAGLE_FROST);
client_print(idattacker, print_center, "Dynamic Deagle: Frost Shot");
client_print(this, print_center, "Dynamic Deagle: Frost Shot");
}
case 2:
{
zp_set_user_burn(this, DEAGLE_FIRE);
client_print(idattacker, print_center, "Dynamic Deagle: Fire Shot");
client_print(this, print_center, "Dynamic Deagle: Fire Shot");
}
case 3:
{
client_print(idattacker, print_center, "Dynamic Deagle: Black Shot");
client_print(this, print_center, "Dynamic Deagle: Black Shot");
message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, this)
write_short(UNIT_SECOND) // duration
write_short(0) // hold time
write_short(FFADE_IN) // fade type
write_byte(0) // red
write_byte(0) // green
write_byte(0) // blue
write_byte(255) // alpha
message_end()
}
case 4:
{
client_print(idattacker, print_center, "Dynamic Deagle: White Shot");
client_print(this, print_center, "Dynamic Deagle: White Shot");
message_begin(MSG_ONE_UNRELIABLE, g_msgScreenFade, _, this)
write_short(UNIT_SECOND) // duration
write_short(0) // hold time
write_short(FFADE_IN) // fade type
write_byte(255) // red
write_byte(255) // green
write_byte(255) // blue
write_byte(255) // alpha
message_end()
}
case 5:
{
client_print(idattacker, print_center, "Dynamic Deagle: Power Shot");
client_print(this, print_center, "Dynamic Deagle: Power Shot");
SetHamParamFloat(4, damage+DEAGLE_POWER);
}
case 6:
{
client_print(idattacker, print_center, "Dynamic Deagle: Shock Shot");
client_print(this, print_center, "Dynamic Deagle: Shock Shot");
new Float:start_origin[3], Float:end_origin[3];
pev(idattacker, pev_origin, start_origin);
pev(this, pev_origin, end_origin);
start_origin[0] = end_origin[0] - start_origin[0];
start_origin[1] = end_origin[1] - start_origin[1];
start_origin[2] = 0.0;
xs_vec_normalize( start_origin, end_origin );
end_origin[0] *= DEAGLE_SHOCK;
end_origin[1] *= DEAGLE_SHOCK;
end_origin[2] = 50.0;
set_pev(this, pev_velocity, end_origin);
SetHamParamFloat(4, 0.0);
}
case 7:
{
client_print(idattacker, print_center, "Dynamic Deagle: Zombie Health Shot");
client_print(this, print_center, "Dynamic Deagle: Zombie Health Shot");
set_user_health(this, get_user_health(this)+DEAGLE_HEALTH);
}
default:
{
new ap_give = random_num(DEAGLE_AP_MIN,DEAGLE_AP_MAX);
client_print(idattacker, print_center, "Dynamic Deagle: +%d AP Shot",ap_give);
zp_set_user_ammo_packs(idattacker, zp_get_user_ammo_packs(idattacker)+ap_give);
}
}
}
}