Skocz do zawartości

Nowy szablon forum

mygo.pl

Stworzyliśmy dla Was nowy wygląd forum. Z pewnością znajdziesz rzeczy, które wg Ciebie mogą zostać zmienione - wspomnij o tym w specjalnym wątku.

Czytaj więcej

Jak założyć własną sieć

serwerów CS

Zastanawiasz się nad prowadzeniem własnej sieci serwerów? Przeczytaj podstawowe informacje, na które należy zwrócić uwagę, przy takim projekcie.

Czytaj więcej

Tworzymy spis sieci

dodaj swoją

Dodaj sieć do której należysz, pozwoli to na promocję i budowę ogólnopolskiej bazy sieci CS.

Czytaj więcej

RSS[Requst] Help on Replace Skill of Zm class


MYGO.pl
 Udostępnij

Rekomendowane odpowiedzi

  • RSSy
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_iClassIDg_iMaxPlayersFloatg_flGravityWait[33], Floatg_flTentaclesWait[33];
public 
plugin_precache()
{
    
engfunc(EngFunc_PrecacheSoundZCLASS_SOUND_TENTACLES);
    
engfunc(EngFunc_PrecacheSoundZCLASS_SOUND_GRAVITY);
    
engfunc(EngFunc_PrecacheSoundZCLASS_SOUND_REMOVE_ABIL);

    
g_iClassID zp_register_zombie_class(ZP_ZCLASS_NAMEZP_ZCLASS_INFOZP_ZCLASS_MODELZP_ZCLASS_CLAWZP_ZCLASS_HEALTHZP_ZCLASS_SPEEDZP_ZCLASS_GRAVITYZP_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 
FloatflGameTimeflGameTime get_gametime();

    if(
g_flGravityWait[iPlayer] <= flGameTime)
    {
        if(
pev(iPlayerpev_button) & IN_USE)
        {
            
UTIL_WeaponAnimation(iPlayer9);
            
UTIL_ScreenFade(iPlayer, (1<<12), (1<<12), 0x000025525525580);

            
set_pdata_float(iPlayerm_flNextAttack1.5);
            
set_pev(iPlayerpev_gravityZCLASS_SPECIAL_GRAIVTY);

            
emit_sound(iPlayerCHAN_AUTOZCLASS_SOUND_GRAVITYVOL_NORMATTN_NORM0PITCH_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 
FloatflGameTimeflGameTime get_gametime();
    if(
g_flTentaclesWait[iPlayer] <= flGameTime)
    {
        
UTIL_WeaponAnimation(iPlayer8);
        
UTIL_ScreenFade(iPlayer, (1<<12), (1<<12), 0x00000255080);

        
set_pdata_float(iPlayerm_flNextAttack1.5);

        
emit_sound(iPlayerCHAN_AUTOZCLASS_SOUND_TENTACLESVOL_NORMATTN_NORM0PITCH_NORM);

        new 
FloatvecAngles[3]; pev(iPlayerpev_v_anglevecAngles);
        new 
FloatvecStart[3]; pev(iPlayerpev_originvecStart);
        new 
FloatvecVelocity[3]; angle_vector(vecAnglesANGLEVECTOR_FORWARDvecVelocity);
        new 
FloatvecViewOfs[3]; pev(iPlayerpev_view_ofsvecViewOfs);

        new 
FloatvecEnd[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 
pHitpHit iPlayer;
        static 
iTraceiTrace create_tr2();

        while(
pHit)
        {
            
engfunc(EngFunc_TraceLinevecStartvecEndDONT_IGNORE_MONSTERSpHitiTrace);
            
pHit get_tr2(iTraceTR_pHit);

            if(!
is_user_alive(pHit))
                break;

            
get_tr2(iTraceTR_vecEndPosvecStart);
            
ExecuteHamB(Ham_TakeDamagepHitiPlayeriPlayerZCLASS_TENTACLES_DAMAGEDMG_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(iPlayerReset__Values(iPlayer);
public 
zp_user_infected_post(iPlayerReset__Values(iPlayer);
public 
zp_user_humanized_post(iPlayerReset__Values(iPlayer);
public 
Event__RoundStart()
{
    for(new 
pPlayer 1pPlayer <= g_iMaxPlayerspPlayer++)
    {
        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 
FloatflGameTimeflGameTime get_gametime();

    if(
g_flGravityWait[pPlayer] <= flGameTime && g_flTentaclesWait[pPlayer] <= flGameTimeremove_task(pPlayer TASK_HUD_WAIT);

    if(
g_flGravityWait[pPlayer] > flGameTimeformatex(szGravityWaitcharsmax(szGravityWait), "Гравитация: [%d]^n"floatround(g_flGravityWait[pPlayer] - flGameTime));
    else 
szGravityWait ""

    
if(g_flTentaclesWait[pPlayer] > flGameTimeformatex(szTentaclesWaitcharsmax(szTentaclesWait), "Щупальцы: [%d]^n"floatround(g_flTentaclesWait[pPlayer] - flGameTime));
    else 
szTentaclesWait ""

    
set_hudmessage(250180300.750.9201.01.10.00.0, -1);
    
show_hudmessage(pPlayer"%s%s"szGravityWaitszTentaclesWait);
}

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(pPlayerpev_gravityZP_ZCLASS_GRAVITY);
    
emit_sound(pPlayerCHAN_AUTOZCLASS_SOUND_REMOVE_ABILVOL_NORMATTN_NORM0PITCH_NORM);
}

// [ Stock's ]
stock UTIL_WeaponAnimation(pPlayeriAnimation)
{
    
set_pev(pPlayerpev_weaponanimiAnimation);
    
engfunc(EngFunc_MessageBeginMSG_ONE_UNRELIABLESVC_WEAPONANIM, {0.00.00.0}, pPlayer);
    
write_byte(iAnimation);
    
write_byte(0);
    
message_end();
}

stock UTIL_ScreenFade(pPlayeriDurationiHoldTimeiFlagsiRediGreeniBlueiAlphaiReliable 0)
{
    switch(
pPlayer)
    {
        case 
0:
        {
            
message_begin(iReliable MSG_ALL MSG_BROADCASTMsgId_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_MessageBeginiReliable MSG_ONE MSG_ONE_UNRELIABLEMsgId_ScreenFade, {0.00.00.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() > 2vformat(szBuffercharsmax(szBuffer), szMessage3);
    else 
copy(szBuffercharsmax(szBuffer), szMessage);
    while(
replace(szBuffercharsmax(szBuffer), "!y""^1")) {}
    while(
replace(szBuffercharsmax(szBuffer), "!t""^3")) {}
    while(
replace(szBuffercharsmax(szBuffer), "!g""^4")) {}
    switch(
pPlayer)
    {
        case 
0:
        {
            for(new 
iPlayer 1iPlayer <= g_iMaxPlayersiPlayer++)
            {
                if(!
is_user_connected(iPlayer)) continue;
                
engfunc(EngFunc_MessageBeginMSG_ONE_UNRELIABLEMsgId_SayText, {0.00.00.0}, iPlayer);
                
write_byte(iPlayer);
                
write_string(szBuffer);
                
message_end();
            }
        }
        default:
        {
            
engfunc(EngFunc_MessageBeginMSG_ONE_UNRELIABLEMsgId_SayText, {0.00.00.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_msgSayTextg_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(PLUGINVERSIONAUTHOR)
    
    
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(0sizeof sound_fastrun_heartbeati++ )
    {
        
precache_sound(sound_fastrun_heartbeat[i]);
    }
    
    
precache_sound(sound_fastrun_start)
    
    
idclass zp_register_zombie_class(zclass_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockbackzclass_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=1id<=g_maxplayersid++)
    {
        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(idkRenderFxGlowShellglow_redglow_greenglow_bluekRenderNormal0)
}

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>&& !g_fastrun[id] && !g_fastrun_wait[id])
    {
        
g_fastrun[id] = 1
        
        set_user_health
(idhealth)
        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(idkRenderFxGlowShellglow_redglow_greenglow_bluekRenderNormal0)
        
EffectFastrun(idfastrun_fov)
        
PlayEmitSound(idsound_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
(idfloat(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(idsound_fastrun_heartbeat[random_num(0sizeof sound_fastrun_heartbeat 1)]);
    else 
remove_task(taskid)
}

PlayEmitSound(id, const sound[])
{
    
emit_sound(idCHAN_VOICEsound1.0ATTN_NORM0PITCH_NORM)
}

EffectFastrun(idnum 90)
{
    
message_begin(MSG_ONEg_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], iargscount
    argscount 
numargs()
    
    if (!
target)
    {
        static 
player
        
for (player 1player <= g_maxplayersplayer++)
        {
            if (!
is_user_connected(player))
                continue;
            
            static 
changed[5], changedcount
            changedcount 
0
            
            
for (2argscounti++)
            {
                if (
getarg(i) == LANG_PLAYER)
                {
                    
setarg(i0player)
                    
changed[changedcount] = i
                    changedcount
++
                }
            }
            
            
vformat(buffercharsmax(buffer), message3)
            
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_player)
            
write_byte(player)
            
write_string(buffer)
            
message_end()
            
            for (
0changedcounti++)
                
setarg(changed[i], 0LANG_PLAYER)
        }
    }
    else
    {
        
vformat(buffercharsmax(buffer), message3)
        
        
message_begin(MSG_ONEg_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_firespeedcvar_firecooldowncvar_firedamagecvar_firedurationcvar_fireslowdowncvar_fireradiuscvar_firesurvivor
new g_smokeSprg_flameSprg_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_namezclass_infozclass_modelzclass_clawmodelzclass_healthzclass_speedzclass_gravityzclass_knockbackzclass_lvl
    
    
engfunc(EngFunc_PrecacheModelfire_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(idinfector)
{
    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 
iButtoniButton pev(idpev_button)
    static 
iOldButtoniOldButton pev(idpev_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_ONEget_user_msgid("BarTime"), _id)
            
write_byte(1)
            
write_byte(0)
            
message_end()
            
            
emit_sound(idCHAN_ITEM"zombie_plague/husk_pre_fire.wav"1.0ATTN_NORM0PITCH_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
(idCHAN_ITEM"zombie_plague/husk_wind_down.wav"1.0ATTN_NORM0PITCH_NORM)
            }
            
            
message_begin(MSG_ONEget_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(victimattackershouldgib)
{    
    
// 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(idOrigin)
    
    
// Get View Angles
    
entity_get_vector(idEV_VEC_v_anglevAngle)
    
    new 
NewEnt create_entity("info_target")
    
    
entity_set_string(NewEntEV_SZ_classname"fireball")
    
    
entity_set_model(NewEntfire_model)
    
    
entity_set_size(NewEntFloat:{ -1.5, -1.5, -1.5 }, Float:{ 1.51.51.5 })
    
    
entity_set_origin(NewEntOrigin)
    
    
// Set Entity Angles (thanks to Arkshine)
    
make_vector(vAngle)
    
entity_set_vector(NewEntEV_VEC_anglesvAngle)
    
    
entity_set_int(NewEntEV_INT_solidSOLID_BBOX)
    
    
entity_set_float(NewEntEV_FL_scale0.3)
    
entity_set_int(NewEntEV_INT_spawnflagsSF_SPRITE_STARTON)
    
entity_set_float(NewEntEV_FL_framerate25.0)
    
set_rendering(NewEntkRenderFxNone000kRenderTransAdd255)
    
    
entity_set_int(NewEntEV_INT_movetypeMOVETYPE_FLY)
    
entity_set_edict(NewEntEV_ENT_ownerid)
    
    
// Set Entity Velocity
    
velocity_by_aim(idget_pcvar_num(cvar_firespeed), flVelocity)
    
entity_set_vector(NewEntEV_VEC_velocityflVelocity)
    
    
message_begin(MSG_BROADCASTSVC_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(idCHAN_ITEM"zombie_plague/husk_fireball_fire.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    
emit_sound(NewEntCHAN_ITEM"zombie_plague/husk_fireball_loop.wav"VOL_NORMATTN_NORM0PITCH_NORM)
}

public 
effect_fire(entity)
{
    if (!
pev_valid(entity))
    {
        
remove_task(entity)
        return;
    }
    
    
// Get origin
    
static Float:originF[3]
    
pev(entitypev_originoriginF)
    
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(17)
    
engfunc(EngFunc_WriteCoordoriginF[0])         // x
    
engfunc(EngFunc_WriteCoordoriginF[1])         // y
    
engfunc(EngFunc_WriteCoordoriginF[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_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(5)
    
engfunc(EngFunc_WriteCoordoriginF[0])     // x
    
engfunc(EngFunc_WriteCoordoriginF[1])     // y
    
engfunc(EngFunc_WriteCoordoriginF[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_MessageBeginMSG_PASSVC_TEMPENTITYoriginF0)
    
write_byte(TE_DLIGHT)             // TE id
    
engfunc(EngFunc_WriteCoordoriginF[0])    // x
    
engfunc(EngFunc_WriteCoordoriginF[0])    // y
    
engfunc(EngFunc_WriteCoordoriginF[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(entid)
{
    if (!
pev_valid(ent)) 
        return 
PLUGIN_HANDLED
    
    
new class[32]
    
pev(entpev_classname, class, charsmax(class))
    
    if(
equal(class, "fireball"))
    {
        
attacker entity_get_edict(entEV_ENT_owner)
        
husk_touch(ent)
        
engfunc(EngFunc_RemoveEntityent)
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED
}

public 
husk_touch(ent)
{
    if (!
pev_valid(ent)) 
        return;
    
    
// Get origin
    
static Float:originF[3]
    
pev(entpev_originoriginF)
    
    
// Explosion
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_EXPLOSION)
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y
    
engfunc(EngFunc_WriteCoordoriginF[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(entCHAN_ITEM"zombie_plague/husk_fireball_explode.wav"VOL_NORMATTN_NORM0PITCH_NORM)
    
    
// Collisions
    
static victim
    victim 
= -1
    
    
while ((victim engfunc(EngFunc_FindEntityInSpherevictimoriginFget_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_UNRELIABLEget_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_BURNorigin)
    
flags pev(ID_BURNpev_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_PVSSVC_TEMPENTITYorigin)
        
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(1520)) // scale
        
write_byte(random_num(1020)) // framerate
        
message_end()
        
        
// Task not needed anymore
        
remove_task(taskid);
        return;
    }
    
    if ((
pev(ID_BURNpev_flags) & FL_ONGROUND) && get_pcvar_float(cvar_fireslowdown) > 0.0)
    {
        static 
Float:velocity[3]
        
pev(ID_BURNpev_velocityvelocity)
        
xs_vec_mul_scalar(velocityget_pcvar_float(cvar_fireslowdown), velocity)
        
set_pev(ID_BURNpev_velocityvelocity)
    }
    
    
// Get player's health
    
static health
    health 
pev(ID_BURNpev_health)
    
    if (
health get_pcvar_float(cvar_firedamage))
        
fm_set_user_health(ID_BURNhealth floatround(get_pcvar_float(cvar_firedamage)))
    else
        
zp_infect_user(ID_BURNattacker01)
    
    
// Flame sprite
    
message_begin(MSG_PVSSVC_TEMPENTITYorigin)
    
write_byte(TE_SPRITE// TE id
    
write_coord(origin[0]+random_num(-55)) // x
    
write_coord(origin[1]+random_num(-55)) // y
    
write_coord(origin[2]+random_num(-1010)) // z
    
write_short(g_flameSpr// sprite
    
write_byte(random_num(510)) // scale
    
write_byte(200// brightness
    
message_end()
    
    
// Decrease burning duration counter
    
g_burning_duration[ID_BURN]--
}

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

stock get_user_eye_position(idFloat:flOrigin[3])
{
    static 
Float:flViewOffs[3]
    
entity_get_vector(idEV_VEC_view_ofsflViewOffs)
    
entity_get_vector(idEV_VEC_originflOrigin)
    
xs_vec_add(flOriginflViewOffsflOrigin)
}

stock make_vector(Float:flVec[3])
{
    
flVec[0] -= 30.0
    engfunc
(EngFunc_MakeVectorsflVec)
    
flVec[0] = -(flVec[0] + 30.0)
}

// Set player's health (from fakemeta_util)
stock fm_set_user_health(idhealth)
{
    (
health 0) ? set_pev(idpev_healthfloat(health)) : dllfunc(DLLFunc_ClientKillid);
}

zp_colored_print(target, const message[], any:...)
{
    static 
buffer[512], iargscount
    argscount 
numargs()
    
    if (!
target)
    {
        static 
player
        
for (player 1player <= g_maxplayersplayer++)
        {
            if (!
is_user_connected(player))
                continue;
            
            static 
changed[5], changedcount
            changedcount 
0
            
            
for (2argscounti++)
            {
                if (
getarg(i) == LANG_PLAYER)
                {
                    
setarg(i0player)
                    
changed[changedcount] = i
                    changedcount
++
                }
            }
            
            
vformat(buffercharsmax(buffer), message3)
            
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_player)
            
write_byte(player)
            
write_string(buffer)
            
message_end()
            
            for (
0changedcounti++)
                
setarg(changed[i], 0LANG_PLAYER)
        }
    }
    else
    {
        
vformat(buffercharsmax(buffer), message3)
        
        
message_begin(MSG_ONEg_msgSayText_target)
        
write_byte(target)
        
write_string(buffer)
        
message_end()
    }


Przeczytaj cały wpis

Odnośnik do komentarza
Udostępnij na innych stronach

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.
 Udostępnij

  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...