Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

Звук к гранате

Статус пользователя Fred Perry
сообщение 9.3.2012, 9:22
Сообщение #1


Иконка группы

Стаж: 16 лет

Сообщений: 6594
Благодарностей: 2370
Полезность: 813

Всем здарова!
Помогите прикрепить звук, а именно, когда вытягиваешь гранату был один звук, когда зажимаешь был второй звук.
Эти гранаты у меня вписаны в зомби классы, вот исходник гранат (я вытащил что связано с гранатами):

Гранаты
new const g_vgrenade[] = "models/bomb/v_bomb_china.mdl"
new const g_pgrenade[] = "models/bomb/p_zombibomb.mdl"

public plugin_precache()
{
precache_model(g_vgrenade)
precache_model(g_pgrenade)
}

public plugin_init()
{
register_event("CurWeapon","handle_gun","be","1=1")
}

public handle_gun(id)
{
new weap = get_user_weapon(id)

if(weap == CSW_HEGRENADE && zp_get_user_zombie_class(id) == g_zclass_china && zp_get_user_zombie(id))
{
entity_set_string(id, EV_SZ_viewmodel, g_vgrenade)
set_pev(id, pev_weaponmodel2, g_pgrenade);
}
else if(weap == CSW_SMOKEGRENADE && zp_get_user_zombie_class(id) == g_zclass_china && zp_get_user_zombie(id))
{
entity_set_string(id, EV_SZ_viewmodel, g_vgrenade)
set_pev(id, pev_weaponmodel2, g_pgrenade);
}
else if(weap == CSW_FLASHBANG && zp_get_user_zombie_class(id) == g_zclass_china && zp_get_user_zombie(id))
{
entity_set_string(id, EV_SZ_viewmodel, g_vgrenade)
set_pev(id, pev_weaponmodel2, g_pgrenade);
}

if(weap == CSW_HEGRENADE && zp_get_user_zombie(id))
{
set_pev(id, pev_weaponmodel2, g_pgrenade);
}
else if(weap == CSW_SMOKEGRENADE && zp_get_user_zombie(id))
{
set_pev(id, pev_weaponmodel2, g_pgrenade);
}
else if(weap == CSW_FLASHBANG && zp_get_user_zombie(id))
{
set_pev(id, pev_weaponmodel2, g_pgrenade);
}


return PLUGIN_HANDLED
}

Полный исходник

#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <zombieplague>
#include <fun>

#define PLUGIN "[ZP] Class - china"
#define VERSION "1.1"
#define AUTHOR "HoRRoR"

// Zombie Attributes
new const zclass_name[] = "Китаец" // name
new const zclass_info[] = "\yУскорение [T]" // description
new const zclass_model[] = "china" // model
new const zclass_clawmodel[] = "v_china.mdl" // claw model
new const g_vgrenade[] = "models/bomb/v_bomb_china.mdl"
new const g_pgrenade[] = "models/bomb/p_zombibomb.mdl"
const zclass_health = 4500 // health
const zclass_speed = 245 // speed
const Float:zclass_gravity = 1.0 // gravity
const Float:zclass_knockback = 2.0 // knockback

// --- config ------------------------ //
#define TRAIL_LIFE 2
#define TRAIL_WIDTH 10
#define TRAIL_RED 90
#define TRAIL_GREEN 200
#define TRAIL_BLUE 90
#define TRAIL_BRIGTHNESS 220

new Float:g_fastspeed = 360.0 // sprint speed
new Float:g_normspeed = 245.0 // norm speed. must be as zclass_speed
new Float:g_abilonecooldown = 30.0 // cooldown time
new Float:g_abilonelenght = 7.0 // time of sprint
new const sound_china_sprint[] = "zombie_plague/china_spd.wav" //sprint sound
// ----------------------------------- //

new i_cooldown_time[33]
new g_zclass_china
new g_speeded[33] = 0
new g_abil_one_used[33] = 0
new gTrail
new g_maxplayers

public plugin_precache()
{
g_zclass_china = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
precache_sound(sound_china_sprint)
precache_model(g_vgrenade)
precache_model(g_pgrenade)
}

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("ability1", "use_ability_one")
register_concmd("ability1", "use_ability_one")

register_forward( FM_PlayerPreThink, "client_prethink" )
register_logevent("roundStart", 2, "1=Round_Start")
register_event("CurWeapon","handle_gun","be","1=1")

g_maxplayers = get_maxplayers()

gTrail = engfunc(EngFunc_PrecacheModel,"sprites/smoke.spr")
}


public client_prethink(id)
{
if (zp_get_user_zombie_class(id) == g_zclass_china)
{
if(is_user_alive(id) && zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_zclass_china) && !zp_get_user_nemesis(id))
Action(id);
}
}

public Action(id)
{
if (g_speeded[id] == 1)
{
set_user_maxspeed(id , g_fastspeed);
}
else
{
set_user_maxspeed(id , g_normspeed);
}
return PLUGIN_HANDLED;
}

public roundStart()
{
for (new i = 1; i <= g_maxplayers; i++)
{
i_cooldown_time[i] = floatround(g_abilonecooldown)
g_abil_one_used[i] = 0
g_speeded[i] = 0
remove_task(i)
client_cmd(i,"cl_forwardspeed 400")
client_cmd(i,"cl_backspeed 400")
}
}

