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

zp_zombie_class_shockwave


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
K4rim
Senior Member
Join Date: Oct 2013
Location: Malaysia
Old 12-02-2013 , 06:55   zp_zombie_class_shockwave
Reply With Quote #1

i try translate this many time,but when compile all error,try search whole forum but not found
i not sure the language maybe chinese/japan,can someone do it,sory bad english.


PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <xs>
#include <zombieplague>

#define SUPPORT_BOT_TO_USE    //支援BOT使用.(在最前面加上 // 即取消對BOT的技援)
#define BOUNCE_EFFECT    //被震波攻擊到是否會被彈開.(在最前面加上 // 即取消這項效果)
//#define DROP_GUN    //被震波攻擊到是否會掉下手上的槍.(在最前面加上 // 即取消這項效果)

#define Survivor_Speed_Multiplier 0.5    //倖存者緩速效果的乘數. 減緩後的速度=原本的速度*乘數 (如乘數是1.0 就等於是原本的速度)
#define Human_Speed_Multiplier 0.1    //人類緩速效果的乘數. 減緩後的速度=原本的速度*乘數 (如乘數是1.0 就等於是原本的速度)
#define How_High_Invalid_Attack    60.0    //在震波攻擊範圍內的目標,若高度和攻擊者相差超出多少則判定攻擊無效.(人物模型的高度大約是60.0)

#define PLUGIN_NAME "[ZP] Class:Shock Wave "
#define PLUGIN_VERSION "1.1"
#define PLUGIN_AUTHOR "Jim"

const UNIT_SECOND = (1<<12)

#if defined DROP_GUN
// Weapon bitsums
const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
const 
SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
#endif

// Shock Wave Zombie Attributes
new const zclass_name[] = { "震撼喪屍" }    //喪屍名稱
new const zclass_info[] = { "能放出震波攻擊" }    //類型說明
new const zclass_model[] = { "zombie_source" }    //人物模組
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" }    //手的模組
const zclass_health 1800    //血量(HP)
const zclass_speed 220    //移動速度
const Float:zclass_gravity 1.0    //承受重力
const Float:zclass_knockback 1.25    //被擊退的數值

new const sound_shockwave[] = { "garg/gar_stomp1.wav" }

new 
bool:use_shockwave[33]
new 
bool:hit_key[33]
new 
bool:cooldown_started[33]
new 
bool:slowly_started[33], Float:slowly_begin_time[33]
new 
g_msgScreenShake,  g_shokewaveSpr
new g_zclass_shockwave
new g_shockwave_jump_heightg_shockwave_rangeg_shockwave_effect_timeg_shockwave_cooldown
new maxplayers

public plugin_init()
{
        
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
    
g_shockwave_jump_height register_cvar("zp_shockwave_jump_height""320"//使用震波攻擊時的跳躍高度
    
g_shockwave_range register_cvar("zp_shockwave_range""260"//震波攻擊的有效範圍距離
    
g_shockwave_effect_time register_cvar("zp_shockwave_effect_time""6.0"//受震波影響的時間長度(單位:秒)
    
g_shockwave_cooldown register_cvar("zp_shockwave_cooldown""20.0")    //使用震波攻擊後的冷卻時間(單位:秒)
    
    
register_forward(FM_PlayerPostThink"fw_PlayerPostThink"1)
    
register_forward(FM_StartFrame"fw_StartFrame")
    
    
register_event("ResetHUD","NewRound","be")
    
register_event("DeathMsg""Death""a")
    
    
g_msgScreenShake get_user_msgid("ScreenShake")
    
    
maxplayers get_maxplayers()
}

public 
plugin_precache()
{
    
engfunc(EngFunc_PrecacheSoundsound_shockwave)
    
g_shokewaveSpr engfunc(EngFunc_PrecacheModel"sprites/shockwave.spr")
    
    
g_zclass_shockwave 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_shockwave)
    {
        
client_print(idprint_chat"[喪屍:提示] 靠近目標時,站在地面上按'R'鍵可以放出震波攻擊,需要冷卻時間%2.1f秒!"get_pcvar_float(g_shockwave_cooldown))
    }
}

public 
zp_user_humanized_post(id)
{
    
use_shockwave[id] = false
    hit_key
[id] = false
    cooldown_started
[id] = false
    slowly_started
[id] = false
}

public 
fw_StartFrame()
{
    
// 設置檢查的間格時間,防止刷新太快
    
static Float:last_check_time
    
if (get_gametime() - last_check_time 0.1)
        return;
    
last_check_time get_gametime()
    
    static 
id
    
for (id 1id <= 32id++)
    {
        
// Not alive or zombie
        
if (!is_user_alive(id) || zp_get_user_zombie(id))
            continue;
        
        if (
slowly_started[id])
        {
            
#if defined BOUNCE_EFFECT
            
new Float:time
            time 
get_gametime() - slowly_begin_time[id]
            
            if (
time >= (get_pcvar_float(g_shockwave_effect_time) + 1.0)) //將緩速效果的結束時間往後延遲1.0秒
            
{
                
slowly_started[id] = false
            
}
            else if (
time 1.0//設定延遲1.0秒後才產生緩速的效果,以防彈開的效果被抑制
            
{
                if (
zp_get_user_survivor(id))
                    
set_speed_to_velocity(idSurvivor_Speed_Multiplier//減緩速度的效果 (對於被震波攻擊到的"倖存者"玩家)
                
else
                    
set_speed_to_velocity(idHuman_Speed_Multiplier//減緩速度的效果 (對於被震波攻擊到的"人類"玩家)
            
}
            
#else
            
if (zp_get_user_survivor(id))
                
set_speed_to_velocity(idSurvivor_Speed_Multiplier//減緩速度的效果 (對於被震波攻擊到的"倖存者"玩家)
            
else
                
set_speed_to_velocity(idHuman_Speed_Multiplier//減緩速度的效果 (對於被震波攻擊到的"人類"玩家)
            
            
new Float:time
            time 
get_gametime() - slowly_begin_time[id]
            
            if (
time >= get_pcvar_float(g_shockwave_effect_time))
                
slowly_started[id] = false
            
#endif
        
}
    }
}

public 
fw_PlayerPostThink(id)
{
    if (!
is_user_alive(id) || !zp_get_user_zombie(id) || (zp_get_user_zombie_class(id) != g_zclass_shockwave))
        return 
PLUGIN_CONTINUE
    
    
if (zp_get_user_nemesis(id))
        return 
PLUGIN_CONTINUE
    
    
if (cooldown_started[id])
        return 
PLUGIN_CONTINUE
    
    
if (!use_shockwave[id])
    {
        
#if defined SUPPORT_BOT_TO_USE
        
if (is_user_bot(id))
        {
            new 
enemybody
            get_user_aiming
(idenemybody//檢查是否正在瞄準某個目標
            
            
if ((<= enemy <= 32) && !zp_get_user_zombie(enemy)) //檢查是否是有效的目標
            
{
                new 
Float:origin1[3], Float:origin2[3], Float:range
                pev
(idpev_originorigin1);
                
pev(enemypev_originorigin2);
                
range get_distance_f(origin1origin2)
                
                if (
is_user_on_ground(id) && (range <= get_pcvar_float(g_shockwave_range)) && (floatabs(origin2[2] - origin1[2]) <= How_High_Invalid_Attack))
                {
                    new 
height =  get_pcvar_num(g_shockwave_jump_height)
                    if (
height 0)
                    {
                        
fm_set_user_jump_velocity(idheight//放震波之前的跳躍動作效果
                        
if (fm_get_speed(id) > 0)
                            
use_shockwave[id] = true
                    
}
                    else
                    {
                        
use_shockwave[id] = true
                    
}
                }
            }
        }
        else
        {
        
#endif
        
        
static buttonoldbutton
        button 
pev(idpev_button)
        
oldbutton pev(idpev_oldbuttons)
        
        if ((
button IN_RELOAD) && (oldbutton IN_RELOAD))
        {
            if (!
hit_key[id] && is_user_on_ground(id))
            {
                
hit_key[id] = true
                
new height =  get_pcvar_num(g_shockwave_jump_height)
                if (
height 0)
                {
                    
fm_set_user_jump_velocity(idheight//放震波之前的跳躍動作效果
                    
if (fm_get_speed(id) > 0)
                        
use_shockwave[id] = true
                
}
                else
                {
                    
use_shockwave[id] = true
                
}
            }
        }
        else
        {
            
hit_key[id] = false
        
}
        
        
#if defined SUPPORT_BOT_TO_USE
        
}
        
#endif
    
}
    else
    {
        if (
is_user_on_ground(id))
        {
            
use_shockwave[id] = false
            screen_shake
(id10//讓放震波攻擊的玩家畫面產生晃動
            //PlaySound(id, sound_shockwave) //播放震撼效果的音效
            
engfunc(EngFunc_EmitSoundidCHAN_VOICEsound_shockwave1.0ATTN_NORM0PITCH_NORM//播放震撼效果的音效
            
            
new Float:origin[3]
            
pev(idpev_originorigin)
            
create_blast(origin100100100200//顯示震波的環狀效果
            
search_in_range_target(id//搜尋震波攻擊有效範圍內的玩家
            
            
cooldown_started[id] = true
            
//remove_task(id)
            
set_task(get_pcvar_float(g_shockwave_cooldown), "cooldown_finish"id//開始冷卻時間倒數
        
}
    }
    
    return 
PLUGIN_CONTINUE
}

public 
search_in_range_target(id)
{
    new 
Float:origin1[3], Float:origin2[3], Float:range
    pev
(idpev_originorigin1);
    
    
#if defined BOUNCE_EFFECT
    
new Float:velocity[3]
    
#endif
    
    
for (new 1<= 32i++)
    {
        if ((
!= id) && is_user_alive(i) && !zp_get_user_zombie(i))
        {
            
pev(ipev_originorigin2);
            
range get_distance_f(origin1origin2)
            
            if (
range <= get_pcvar_float(g_shockwave_range))
            {
                
//PlaySound(i, sound_shockwave) //播放震撼效果的音效
                
                
if (floatabs(origin2[2] - origin1[2]) <= How_High_Invalid_Attack)
                {
                    
screen_shake(i10//讓被攻擊到的玩家畫面產生晃動
                    
                    #if defined BOUNCE_EFFECT
                    
get_speed_vector_to_entity(idi500.0velocity//算出彈開時的向量,彈開速度設為500.0
                    
velocity[2] += 150.0 //加上彈開時的跳躍高度150.0
                    
set_pev(ipev_velocityvelocity)
                    
#endif
                    
                    #if defined DROP_GUN
                    
if (!zp_get_user_survivor(i)) //設定若當玩家是倖存者時不會掉下手上的槍
                        
drop_current_weapon(i//玩家丟掉目前手上的槍
                    #endif
                    
                    
slowly_started[i] = true
                    slowly_begin_time
[i] = get_gametime() //記綠緩速效果的開始時間
                
}
            }
        }
    }
}

public 
cooldown_finish(id)
{
    if (
cooldown_started[id] && (get_pcvar_float(g_shockwave_cooldown) >= 3.0)) //冷卻時間偌低於3秒鐘,不會顯示這個提示訊息
        
client_print(idprint_center"冷卻時間%2.1f秒己過,你己經可以再使用震波攻擊了!"get_pcvar_float(g_shockwave_cooldown))
    
    
cooldown_started[id] = false
}

public 
client_connect(id)
{
    
use_shockwave[id] = false
    hit_key
[id] = false
    cooldown_started
[id] = false
    slowly_started
[id] = false
    
    
return PLUGIN_CONTINUE
}

public 
client_disconnect(id)
{
    
use_shockwave[id] = false
    hit_key
[id] = false
    cooldown_started
[id] = false
    slowly_started
[id] = false
    
    
return PLUGIN_CONTINUE
}

public 
NewRound(id)
{
    
use_shockwave[id] = false
    hit_key
[id] = false
    cooldown_started
[id] = false
    slowly_started
[id] = false
}

public 
Death()
{
    new 
player read_data(2)
    if ((
player <= 0) || (player maxplayers))
        return;
    
    
use_shockwave[player] = false
    hit_key
[player] = false
    cooldown_started
[player] = false
    slowly_started
[player] = false
}

screen_shake(idamplitude 4duration 2frequency 10)
{
    
message_begin(MSG_ONE_UNRELIABLEg_msgScreenShake_id)
    
write_short(UNIT_SECOND*amplitude// 振幅
    
write_short(UNIT_SECOND*duration// 時間
    
write_short(UNIT_SECOND*frequency// 頻率
    
message_end()
}

create_blast(const Float:originF[3], redgreenbluebrightness)
{
    
// Smallest ring (大的光環)
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_BEAMCYLINDER// TE id (TE 的代碼)
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x (X 座標)
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y (X 座標)
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z (Y 座標)
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x axis (X 軸)
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y axis (Y 軸)
    
engfunc(EngFunc_WriteCoordoriginF[2]+400.0// z axis (Z 軸)
    
write_short(g_shokewaveSpr// sprite (Sprite 物件代碼)
    
write_byte(0// startframe (幀幅開始)
    
write_byte(0// framerate (幀幅頻率)
    
write_byte(4// life (時間長度)
    
write_byte(60// width (寬度)
    
write_byte(0// noise (響聲)
    
write_byte(red// red (顏色 R)
    
write_byte(green// green (顏色 G)
    
write_byte(blue// blue (顏色 B)
    
write_byte(brightness// brightness (顏色亮度)
    
write_byte(0// speed (速度)
    
message_end()
    
    
// Medium ring (中的光環)
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_BEAMCYLINDER// TE id
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x axis
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y axis
    
engfunc(EngFunc_WriteCoordoriginF[2]+300.0// z axis
    
write_short(g_shokewaveSpr// sprite
    
write_byte(0// startframe
    
write_byte(0// framerate
    
write_byte(4// life
    
write_byte(60// width
    
write_byte(0// noise
    
write_byte(red// red
    
write_byte(green// green
    
write_byte(blue// blue
    
write_byte(brightness// brightness
    
write_byte(0// speed
    
message_end()
    
    
// Largest ring (小的光環)
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_BEAMCYLINDER// TE id
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x axis
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y axis
    
engfunc(EngFunc_WriteCoordoriginF[2]+200.0// z axis
    
write_short(g_shokewaveSpr// sprite
    
write_byte(0// startframe
    
write_byte(0// framerate
    
write_byte(4// life
    
write_byte(60// width
    
write_byte(0// noise
    
write_byte(red// red
    
write_byte(green// green
    
write_byte(blue// blue
    
write_byte(brightness// brightness
    
write_byte(0// speed
    
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)
}
*/
stock set_speed_to_velocity(idFloat:scalar 1.0)
{
    
// Get our current velocity
    
static Float:velocity[3]
    
pev(idpev_velocityvelocity)
    
xs_vec_mul_scalar(velocityscalarvelocity)
    
set_pev(idpev_velocityvelocity)
    
    return 
1;
}

stock bool:is_user_on_ground(index)
{
    if (
pev(indexpev_flags) & FL_ONGROUND)
        return 
true;
    
    return 
false;
}

stock fm_set_user_jump_velocity(indexjump_height)
{
    static 
Float:velocity[3]
    
pev(indexpev_velocityvelocity)
    
velocity[2] = float(jump_height)
    
set_pev(indexpev_velocityvelocity)
    
    return 
1;
}

stock fm_get_speed(entity)
{
    static 
Float:velocity[3]
    
pev(entitypev_velocityvelocity)
    
    return 
floatround(vector_length(velocity));
}

#if defined BOUNCE_EFFECT
stock get_speed_vector_to_entity(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;
}
#endif

#if defined DROP_GUN
stock drop_current_weapon(id
{
    static 
weapon_idclipammo
    weapon_id 
get_user_weapon(idclipammo)
    
    if (((
1<<weapon_id) & PRIMARY_WEAPONS_BIT_SUM) || ((1<<weapon_id) & SECONDARY_WEAPONS_BIT_SUM))
    {
        static 
weapon_name[32]
        
get_weaponname(weapon_idweapon_namesizeof weapon_name 1)
        
engclient_cmd(id"drop"weapon_name)
    }
}
#endif 
K4rim is offline
Egan
BANNED
Join Date: May 2013
Location: GB
Old 12-02-2013 , 23:42   Re: zp_zombie_class_shockwave
Reply With Quote #2

no shit.

Last edited by Egan; 12-02-2013 at 23:47.
Egan is offline
Send a message via ICQ to Egan Send a message via AIM to Egan Send a message via Yahoo to Egan Send a message via Skype™ to Egan
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 12-09-2013 , 09:58   Re: zp_zombie_class_shockwave
Reply With Quote #3

Quote:
i not sure the language maybe chinese
You are right!
__________________
simanovich is offline
K4rim
Senior Member
Join Date: Oct 2013
Location: Malaysia
Old 12-11-2013 , 09:26   Re: zp_zombie_class_shockwave
Reply With Quote #4

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <xs>
#include <zombieplague>

#define SUPPORT_BOT_TO_USE    //Support BOT use.(Plus on top// That the abolition of technical assistance on BOT)
#define BOUNCE_EFFECT    //Shockwave attack is whether it will be bounced to.(At the top plus / / that the cancellation of the results)
//#define DROP_GUN    //Whether the attack was shock will fall in the hands of a gun. (At the top plus / / that the cancellation of the results)

#define Survivor_Speed_Multiplier 0.5    // Survivor slowing effect of the multiplier. Slowed after the original speed * = multiplier (as a multiplier of 1.0 would be tantamount to the original speed)
#define Human_Speed_Multiplier 0.1    //The multiplier effect of human retarder. Slowed after the original speed * = multiplier (as a multiplier of 1.0 would be tantamount to the original speed)
#define How_High_Invalid_Attack    60.0    //Shockwave attack targets within range, if the difference in height and attackers attack beyond judged invalid. (Height character models is about 60.0)

#define PLUGIN_NAME "[ZPA]Zombie:ShockWave "
#define PLUGIN_VERSION "1.1"
#define PLUGIN_AUTHOR "Jim"

const UNIT_SECOND = (1<<12)

#if defined DROP_GUN
// Weapon bitsums
const PRIMARY_WEAPONS_BIT_SUM = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90)
const 
SECONDARY_WEAPONS_BIT_SUM = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE)
#endif

// Shock Wave Zombie Attributes
new const zclass_name[] = { "ShockWave" }    //Name
new const zclass_info[] = { "Can emit shock attack" }    //Info
new const zclass_model[] = { "zombie_source" }    //Model
new const zclass_clawmodel[] = { "v_knife_zombie.mdl" }    //Claw models
const zclass_health 1800    //Health(HP)
const zclass_speed 220    //Speed
const Float:zclass_gravity 1.0    //Gravity
const Float:zclass_knockback 1.25    //Knockback

new const sound_shockwave[] = { "garg/gar_stomp1.wav" }

new 
bool:use_shockwave[33]
new 
bool:hit_key[33]
new 
bool:cooldown_started[33]
new 
bool:slowly_started[33], Float:slowly_begin_time[33]
new 
g_msgScreenShake,  g_shokewaveSpr
new g_zclass_shockwave
new g_shockwave_jump_heightg_shockwave_rangeg_shockwave_effect_timeg_shockwave_cooldown
new maxplayers

public plugin_init()
{
        
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
    
g_shockwave_jump_height register_cvar("zp_shockwave_jump_height""320"//Jump height when using the shock attack
    
g_shockwave_range register_cvar("zp_shockwave_range""260"//Effective distance range shock attack
    
g_shockwave_effect_time register_cvar("zp_shockwave_effect_time""6.0"//Affected by seismic time length (unit: seconds)
    
g_shockwave_cooldown register_cvar("zp_shockwave_cooldown""20.0")    //Shockwave attack cooldown after use (unit: seconds)
    
    
register_forward(FM_PlayerPostThink"fw_PlayerPostThink"1)
    
register_forward(FM_StartFrame"fw_StartFrame")
    
    
register_event("ResetHUD","NewRound","be")
    
register_event("DeathMsg""Death""a")
    
    
g_msgScreenShake get_user_msgid("ScreenShake")
    
    
maxplayers get_maxplayers()
}

public 
plugin_precache()
{
    
engfunc(EngFunc_PrecacheSoundsound_shockwave)
    
g_shokewaveSpr engfunc(EngFunc_PrecacheModel"sprites/shockwave.spr")
    
    
g_zclass_shockwave 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_shockwave)
    {
        
client_print(idprint_chat"[Zombie:Tips] near the target, standing by the 'R' key on the ground can emit shock attack requires cooling time% 20.0 seconds!"get_pcvar_float(g_shockwave_cooldown))
    }
}

public 
zp_user_humanized_post(id)
{
    
use_shockwave[id] = false
    hit_key
[id] = false
    cooldown_started
[id] = false
    slowly_started
[id] = false
}

public 
fw_StartFrame()
{
    
// Set Layout time to check and prevent fast refresh
    
static Float:last_check_time
    
if (get_gametime() - last_check_time 0.1)
        return;
    
last_check_time get_gametime()
    
    static 
id
    
for (id 1id <= 32id++)
    {
        
// Not alive or zombie
        
if (!is_user_alive(id) || zp_get_user_zombie(id))
            continue;
        
        if (
slowly_started[id])
        {
            
#if defined BOUNCE_EFFECT
            
new Float:time
            time 
get_gametime() - slowly_begin_time[id]
            
            if (
time >= (get_pcvar_float(g_shockwave_effect_time) + 1.0)) //The slowing effect of the end time delay of 1.0 seconds back
            
{
                
slowly_started[id] = false
            
}
            else if (
time 1.0//1.0 seconds after setting the delay to produce the effect of retarder to prevent the bounce effect is suppressed
            
{
                if (
zp_get_user_survivor(id))
                    
set_speed_to_velocity(idSurvivor_Speed_Multiplier//Slow down effect (for shock attack is to "Survivor" players)
                
else
                    
set_speed_to_velocity(idHuman_Speed_Multiplier//Slow down effect (for shock attack to be "human" players)
            
}
            
#else
            
if (zp_get_user_survivor(id))
                
set_speed_to_velocity(idSurvivor_Speed_Multiplier//Slow down effect (for shock attack is to "Survivor" players)
            
else
                
set_speed_to_velocity(idHuman_Speed_Multiplier//Slow down effect (for shock attack to be "human" players)
            
            
new Float:time
            time 
get_gametime() - slowly_begin_time[id]
            
            if (
time >= get_pcvar_float(g_shockwave_effect_time))
                
slowly_started[id] = false
            
#endif
        
}
    }
}

public 
fw_PlayerPostThink(id)
{
    if (!
is_user_alive(id) || !zp_get_user_zombie(id) || (zp_get_user_zombie_class(id) != g_zclass_shockwave))
        return 
PLUGIN_CONTINUE
    
    
if (zp_get_user_nemesis(id))
        return 
PLUGIN_CONTINUE
    
    
if (cooldown_started[id])
        return 
PLUGIN_CONTINUE
    
    
if (!use_shockwave[id])
    {
        
#if defined SUPPORT_BOT_TO_USE
        
if (is_user_bot(id))
        {
            new 
enemybody
            get_user_aiming
(idenemybody//Check that you are aiming for a target
            
            
if ((<= enemy <= 32) && !zp_get_user_zombie(enemy)) //Check whether it is a valid target
            
{
                new 
Float:origin1[3], Float:origin2[3], Float:range
                pev
(idpev_originorigin1);
                
pev(enemypev_originorigin2);
                
range get_distance_f(origin1origin2)
                
                if (
is_user_on_ground(id) && (range <= get_pcvar_float(g_shockwave_range)) && (floatabs(origin2[2] - origin1[2]) <= How_High_Invalid_Attack))
                {
                    new 
height =  get_pcvar_num(g_shockwave_jump_height)
                    if (
height 0)
                    {
                        
fm_set_user_jump_velocity(idheight//Put the shock effect of the previous jumps
                        
if (fm_get_speed(id) > 0)
                            
use_shockwave[id] = true
                    
}
                    else
                    {
                        
use_shockwave[id] = true
                    
}
                }
            }
        }
        else
        {
        
#endif
        
        
static buttonoldbutton
        button 
pev(idpev_button)
        
oldbutton pev(idpev_oldbuttons)
        
        if ((
button IN_RELOAD) && (oldbutton IN_RELOAD))
        {
            if (!
hit_key[id] && is_user_on_ground(id))
            {
                
hit_key[id] = true
                
new height =  get_pcvar_num(g_shockwave_jump_height)
                if (
height 0)
                {
                    
fm_set_user_jump_velocity(idheight//Put the shock effect of the previous jumps
                    
if (fm_get_speed(id) > 0)
                        
use_shockwave[id] = true
                
}
                else
                {
                    
use_shockwave[id] = true
                
}
            }
        }
        else
        {
            
hit_key[id] = false
        
}
        
        
#if defined SUPPORT_BOT_TO_USE
        
}
        
#endif
    
}
    else
    {
        if (
is_user_on_ground(id))
        {
            
use_shockwave[id] = false
            screen_shake
(id10//Let's put the player screen to generate seismic shaking attack
            //PlaySound(id, sound_shockwave) //Play shocking sound effects
            
engfunc(EngFunc_EmitSoundidCHAN_VOICEsound_shockwave1.0ATTN_NORM0PITCH_NORM//Play shocking sound effects
            
            
new Float:origin[3]
            
pev(idpev_originorigin)
            
create_blast(origin100100100200//Showing the effect of shock waves in the ring
            
search_in_range_target(id//Search shockwave attack players within range
            
            
cooldown_started[id] = true
            
//remove_task(id)
            
set_task(get_pcvar_float(g_shockwave_cooldown), "cooldown_finish"id//Cold start,when|between Reciprocal
        
}
    }
    
    return 
PLUGIN_CONTINUE
}

public 
search_in_range_target(id)
{
    new 
Float:origin1[3], Float:origin2[3], Float:range
    pev
(idpev_originorigin1);
    
    
#if defined BOUNCE_EFFECT
    
new Float:velocity[3]
    
#endif
    
    
for (new 1<= 32i++)
    {
        if ((
!= id) && is_user_alive(i) && !zp_get_user_zombie(i))
        {
            
pev(ipev_originorigin2);
            
range get_distance_f(origin1origin2)
            
            if (
range <= get_pcvar_float(g_shockwave_range))
            {
                
//PlaySound(i, sound_shockwave) //Play shocking sound effects
                
                
if (floatabs(origin2[2] - origin1[2]) <= How_High_Invalid_Attack)
                {
                    
screen_shake(i10//Let the players be attacked to produce shaking screen
                    
                    #if defined BOUNCE_EFFECT
                    
get_speed_vector_to_entity(idi500.0velocity//Vector bounce when calculated, bounce speed to 500.0
                    
velocity[2] += 150.0 //When coupled with bounce jump height 150.0
                    
set_pev(ipev_velocityvelocity)
                    
#endif
                    
                    #if defined DROP_GUN
                    
if (!zp_get_user_survivor(i)) 
                        
drop_current_weapon(i//Players throw the gun in the hands of the current
                    #endif
                    
                    
slowly_started[i] = true
                    slowly_begin_time
[i] = get_gametime() //speed effectively start time
                
}
            }
        }
    }
}

public 
cooldown_finish(id)
{
    if (
cooldown_started[id] && (get_pcvar_float(g_shockwave_cooldown) >= 3.0)) //Cooling time is less than 3 seconds, does not display the prompt message
        
client_print(idprint_center"Cooling time %20.0 Second has passed, you can then use the shock wave has been attacked!"get_pcvar_float(g_shockwave_cooldown))
    
    
cooldown_started[id] = false
}

public 
client_connect(id)
{
    
use_shockwave[id] = false
    hit_key
[id] = false
    cooldown_started
[id] = false
    slowly_started
[id] = false
    
    
return PLUGIN_CONTINUE
}

public 
client_disconnect(id)
{
    
use_shockwave[id] = false
    hit_key
[id] = false
    cooldown_started
[id] = false
    slowly_started
[id] = false
    
    
return PLUGIN_CONTINUE
}

public 
NewRound(id)
{
    
use_shockwave[id] = false
    hit_key
[id] = false
    cooldown_started
[id] = false
    slowly_started
[id] = false
}

public 
Death()
{
    new 
player read_data(2)
    if ((
player <= 0) || (player maxplayers))
        return;
    
    
use_shockwave[player] = false
    hit_key
[player] = false
    cooldown_started
[player] = false
    slowly_started
[player] = false
}

screen_shake(idamplitude 4duration 2frequency 10)
{
    
message_begin(MSG_ONE_UNRELIABLEg_msgScreenShake_id)
    
write_short(UNIT_SECOND*amplitude// Amplitude
    
write_short(UNIT_SECOND*duration// Time
    
write_short(UNIT_SECOND*frequency// Frequency
    
message_end()
}

create_blast(const Float:originF[3], redgreenbluebrightness)
{
    
// Smallest ring (Large halo)
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_BEAMCYLINDER// TE id (TE Kod)
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x (X Coordinate)
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y (X Coordinate)
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z (Y Coordinate)
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x axis (X Axis)
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y axis (Y Axis)
    
engfunc(EngFunc_WriteCoordoriginF[2]+400.0// z axis (Z Axis)
    
write_short(g_shokewaveSpr// sprite (Sprite Object code)
    
write_byte(0// startframe (Frames begin)
    
write_byte(0// framerate (Frequency frames)
    
write_byte(4// life (The length of time)
    
write_byte(60// width (Width)
    
write_byte(0// noise (Sound)
    
write_byte(red// red (Color R)
    
write_byte(green// green(Color R)
    
write_byte(blue// blue (Color B)
    
write_byte(brightness// brightness (Color brightness)
    
write_byte(0// speed (Speed)
    
message_end()
    
    
// Medium ring (The aura)
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_BEAMCYLINDER// TE id
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x axis
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y axis
    
engfunc(EngFunc_WriteCoordoriginF[2]+300.0// z axis
    
write_short(g_shokewaveSpr// sprite
    
write_byte(0// startframe
    
write_byte(0// framerate
    
write_byte(4// life
    
write_byte(60// width
    
write_byte(0// noise
    
write_byte(red// red
    
write_byte(green// green
    
write_byte(blue// blue
    
write_byte(brightness// brightness
    
write_byte(0// speed
    
message_end()
    
    
// Largest ring (Small halo)
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_BEAMCYLINDER// TE id
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x axis
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y axis
    
engfunc(EngFunc_WriteCoordoriginF[2]+200.0// z axis
    
write_short(g_shokewaveSpr// sprite
    
write_byte(0// startframe
    
write_byte(0// framerate
    
write_byte(4// life
    
write_byte(60// width
    
write_byte(0// noise
    
write_byte(red// red
    
write_byte(green// green
    
write_byte(blue// blue
    
write_byte(brightness// brightness
    
write_byte(0// speed
    
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)
}
*/
stock set_speed_to_velocity(idFloat:scalar 1.0)
{
    
// Get our current velocity
    
static Float:velocity[3]
    
pev(idpev_velocityvelocity)
    
xs_vec_mul_scalar(velocityscalarvelocity)
    
set_pev(idpev_velocityvelocity)
    
    return 
1;
}

stock bool:is_user_on_ground(index)
{
    if (
pev(indexpev_flags) & FL_ONGROUND)
        return 
true;
    
    return 
false;
}

stock fm_set_user_jump_velocity(indexjump_height)
{
    static 
Float:velocity[3]
    
pev(indexpev_velocityvelocity)
    
velocity[2] = float(jump_height)
    
set_pev(indexpev_velocityvelocity)
    
    return 
1;
}

stock fm_get_speed(entity)
{
    static 
Float:velocity[3]
    
pev(entitypev_velocityvelocity)
    
    return 
floatround(vector_length(velocity));
}

#if defined BOUNCE_EFFECT
stock get_speed_vector_to_entity(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;
}
#endif

#if defined DROP_GUN
stock drop_current_weapon(id
{
    static 
weapon_idclipammo
    weapon_id 
get_user_weapon(idclipammo)
    
    if (((
1<<weapon_id) & PRIMARY_WEAPONS_BIT_SUM) || ((1<<weapon_id) & SECONDARY_WEAPONS_BIT_SUM))
    {
        static 
weapon_name[32]
        
get_weaponname(weapon_idweapon_namesizeof weapon_name 1)
        
engclient_cmd(id"drop"weapon_name)
    }
}
#endif 
Sorry to bump,here all has been translate to english lang!
K4rim 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 07:44.


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