Najpierw podam kod
/*================================================================================
---------------------------------
-*- [ZP] Low HP Heartbeat 1.1 -*-
---------------------------------
~~~~~~~~~~~~~~~
- Description -
~~~~~~~~~~~~~~~
This plugin plays a heartbeat sound on humans when their health
is under certain amount.
~~~~~~~~~
- CVARS -
~~~~~~~~~
* zp_heartbeat_hp <50> - Heartbeats start when HP is lower than this
~~~~~~~~~~~~~~
- Credits to -
~~~~~~~~~~~~~~
* ConnorMcLeod, AlexBreems: for the original plugin
================================================================================*/
#include <amxmodx>
#include <zombieplague>
/*================================================================================
[Plugin Customization]
=================================================================================*/
// Sounds
new const g_heartbeat[] = "player/heartbeat1.wav"
/*============================================================================*/
new cvar_heartbeathp
public plugin_precache()
{
precache_sound(g_heartbeat)
}
public plugin_init()
{
register_plugin("[ZP] Low HP Heartbeat", "1.1", "ConnorMcLeod/MeRcyLeZZ")
register_event("Damage", "event_damage", "be", "2>0")
register_event("DeathMsg", "event_deathmsg", "a")
register_event("ResetHUD", "event_resethud", "be")
register_event("Spectator", "event_spectator", "a")
cvar_heartbeathp = register_cvar("zp_heartbeat_hp", "50")
}
public event_damage(id)
{
if (get_user_health(id) > get_pcvar_num(cvar_heartbeathp) || zp_get_user_zombie(id))
return;
// * Replaced with emit_sound so players near us can hear it too *
//client_cmd(id, "spk %s", g_heartbeat)
//emit_sound(id, CHAN_STATIC, g_heartbeat, 0.0, 0.0, SND_STOP, PITCH_NORM)
emit_sound(id, CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
public event_deathmsg()
{
emit_sound(read_data(2), CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, SND_STOP, PITCH_NORM)
}
public event_resethud(id)
{
emit_sound(id, CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, SND_STOP, PITCH_NORM)
}
public event_spectator()
{
emit_sound(read_data(1), CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, SND_STOP, PITCH_NORM)
}
public zp_user_infected_post(id, infector)
{
emit_sound(id, CHAN_AUTO, g_heartbeat, 1.0, ATTN_NORM, SND_STOP, PITCH_NORM)
}
I plugin niby działa, ale tylko z tym dźwiękiem co jest w kodzie (a ten dźwięk jest "nieczysty")... jak wpisze się ścieżkę do innego dźwięku to odtwarza go, ale tylko jeden raz. Ktoś może wie co zrobić, żeby odtwarzał się cały czas?
A jak już naprawdę nie da się nic z tym zrobić to prosiłbym o przerobienie tego pluginu
#include <amxmodx>
#include <amxmisc>
#include <engine>
#define TASK_SERCE 2848
new play_h[33]
public plugin_init() {
register_plugin("Do you hear?","1.0","Miczu")
register_event("Health","Health","be")
}
public plugin_precache(){
precache_sound("misc/hb.wav")
}
public Health(id){
new heal = read_data(1)
new args[1]
args[0]=id
if(heal<25){
if(play_h[id]==0){
set_task(1.0,"serce",args[0]+TASK_SERCE,args,1)
play_h[id]=1
}
}
else play_h[id]=0
}
public serce(args[1]){
if(!is_user_alive(args[0])) return
new Float: heal = entity_get_float ( args[0], EV_FL_health )
emit_sound(args[0],CHAN_BODY,"misc/hb.wav",0.5,ATTN_NORM,0,80)
if(heal<13) set_task(0.8,"serce",args[0]+TASK_SERCE,args,2)
else if(heal<25) set_task(1.0,"serce",args[0]+TASK_SERCE,args,2)
}
tak żeby dźwięk nie odtwarzał się jak ktoś jest zombiakiem w zombi modzie. Wiem, że pewnie trzeba dodać
#include <zombieplague>i
public zp_user_infected_post(id, infector, nemesis) {
I TUTAJ JAKIŚ KOD
}
Ale co jeszcze to ja już nie jestem taki kumaty ;/ Więc mam nadzieje, że jak już nikt nie poradzi sobie z tym pierwszym to może przerobienie tego pluginu będzie łatwiejsze. Oczywiście z góry dzięki.
18 lipiec 2010 - 04:08:
Czy naprawdę przerobienie tego pluginu jest aż tak trudne? Bo na moje oko to tak jak pisałem, jest to dopisanie paru linijek i nie wydaje mi się, żeby był to duży problem dla obeznanych...