Здравствуйте, надо исправить плагин,чтобы воспроизводился звук и в HUD выводилось сообщение.Прошу помочь, добрые люди.
Код
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <colorchat>
static const PLUGIN_NAME[] = "Hns Ownage";
static const PLUGIN_AUTHOR[] = "lkz";
static const PLUGIN_VERSION[] = "1.2";
new const TAG[] = "UNITABLE-HNS";
#pragma semicolon 1
#define TIME 30.0
new Float: Block[33];
new g_hud_center;
new const Sounds[3][] = {
"misc/ownage.wav","misc/ownage2.wav",
"misc/ownage3.wav"
};
new bool:HostNameOk = false;
new bool:Paused = false;
public plugin_precache() {
new HostName[64];
get_cvar_string("hostname",HostName,63);
if(containi(HostName, "HNSX.Indungi") != -1) {
HostNameOk = true;
Paused = false;
precache_sound("sound/misc/ownage.wav");
precache_sound("sound/misc/ownage2.wav");
precache_sound("sound/misc/ownage3.wav");
} else {
HostNameOk = false;
Paused = true;
}
}
public plugin_init() {
if(!HostNameOk)
{
new pluginName[33];
format(pluginName, 32, "%s", PLUGIN_NAME);
register_plugin(pluginName,PLUGIN_VERSION,PLUGIN_AUTHOR);
pause("ac","hns_ownage.amxx");
}
else if(HostNameOk)
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
register_forward(FM_Touch, "fwd_Owning");
g_hud_center = CreateHudSyncObj();
set_task(TIME,"check_hostname",_,_,_,"b");
}
}
public check_hostname()
{
new HostName[64];
get_cvar_string("hostname",HostName,63);
if(containi(HostName, "HNSX.Indungi") != -1 && Paused) {
unpause("ac","hns_ownage.amxx");
Paused = false;
ColorChat(0,RED,"^x04[%s]^x03 Plugin-ul Hns Ownage este scos de pe pauza",TAG);
ColorChat(0,RED,"^x04[%s]^x03 Deoarece numele server-ului contine HNSX.Indungi !",TAG);
}
else if( !(containi(HostName, "HNSX.Indungi") != -1) && !Paused) {
pause("ac","hns_ownage.amxx");
Paused = true;
ColorChat(0,RED,"^x04[%s]^x03 Plugin-ul Hns Ownage este pus pe pauza",TAG);
ColorChat(0,RED,"^x04[%s]^x03 Deoarece numele server-ului nu contine HNSX.Indungi !",TAG);
}
}
public client_connect(id) {
Block[id] = get_gametime();
}
public fwd_Owning(owned, owner) {
static OwnedClassname[32],OwnerClassname[32];
pev(owned,pev_classname,OwnedClassname, 31);
pev(owner, pev_classname, OwnerClassname, 31);
if(!equal(OwnedClassname, "player") || !equal(OwnerClassname, "player")) return FMRES_IGNORED;
if(!is_user_ok(owned) || !is_user_ok(owner) ) return FMRES_IGNORED;
if(cs_get_user_team(owner) == CS_TEAM_CT || cs_get_user_team(owner) == cs_get_user_team(owned)) return FMRES_IGNORED;
static Float:OwnedOrigin[3],Float:OwnerOrigin[3];
pev(owned, pev_origin, OwnedOrigin);
pev(owner, pev_origin, OwnerOrigin);
new Float:OwnDistance = OwnerOrigin[2] - OwnedOrigin[2];
if( OwnDistance >= 35 ) {
if((get_gametime() - Block[owner] > 3.0)) {
new name[32],name2[32];
get_user_name(owner,name,31);
get_user_name(owned,name2,31);
set_hudmessage( 205, 92, 92, -1.0, 0.20, 0, 0.0, 2.0, 0.0, 1.0, -1);
ShowSyncHudMsg(0, g_hud_center, "%s OWNED %s",name,name2);
ColorChat(0,RED,"^x04[%s]^x03 %s^x01 OWNED^x03 %s^x01 !",TAG,name,name2);
client_cmd(0,"spk %s",Sounds[random_num(0,10)]);
ShakeScreen(owned);
FadeScreen(owned);
Block[owner] = get_gametime();
return FMRES_IGNORED;
}
}
return FMRES_IGNORED;
}
stock is_user_ok(id) {
if(is_user_alive(id) && is_user_connected(id) && !is_user_bot(id))
return 1;
return 0;
}
ShakeScreen(id) {
message_begin(MSG_ONE,get_user_msgid("ScreenShake"),{0,0,0},id);
write_short(floatround(4096.0 * 3.0, floatround_round));
write_short(floatround(4096.0 * 3.0, floatround_round));
write_short(1<<13);
message_end();
}
FadeScreen(id) {
message_begin(MSG_ONE, get_user_msgid("ScreenFade"), _, id);
write_short(floatround(4096.0 * 3.0, floatround_round));
write_short(floatround(4096.0 * 3.0, floatround_round));
write_short(0x0000);
write_byte(255);
write_byte(0);
write_byte(0);
write_byte(110);
message_end();
}
Отредактировал: adokf, - 23.2.2015, 15:45