Member
Join Date: Jan 2022
Location: Palestine
|
01-24-2022
, 11:26
[Requst] Help on Replace Skill of Zm class
|
#1
|
hello dears , hope all are well !
i have zm class and it have 2 skills , and all what i want is replace these 2 skilles with :
1st one : by press key "G" the zm will get fast run for 4 Secounds [ Value = 330 ] and it's countdown be 30 sec
2nd one : dropping fire ball by using "R" and its countdown be 20 sec.
and i will attach the code of the sma file of zm which i want the changes
and i will attach 2 zm codes sma to get the codes from it and use on the main one to replace .
i hope someone help on this and i am sure you guys are the best
-------------------------------------------
the main zm sma code "Which i want replace the 2 skills"
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <zombieplague>
#include <xs>
// [ Setting's ]
#define ZP_ZCLASS_NAME "Sting Finger"
#define ZP_ZCLASS_INFO "E - Graivty | G - Tentacles"
#define ZP_ZCLASS_MODEL "resident_zombi_host"
#define ZP_ZCLASS_CLAW "v_knife_zombieresident.mdl"
#define ZCLASS_SOUND_TENTACLES "zombi/resident_skill2.wav"
#define ZCLASS_SOUND_GRAVITY "zombi/resident_skill1.wav"
#define ZCLASS_SOUND_REMOVE_ABIL "zombi/resident_tw.wav"
#define ZP_ZCLASS_HEALTH 1700
#define ZP_ZCLASS_SPEED 240
#define ZP_ZCLASS_GRAVITY 1.0
#define ZP_ZCLASS_KNOCKBACK 1.8
#define ZCLASS_SPECIAL_GRAIVTY 0.2 // Сколько выставлять гравитации при юзании способности гравитации
#define ZCLASS_GRAVITY_WAIT 30.0 // Отсчет до использования способности гравитации
#define ZCLASS_GRAVITY_DURATION 5.0 // Сколько продлится способность гравитации
#define ZCLASS_TENTACLES_DAMAGE 100.0 // Дамаг при использовании тентаклей
#define ZCLASS_TENTACLES_DISTANCE 180.0 // Максимальная дистанция, до куда могут достать тентакли
#define ZCLASS_TENTACLES_WAIT 25.0 // Отсчет до использования способности тентаклей
// [ Offset's ]
#define m_flNextAttack 83
// [ MsgId's ]
#define MsgId_SayText 76
#define MsgId_ScreenFade 98
// [ Other ]
#define TASK_HUD_WAIT 65234
#define TASK_REMOVE_GRAVITY 23542
new g_iClassID, g_iMaxPlayers, Float: g_flGravityWait[33], Float: g_flTentaclesWait[33];
public plugin_precache()
{
engfunc(EngFunc_PrecacheSound, ZCLASS_SOUND_TENTACLES);
engfunc(EngFunc_PrecacheSound, ZCLASS_SOUND_GRAVITY);
engfunc(EngFunc_PrecacheSound, ZCLASS_SOUND_REMOVE_ABIL);
g_iClassID = zp_register_zombie_class(ZP_ZCLASS_NAME, ZP_ZCLASS_INFO, ZP_ZCLASS_MODEL, ZP_ZCLASS_CLAW, ZP_ZCLASS_HEALTH, ZP_ZCLASS_SPEED, ZP_ZCLASS_GRAVITY, ZP_ZCLASS_KNOCKBACK);
}
public plugin_init()
{
register_plugin("[ZP | AMXX] Sting Finger", "0/0/1", "m0rt3m");
register_event("HLTV", "Event__RoundStart", "a", "1=0", "2=0");
RegisterHam(Ham_ObjectCaps, "player", "HamHook__ObjectCaps_Post", 1);
register_clcmd("drop", "ClCmd__Drop");
g_iMaxPlayers = get_maxplayers();
}
public HamHook__ObjectCaps_Post(iPlayer)
{
if(!is_user_alive(iPlayer) || !zp_get_user_zombie(iPlayer) || zp_get_user_zombie_class(iPlayer) != g_iClassID)
return;
static Float: flGameTime; flGameTime = get_gametime();
if(g_flGravityWait[iPlayer] <= flGameTime)
{
if(pev(iPlayer, pev_button) & IN_USE)
{
UTIL_WeaponAnimation(iPlayer, 9);
UTIL_ScreenFade(iPlayer, (1<<12), (1<<12), 0x0000, 255, 255, 255, 80);
set_pdata_float(iPlayer, m_flNextAttack, 1.5);
set_pev(iPlayer, pev_gravity, ZCLASS_SPECIAL_GRAIVTY);
emit_sound(iPlayer, CHAN_AUTO, ZCLASS_SOUND_GRAVITY, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
g_flGravityWait[iPlayer] = flGameTime + ZCLASS_GRAVITY_WAIT;
if(!task_exists(iPlayer + TASK_HUD_WAIT))
set_task(1.0, "Task__HudWait", iPlayer + TASK_HUD_WAIT, _, _, "b");
set_task(ZCLASS_GRAVITY_DURATION, "Task__RemoveGravity", iPlayer + TASK_REMOVE_GRAVITY);
}
}
}
public ClCmd__Drop(iPlayer)
{
if(!is_user_alive(iPlayer) || !zp_get_user_zombie(iPlayer) || zp_get_user_zombie_class(iPlayer) != g_iClassID)
return;
static Float: flGameTime; flGameTime = get_gametime();
if(g_flTentaclesWait[iPlayer] <= flGameTime)
{
UTIL_WeaponAnimation(iPlayer, 8);
UTIL_ScreenFade(iPlayer, (1<<12), (1<<12), 0x0000, 0, 255, 0, 80);
set_pdata_float(iPlayer, m_flNextAttack, 1.5);
emit_sound(iPlayer, CHAN_AUTO, ZCLASS_SOUND_TENTACLES, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
new Float: vecAngles[3]; pev(iPlayer, pev_v_angle, vecAngles);
new Float: vecStart[3]; pev(iPlayer, pev_origin, vecStart);
new Float: vecVelocity[3]; angle_vector(vecAngles, ANGLEVECTOR_FORWARD, vecVelocity);
new Float: vecViewOfs[3]; pev(iPlayer, pev_view_ofs, vecViewOfs);
new Float: vecEnd[3];
vecEnd[0] += vecStart[0] + vecViewOfs[0] + vecVelocity[0] * ZCLASS_TENTACLES_DISTANCE;
vecEnd[1] += vecStart[1] + vecViewOfs[1] + vecVelocity[1] * ZCLASS_TENTACLES_DISTANCE;
vecEnd[2] += vecStart[2] + vecViewOfs[2] + vecVelocity[2] * ZCLASS_TENTACLES_DISTANCE;
static pHit; pHit = iPlayer;
static iTrace; iTrace = create_tr2();
while(pHit)
{
engfunc(EngFunc_TraceLine, vecStart, vecEnd, DONT_IGNORE_MONSTERS, pHit, iTrace);
pHit = get_tr2(iTrace, TR_pHit);
if(!is_user_alive(pHit))
break;
get_tr2(iTrace, TR_vecEndPos, vecStart);
ExecuteHamB(Ham_TakeDamage, pHit, iPlayer, iPlayer, ZCLASS_TENTACLES_DAMAGE, DMG_SONIC);
}
free_tr2(iTrace);
g_flTentaclesWait[iPlayer] = flGameTime + ZCLASS_TENTACLES_WAIT;
if(!task_exists(iPlayer + TASK_HUD_WAIT))
set_task(1.0, "Task__HudWait", iPlayer + TASK_HUD_WAIT, _, _, "b");
}
}
public client_disconnect(iPlayer) Reset__Values(iPlayer);
public zp_user_infected_post(iPlayer) Reset__Values(iPlayer);
public zp_user_humanized_post(iPlayer) Reset__Values(iPlayer);
public Event__RoundStart()
{
for(new pPlayer = 1; pPlayer <= g_iMaxPlayers; pPlayer++)
{
if(!is_user_connected(pPlayer))
continue;
Reset__Values(pPlayer);
}
}
public Reset__Values(iPlayer)
{
remove_task(iPlayer+TASK_HUD_WAIT);
remove_task(iPlayer+TASK_REMOVE_GRAVITY);
g_flGravityWait[iPlayer] = 0.0;
g_flTentaclesWait[iPlayer] = 0.0;
}
// [ Task's ]
public Task__HudWait(pPlayer)
{
pPlayer -= TASK_HUD_WAIT;
if(!is_user_alive(pPlayer) || !zp_get_user_zombie(pPlayer) || zp_get_user_nemesis(pPlayer))
{
remove_task(pPlayer+TASK_HUD_WAIT);
return;
}
new szGravityWait[256], szTentaclesWait[256];
static Float: flGameTime; flGameTime = get_gametime();
if(g_flGravityWait[pPlayer] <= flGameTime && g_flTentaclesWait[pPlayer] <= flGameTime) remove_task(pPlayer + TASK_HUD_WAIT);
if(g_flGravityWait[pPlayer] > flGameTime) formatex(szGravityWait, charsmax(szGravityWait), "Гравитация: [%d]^n", floatround(g_flGravityWait[pPlayer] - flGameTime));
else szGravityWait = ""
if(g_flTentaclesWait[pPlayer] > flGameTime) formatex(szTentaclesWait, charsmax(szTentaclesWait), "Щупальцы: [%d]^n", floatround(g_flTentaclesWait[pPlayer] - flGameTime));
else szTentaclesWait = ""
set_hudmessage(250, 180, 30, 0.75, 0.92, 0, 1.0, 1.1, 0.0, 0.0, -1);
show_hudmessage(pPlayer, "%s%s", szGravityWait, szTentaclesWait);
}
public Task__RemoveGravity(pPlayer)
{
pPlayer -= TASK_REMOVE_GRAVITY;
if(!is_user_alive(pPlayer) || !zp_get_user_zombie(pPlayer) || zp_get_user_nemesis(pPlayer))
{
remove_task(pPlayer+TASK_REMOVE_GRAVITY);
return;
}
set_pev(pPlayer, pev_gravity, ZP_ZCLASS_GRAVITY);
emit_sound(pPlayer, CHAN_AUTO, ZCLASS_SOUND_REMOVE_ABIL, VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
}
// [ Stock's ]
stock UTIL_WeaponAnimation(pPlayer, iAnimation)
{
set_pev(pPlayer, pev_weaponanim, iAnimation);
engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, {0.0, 0.0, 0.0}, pPlayer);
write_byte(iAnimation);
write_byte(0);
message_end();
}
stock UTIL_ScreenFade(pPlayer, iDuration, iHoldTime, iFlags, iRed, iGreen, iBlue, iAlpha, iReliable = 0)
{
switch(pPlayer)
{
case 0:
{
message_begin(iReliable ? MSG_ALL : MSG_BROADCAST, MsgId_ScreenFade);
write_short(iDuration);
write_short(iHoldTime);
write_short(iFlags);
write_byte(iRed);
write_byte(iGreen);
write_byte(iBlue);
write_byte(iAlpha);
message_end();
}
default:
{
engfunc(EngFunc_MessageBegin, iReliable ? MSG_ONE : MSG_ONE_UNRELIABLE, MsgId_ScreenFade, {0.0, 0.0, 0.0}, pPlayer);
write_short(iDuration);
write_short(iHoldTime);
write_short(iFlags);
write_byte(iRed);
write_byte(iGreen);
write_byte(iBlue);
write_byte(iAlpha);
message_end();
}
}
}
stock UTIL_SayText(pPlayer, const szMessage[], any:...)
{
new szBuffer[190];
if(numargs() > 2) vformat(szBuffer, charsmax(szBuffer), szMessage, 3);
else copy(szBuffer, charsmax(szBuffer), szMessage);
while(replace(szBuffer, charsmax(szBuffer), "!y", "^1")) {}
while(replace(szBuffer, charsmax(szBuffer), "!t", "^3")) {}
while(replace(szBuffer, charsmax(szBuffer), "!g", "^4")) {}
switch(pPlayer)
{
case 0:
{
for(new iPlayer = 1; iPlayer <= g_iMaxPlayers; iPlayer++)
{
if(!is_user_connected(iPlayer)) continue;
engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, MsgId_SayText, {0.0, 0.0, 0.0}, iPlayer);
write_byte(iPlayer);
write_string(szBuffer);
message_end();
}
}
default:
{
engfunc(EngFunc_MessageBegin, MSG_ONE_UNRELIABLE, MsgId_SayText, {0.0, 0.0, 0.0}, pPlayer);
write_byte(pPlayer);
write_string(szBuffer);
message_end();
}
}
}
----------------------------------------------------
The sma codes of the fast zm :
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <zombieplague>
#include <levels>
#define PLUGIN "NST Zombie Class Tank"
#define VERSION "1.0.1"
#define AUTHOR "NST"
new const zclass_name[] = "Speed Zombie (Fast)"
new const zclass_info[] = "[Skill Botton 'G']"
new const zclass_model[] = "tank_zombi_royalz"
new const zclass_clawmodel[] = "v_knife_tank_zombi.mdl"
const zclass_health = 15000
const zclass_speed = 300
const Float:zclass_gravity = 0.68
const Float:zclass_knockback = 3.00
const zclass_level = 10
new idclass
const Float:fastrun_time = 10.0
const Float:fastrun_timewait = 15.0
const Float:fastrun_speed = 340.0
new const sound_fastrun_start[] = "ze_royalz/zombi_pressure.wav"
new const sound_fastrun_heartbeat[][] = {"ze_royalz/zombi_pre_idle_1.wav", "ze_royalz/zombi_pre_idle_2.wav"}
const fastrun_dmg = 500
const fastrun_fov = 105
const glow_red = 255
const glow_green = 3
const glow_blue = 0
new g_fastrun[33], g_fastrun_wait[33]
new g_msgSayText, g_msgSetFOV
new g_maxplayers
new g_roundend
enum (+= 100)
{
TASK_FASTRUN = 2000,
TASK_FASTRUN_HEARTBEAT,
TASK_FASTRUN_WAIT,
TASK_BOT_USE_SKILL
}
#define ID_FASTRUN (taskid - TASK_FASTRUN)
#define ID_FASTRUN_HEARTBEAT (taskid - TASK_FASTRUN_HEARTBEAT)
#define ID_FASTRUN_WAIT (taskid - TASK_FASTRUN_WAIT)
#define ID_BOT_USE_SKILL (taskid - TASK_BOT_USE_SKILL)
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_event("DeathMsg", "Death", "a")
register_event("CurWeapon","EventCurWeapon","be","1=1")
register_logevent("logevent_round_end", 2, "1=Round_End")
register_clcmd("drop", "cmd_fastrun")
g_msgSayText = get_user_msgid("SayText")
g_msgSetFOV = get_user_msgid("SetFOV")
g_maxplayers = get_maxplayers()
}
public plugin_precache()
{
new i
for(i = 0; i < sizeof sound_fastrun_heartbeat; i++ )
{
precache_sound(sound_fastrun_heartbeat[i]);
}
precache_sound(sound_fastrun_start)
idclass = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback, zclass_level)
}
public client_putinserver(id)
{
reset_value_player(id)
}
public client_disconnect(id)
{
reset_value_player(id)
}
public event_round_start()
{
g_roundend = 0
for (new id=1; id<=g_maxplayers; id++)
{
if (!is_user_connected(id)) continue;
reset_value_player(id)
}
}
public logevent_round_end()
{
g_roundend = 1
}
public Death()
{
new victim = read_data(2)
reset_value_player(victim)
}
public EventCurWeapon(id)
{
if(!is_user_alive(id)) return PLUGIN_CONTINUE;
new extrahiz;
if(get_user_level(id) >= 10 && get_user_level(id) <= 19)
{
extrahiz = 10
}
else if(get_user_level(id) >= 20 && get_user_level(id) <= 29)
{
extrahiz = 20
}
else if(get_user_level(id) >= 30)
{
extrahiz = 30
}
if(g_fastrun[id]) set_user_maxspeed(id, (fastrun_speed+extrahiz));
return PLUGIN_CONTINUE;
}
public zp_user_infected_post(id)
{
reset_value_player(id)
if(zp_get_user_nemesis(id)) return;
if(zp_get_user_zombie_class(id) == idclass)
{
if(is_user_bot(id))
{
set_task(random_float(5.0,15.0), "bot_use_skill", id+TASK_BOT_USE_SKILL)
return
}
zp_colored_print(id, "^x04[RoyalZ]^x01 Your class's ability is Quick Run. Load time %.1f seconds.", fastrun_timewait)
}
}
public zp_user_humanized_post(id)
{
if(g_fastrun[id]) EffectFastrun(id);
reset_value_player(id)
}
public zp_user_unfrozen(id)
{
if(g_fastrun[id]) set_user_rendering(id, kRenderFxGlowShell, glow_red, glow_green, glow_blue, kRenderNormal, 0)
}
public cmd_fastrun(id)
{
if (g_roundend) return PLUGIN_CONTINUE
if (!is_user_alive(id) || !zp_get_user_zombie(id) || zp_get_user_nemesis(id)) return PLUGIN_CONTINUE
new health = get_user_health(id) - fastrun_dmg
if (zp_get_user_zombie_class(id) == idclass && health>0 && !g_fastrun[id] && !g_fastrun_wait[id])
{
g_fastrun[id] = 1
set_user_health(id, health)
new extrahiz;
if(get_user_level(id) >= 10 && get_user_level(id) <= 19)
{
extrahiz = 10
}
else if(get_user_level(id) >= 20 && get_user_level(id) <= 29)
{
extrahiz = 20
}
else if(get_user_level(id) >= 30)
{
extrahiz = 30
}
set_user_maxspeed(id, (fastrun_speed+extrahiz))
set_user_rendering(id, kRenderFxGlowShell, glow_red, glow_green, glow_blue, kRenderNormal, 0)
EffectFastrun(id, fastrun_fov)
PlayEmitSound(id, sound_fastrun_start)
set_task(fastrun_time, "RemoveFastRun", id+TASK_FASTRUN)
set_task(2.0, "FastRunHeartBeat", id+TASK_FASTRUN_HEARTBEAT, _, _, "b")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public bot_use_skill(taskid)
{
new id = ID_BOT_USE_SKILL
if (!is_user_alive(id)) return;
cmd_fastrun(id)
set_task(random_float(5.0,15.0), "bot_use_skill", id+TASK_BOT_USE_SKILL)
}
public RemoveFastRun(taskid)
{
new id = ID_FASTRUN
g_fastrun[id] = 0
g_fastrun_wait[id] = 1
set_user_maxspeed(id, float(zclass_speed))
set_user_rendering(id)
EffectFastrun(id)
set_task(fastrun_timewait, "RemoveWaitFastRun", id+TASK_FASTRUN_WAIT)
}
public RemoveWaitFastRun(taskid)
{
new id = ID_FASTRUN_WAIT
g_fastrun_wait[id] = 0
zp_colored_print(id, "^x04[RoyalZ]^x01 Your Fast Running Ability is ready.")
}
public FastRunHeartBeat(taskid)
{
new id = ID_FASTRUN_HEARTBEAT
if (g_fastrun[id]) PlayEmitSound(id, sound_fastrun_heartbeat[random_num(0, sizeof sound_fastrun_heartbeat - 1)]);
else remove_task(taskid)
}
PlayEmitSound(id, const sound[])
{
emit_sound(id, CHAN_VOICE, sound, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
EffectFastrun(id, num = 90)
{
message_begin(MSG_ONE, g_msgSetFOV, {0,0,0}, id)
write_byte(num)
message_end()
}
reset_value_player(id)
{
g_fastrun[id] = 0
g_fastrun_wait[id] = 0
remove_task(id+TASK_FASTRUN)
remove_task(id+TASK_FASTRUN_HEARTBEAT)
remove_task(id+TASK_FASTRUN_WAIT)
remove_task(id+TASK_BOT_USE_SKILL)
}
zp_colored_print(target, const message[], any:...)
{
static buffer[512], i, argscount
argscount = numargs()
if (!target)
{
static player
for (player = 1; player <= g_maxplayers; player++)
{
if (!is_user_connected(player))
continue;
static changed[5], changedcount
changedcount = 0
for (i = 2; i < argscount; i++)
{
if (getarg(i) == LANG_PLAYER)
{
setarg(i, 0, player)
changed[changedcount] = i
changedcount++
}
}
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, player)
write_byte(player)
write_string(buffer)
message_end()
for (i = 0; i < changedcount; i++)
setarg(changed[i], 0, LANG_PLAYER)
}
}
else
{
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE, g_msgSayText, _, target)
write_byte(target)
write_string(buffer)
message_end()
}
}
============================
The sma codes of fire zm :
PHP Code:
#include <amxmodx>
#include <zombieplague>
#include <fakemeta>
#include <engine>
#include <hamsandwich>
#include <cstrike>
#include <xs>
// Task offsets
enum (+= 100) {
TASK_BURN
}
// IDs inside tasks
#define ID_BURN (taskid - TASK_BURN)
#define is_user_valid_alive(%1) (1 <= %1 <= g_maxplayers && is_user_alive(%1))
new const zclass_name[] = { "Toksic Zombi (Sting Finger)" }
new const zclass_info[] = { "[Yetenek Icin 'R']" }
new const zclass_model[] = { "dpcs_zm_toxic" }
new const zclass_clawmodel[] = { "v_knife_toxic.mdl" }
const zclass_health = 15000
const zclass_speed = 315
const Float:zclass_gravity = 0.68
const Float:zclass_knockback = 3.0
const zclass_lvl = 55
new g_Husk
new g_trailSpr
new const fire_model[] = "sprites/3dmflared.spr"
// Cooldown hook
new Float:g_iLastFire[33]
new cvar_firespeed, cvar_firecooldown, cvar_firedamage, cvar_fireduration, cvar_fireslowdown, cvar_fireradius, cvar_firesurvivor
new g_smokeSpr, g_flameSpr, g_exploSpr
new g_burning_duration[33] // burning task duration
new g_maxplayers
new attacker
new g_msgSayText
public plugin_init()
{
register_plugin("[ZP] Zombie Class: Zombie Husk", "0.2", "DJHD!")
cvar_firespeed = register_cvar("zp_husk_fire_speed", "700")
cvar_firecooldown = register_cvar("ze_husk_fire_cooldown", "20.0")
cvar_firedamage = register_cvar("zp_husk_fire_damage", "2.5")
cvar_fireduration = register_cvar("zp_husk_fire_duration", "2.5")
cvar_fireslowdown = register_cvar("zp_husk_fire_slowdown", "0.5")
cvar_fireradius = register_cvar("zp_husk_fire_radius", "220.0")
cvar_firesurvivor = register_cvar("zp_husk_fire_survivor", "1")
register_forward(FM_Touch, "fw_Touch")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
// HAM Forwards
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")
g_maxplayers = get_maxplayers()
g_msgSayText = get_user_msgid("SayText")
}
public plugin_precache()
{
g_Husk = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback, zclass_lvl)
engfunc(EngFunc_PrecacheModel, fire_model)
g_trailSpr = engfunc(EngFunc_PrecacheModel, "sprites/laserbeam.spr")
g_smokeSpr = engfunc(EngFunc_PrecacheModel, "sprites/black_smoke3.spr")
g_flameSpr = engfunc(EngFunc_PrecacheModel, "sprites/flame.spr")
g_exploSpr = engfunc(EngFunc_PrecacheModel, "sprites/zerogxplode.spr")
engfunc(EngFunc_PrecacheSound, "zombie_plague/husk_pre_fire.wav")
engfunc(EngFunc_PrecacheSound, "zombie_plague/husk_wind_down.wav")
engfunc(EngFunc_PrecacheSound, "zombie_plague/husk_fireball_fire.wav")
engfunc(EngFunc_PrecacheSound, "zombie_plague/husk_fireball_loop.wav")
engfunc(EngFunc_PrecacheSound, "zombie_plague/husk_fireball_explode.wav")
}
public zp_user_infected_post(id, infector)
{
if (zp_get_user_zombie_class(id) == g_Husk)
{
if(zp_get_user_nemesis(id))
return
g_iLastFire[id] = 0.0
zp_colored_print(id, "^x04[ZE]^x01 Sinifinin yetenegi Zehir Firlatma. Yuklenme suresi %.1f saniye.", get_cvar_num("ze_husk_fire_cooldown"))
}
}
public fw_PlayerPreThink(id)
{
if(!is_user_alive(id))
return;
static iButton; iButton = pev(id, pev_button)
static iOldButton; iOldButton = pev(id, pev_oldbuttons)
if(zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_Husk) && !zp_get_user_nemesis(id))
{
if((iButton & IN_RELOAD) && !(iOldButton & IN_RELOAD))
{
if(get_gametime() - g_iLastFire[id] < get_pcvar_float(cvar_firecooldown))
{
return;
}
g_iLastFire[id] = get_gametime()
message_begin(MSG_ONE, get_user_msgid("BarTime"), _, id)
write_byte(1)
write_byte(0)
message_end()
emit_sound(id, CHAN_ITEM, "zombie_plague/husk_pre_fire.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
set_task(1.0, "MakeFire", id)
}
if(iOldButton & IN_RELOAD && !(iButton & IN_RELOAD))
{
if(task_exists(id))
{
g_iLastFire[id] = 0.0
emit_sound(id, CHAN_ITEM, "zombie_plague/husk_wind_down.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
message_begin(MSG_ONE, get_user_msgid("BarTime"), _, id)
write_byte(0)
write_byte(0)
message_end()
remove_task(id)
}
}
}
// Ham Player Spawn Post Forward
public fw_PlayerSpawn_Post(id)
{
// Not alive or didn't join a team yet
if (!is_user_alive(id) || !cs_get_user_team(id))
return;
// Remove previous tasks
remove_task(id+TASK_BURN)
}
// Ham Player Killed Forward
public fw_PlayerKilled(victim, attacker, shouldgib)
{
// Stop burning
if (!zp_get_user_zombie(victim))
remove_task(victim+TASK_BURN)
}
public client_disconnect(id)
remove_task(id+TASK_BURN)
public MakeFire(id)
{
new Float:Origin[3]
new Float:vAngle[3]
new Float:flVelocity[3]
// Get position from eyes
get_user_eye_position(id, Origin)
// Get View Angles
entity_get_vector(id, EV_VEC_v_angle, vAngle)
new NewEnt = create_entity("info_target")
entity_set_string(NewEnt, EV_SZ_classname, "fireball")
entity_set_model(NewEnt, fire_model)
entity_set_size(NewEnt, Float:{ -1.5, -1.5, -1.5 }, Float:{ 1.5, 1.5, 1.5 })
entity_set_origin(NewEnt, Origin)
// Set Entity Angles (thanks to Arkshine)
make_vector(vAngle)
entity_set_vector(NewEnt, EV_VEC_angles, vAngle)
entity_set_int(NewEnt, EV_INT_solid, SOLID_BBOX)
entity_set_float(NewEnt, EV_FL_scale, 0.3)
entity_set_int(NewEnt, EV_INT_spawnflags, SF_SPRITE_STARTON)
entity_set_float(NewEnt, EV_FL_framerate, 25.0)
set_rendering(NewEnt, kRenderFxNone, 0, 0, 0, kRenderTransAdd, 255)
entity_set_int(NewEnt, EV_INT_movetype, MOVETYPE_FLY)
entity_set_edict(NewEnt, EV_ENT_owner, id)
// Set Entity Velocity
velocity_by_aim(id, get_pcvar_num(cvar_firespeed), flVelocity)
entity_set_vector(NewEnt, EV_VEC_velocity, flVelocity)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_BEAMFOLLOW) // TE id
write_short(NewEnt) // entity
write_short(g_trailSpr) // sprite
write_byte(5) // life
write_byte(6) // width
write_byte(255) // r
write_byte(0) // g
write_byte(0) // b
write_byte(255) // brightness
message_end()
set_task(0.2, "effect_fire", NewEnt, _, _, "b")
emit_sound(id, CHAN_ITEM, "zombie_plague/husk_fireball_fire.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(NewEnt, CHAN_ITEM, "zombie_plague/husk_fireball_loop.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
public effect_fire(entity)
{
if (!pev_valid(entity))
{
remove_task(entity)
return;
}
// Get origin
static Float:originF[3]
pev(entity, pev_origin, originF)
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(17)
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]+30) // z
write_short(g_flameSpr)
write_byte(5) // byte (scale in 0.1's) 188 - era 65
write_byte(200) // byte (framerate)
message_end()
// Smoke
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(5)
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
write_short(g_smokeSpr) // short (sprite index)
write_byte(13) // byte (scale in 0.1's)
write_byte(15) // byte (framerate)
message_end()
// Colored Aura
engfunc(EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_DLIGHT) // TE id
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[0]) // y
engfunc(EngFunc_WriteCoord, originF[0]) // z
write_byte(25) // radius
write_byte(255) // r
write_byte(128) // g
write_byte(0) // b
write_byte(2) // life
write_byte(3) // decay rate
message_end()
}
// Touch Forward
public fw_Touch(ent, id)
{
if (!pev_valid(ent))
return PLUGIN_HANDLED
new class[32]
pev(ent, pev_classname, class, charsmax(class))
if(equal(class, "fireball"))
{
attacker = entity_get_edict(ent, EV_ENT_owner)
husk_touch(ent)
engfunc(EngFunc_RemoveEntity, ent)
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
public husk_touch(ent)
{
if (!pev_valid(ent))
return;
// Get origin
static Float:originF[3]
pev(ent, pev_origin, originF)
// Explosion
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
write_short(g_exploSpr)
write_byte(40) // byte (scale in 0.1's) 188 - era 65
write_byte(25) // byte (framerate)
write_byte(TE_EXPLFLAG_NOSOUND) // byte flags
message_end()
emit_sound(ent, CHAN_ITEM, "zombie_plague/husk_fireball_explode.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
// Collisions
static victim
victim = -1
while ((victim = engfunc(EngFunc_FindEntityInSphere, victim, originF, get_pcvar_float(cvar_fireradius))) != 0)
{
// Only effect alive zombies
if (!is_user_valid_alive(victim) || zp_get_user_zombie(victim) || !get_pcvar_num(cvar_firesurvivor) && zp_get_user_survivor(victim))
continue;
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("Damage"), _, victim)
write_byte(0) // damage save
write_byte(0) // damage take
write_long(DMG_BURN) // damage type
write_coord(0) // x
write_coord(0) // y
write_coord(0) // z
message_end()
g_burning_duration[victim] += get_pcvar_num(cvar_fireduration) * 5
// Set burning task on victim if not present
if (!task_exists(victim+TASK_BURN))
set_task(0.2, "burning_flame", victim+TASK_BURN, _, _, "b")
}
}
// Burning Flames
public burning_flame(taskid)
{
// Get player origin and flags
static origin[3], flags
get_user_origin(ID_BURN, origin)
flags = pev(ID_BURN, pev_flags)
// in water - burning stopped
if (zp_get_user_zombie(ID_BURN) || (flags & FL_INWATER) || g_burning_duration[ID_BURN] < 1)
{
// Smoke sprite
message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte(TE_SMOKE) // TE id
write_coord(origin[0]) // x
write_coord(origin[1]) // y
write_coord(origin[2]-50) // z
write_short(g_smokeSpr) // sprite
write_byte(random_num(15, 20)) // scale
write_byte(random_num(10, 20)) // framerate
message_end()
// Task not needed anymore
remove_task(taskid);
return;
}
if ((pev(ID_BURN, pev_flags) & FL_ONGROUND) && get_pcvar_float(cvar_fireslowdown) > 0.0)
{
static Float:velocity[3]
pev(ID_BURN, pev_velocity, velocity)
xs_vec_mul_scalar(velocity, get_pcvar_float(cvar_fireslowdown), velocity)
set_pev(ID_BURN, pev_velocity, velocity)
}
// Get player's health
static health
health = pev(ID_BURN, pev_health)
if (health > get_pcvar_float(cvar_firedamage))
fm_set_user_health(ID_BURN, health - floatround(get_pcvar_float(cvar_firedamage)))
else
zp_infect_user(ID_BURN, attacker, 0, 1)
// Flame sprite
message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte(TE_SPRITE) // TE id
write_coord(origin[0]+random_num(-5, 5)) // x
write_coord(origin[1]+random_num(-5, 5)) // y
write_coord(origin[2]+random_num(-10, 10)) // z
write_short(g_flameSpr) // sprite
write_byte(random_num(5, 10)) // scale
write_byte(200) // brightness
message_end()
// Decrease burning duration counter
g_burning_duration[ID_BURN]--
}
/*================================================================================
[Stocks]
=================================================================================*/
stock get_user_eye_position(id, Float:flOrigin[3])
{
static Float:flViewOffs[3]
entity_get_vector(id, EV_VEC_view_ofs, flViewOffs)
entity_get_vector(id, EV_VEC_origin, flOrigin)
xs_vec_add(flOrigin, flViewOffs, flOrigin)
}
stock make_vector(Float:flVec[3])
{
flVec[0] -= 30.0
engfunc(EngFunc_MakeVectors, flVec)
flVec[0] = -(flVec[0] + 30.0)
}
// Set player's health (from fakemeta_util)
stock fm_set_user_health(id, health)
{
(health > 0) ? set_pev(id, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, id);
}
zp_colored_print(target, const message[], any:...)
{
static buffer[512], i, argscount
argscount = numargs()
if (!target)
{
static player
for (player = 1; player <= g_maxplayers; player++)
{
if (!is_user_connected(player))
continue;
static changed[5], changedcount
changedcount = 0
for (i = 2; i < argscount; i++)
{
if (getarg(i) == LANG_PLAYER)
{
setarg(i, 0, player)
changed[changedcount] = i
changedcount++
}
}
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, player)
write_byte(player)
write_string(buffer)
message_end()
for (i = 0; i < changedcount; i++)
setarg(changed[i], 0, LANG_PLAYER)
}
}
else
{
vformat(buffer, charsmax(buffer), message, 3)
message_begin(MSG_ONE, g_msgSayText, _, target)
write_byte(target)
write_string(buffer)
message_end()
}
}
|
|