public ShowHUD(id)
{
if(is_user_alive(id))
{
i_cooldown_time[id] = i_cooldown_time[id] - 1;
set_hudmessage(200, 100, 0, 0.75, 0.92, 0, 1.0, 1.1, 0.0, 0.0, -1)
show_hudmessage(id, "Следующее ускорение через: %d",i_cooldown_time[id])
}else{
remove_task(id)
}
}

public Spawn(id)
{
set_user_rendering(id)

}

public use_ability_one(id)
{
if (is_user_alive(id) && (zp_get_user_zombie_class(id) == g_zclass_china) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
{

if(g_abil_one_used[id] == 0)
{
client_cmd(id,"cl_forwardspeed 1600")
client_cmd(id,"cl_backspeed 1600")

message_begin (MSG_BROADCAST,SVC_TEMPENTITY)
write_byte (TE_BEAMFOLLOW)
write_short (id)
write_short (gTrail)
set_user_rendering(id, kRenderFxGlowShell,255,0,0,kRenderNormal,25)
write_byte (TRAIL_LIFE)
write_byte (TRAIL_WIDTH)
write_byte (TRAIL_RED)
write_byte (TRAIL_GREEN)
write_byte (TRAIL_BLUE)
write_byte (TRAIL_BRIGTHNESS)
message_end()

g_speeded[id] = 1
emit_sound(id, CHAN_STREAM, sound_china_sprint, 1.0, ATTN_NORM, 0, PITCH_NORM)
g_abil_one_used[id] = 1
set_task(g_abilonelenght,"set_normal_speed",id)

i_cooldown_time[id] = floatround(g_abilonecooldown)
set_task(1.0, "ShowHUD", id, _, _, "a",i_cooldown_time[id])
// client_print(id,print_chat,"[dev] - use ability")
}
}
}

public set_normal_speed(id)
{
if ((zp_get_user_zombie_class(id) == g_zclass_china) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
{
g_speeded[id] = 0
set_user_rendering(id)
client_cmd(id,"cl_forwardspeed 400")
client_cmd(id,"cl_backspeed 400")
set_task(g_abilonecooldown,"set_ability_one_cooldown",id)
// client_print(id,print_chat,"[dev] - executed 'set normal speed' task")
}
}

public set_ability_one_cooldown(id)
{
if ((zp_get_user_zombie_class(id) == g_zclass_china) && zp_get_user_zombie(id) && !zp_get_user_nemesis(id))
{
g_abil_one_used[id] = 0
new text[100]
format(text,99,"^x04[ZP]^x01 Способность ^x04Ускорения^x01 активна.")
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id)
write_byte(id)
write_string(text)
message_end()
}
}

public zp_user_infected_post(id, infector)
{
if ((zp_get_user_zombie_class(id) == g_zclass_china) && !zp_get_user_nemesis(id))
{

new text[100]
new note_cooldown = floatround(g_abilonecooldown)
format(text,99,"^x04[ZP]^x01 Ваша способность ^x04Ускорение^x01. Откат:^x04 %d ^x01секунд.",note_cooldown)
message_begin(MSG_ONE,get_user_msgid("SayText"),{0,0,0},id)
write_byte(id)
write_string(text)
message_end()

i_cooldown_time[id] = floatround(g_abilonecooldown)
remove_task(id)
g_speeded[id] = 0
g_abil_one_used[id] = 0
client_cmd(id,"bind t ability1")
}
}

public handle_gun(id)
{
new weap = get_user_weapon(id)

if(weap == CSW_HEGRENADE && zp_get_user_zombie_class(id) == g_zclass_china && zp_get_user_zombie(id))
{
entity_set_string(id, EV_SZ_viewmodel, g_vgrenade)
set_pev(id, pev_weaponmodel2, g_pgrenade);
}
else if(weap == CSW_SMOKEGRENADE && zp_get_user_zombie_class(id) == g_zclass_china && zp_get_user_zombie(id))
{
entity_set_string(id, EV_SZ_viewmodel, g_vgrenade)
set_pev(id, pev_weaponmodel2, g_pgrenade);
}
else if(weap == CSW_FLASHBANG && zp_get_user_zombie_class(id) == g_zclass_china && zp_get_user_zombie(id))
{
entity_set_string(id, EV_SZ_viewmodel, g_vgrenade)
set_pev(id, pev_weaponmodel2, g_pgrenade);
}

if(weap == CSW_HEGRENADE && zp_get_user_zombie(id))
{
set_pev(id, pev_weaponmodel2, g_pgrenade);
}
else if(weap == CSW_SMOKEGRENADE && zp_get_user_zombie(id))
{
set_pev(id, pev_weaponmodel2, g_pgrenade);
}
else if(weap == CSW_FLASHBANG && zp_get_user_zombie(id))
{
set_pev(id, pev_weaponmodel2, g_pgrenade);
}


return PLUGIN_HANDLED
}

public zp_user_humanized_post(id)
{
remove_task(id)
client_cmd(id,"cl_forwardspeed 400")
client_cmd(id,"cl_backspeed 400")
}



Отредактировал: Fred Perry, - 9.3.2012, 9:23


Гнилой фашистской нечисти
Загоним пулю в лоб,
Отродью человечества
Сколотим крепкий гроб!
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
  Тема закрытаНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: