#include <amxmodx>
#define PLUGIN "WeaponKill"
#define VERSION "1.02"
#define AUTHOR "Slove."
#define MAX_LEN 32
new const KillSoundList[][] =
{
"zvukkill/granade_kill.mp3",
"zvukkill/suicide.mp3"
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "death_message", "a")
}
public plugin_precache()
{
precache_sound(KillSoundList[0])
precache_sound(KillSoundList[1])
}
public death_message()
{
new iKiller = read_data(1)
if(!is_user_connected(iKiller))
return;
new sWeapon[MAX_LEN +1], iVictim, status
read_data(4, sWeapon, MAX_LEN)
iVictim = read_data(2)
if(equali(sWeapon, "grenade")) status = 1
if(iVictim == iKiller) status = 2
if(status)
{
new sName[2][MAX_LEN +1]
get_user_name(iKiller, sName[0], MAX_LEN)
get_user_name(iVictim, sName[1], MAX_LEN)
client_cmd(0, "mp3 play sound/%s", KillSoundList[status -1])
chat_print(0, "^4[Ñåðâåð] ^1Èãðîê ^4%s ^1ïîäîðâàë ^4%s ^1è ñòàë ^3%s.", sName[0], sName[1], status < 2 ? "ïîäðûâíèêîì" : "ñàìîóáèéöåé")
}
}
stock chat_print(const id, const input[], any:...)
{
new nCount = 1, nNum[32], nMsgs[191]
vformat(nMsgs, 190, input, 3)
replace_all(nMsgs, 190, "!g", "^4")
replace_all(nMsgs, 190, "!n", "^1")
replace_all(nMsgs, 190, "!t", "^3")
static iMsg
if(!iMsg)
iMsg = get_user_msgid("SayText")
if(id) nNum[0] = id; else get_players(nNum, nCount, "ch")
{
for(new i; i < nCount; i++)
{
message_begin(MSG_ONE_UNRELIABLE, iMsg, .player = nNum[i])
write_byte(nNum[i])
write_string(nMsgs)
message_end()
}
}
}
#include <amxmodx>
#define PLUGIN "WeaponKill"
#define VERSION "1.02"
#define AUTHOR "Slove."
#define MAX_LEN 32
new const KillSoundList[][] =
{
"zvukkill/granade_kill.mp3",
"zvukkill/suicide.mp3"
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("DeathMsg", "death_message", "a")
}
public plugin_precache()
{
precache_sound(KillSoundList[0])
precache_sound(KillSoundList[1])
}
public death_message()
{
new iKiller = read_data(1)
if(!is_user_connected(iKiller))
return;
new sWeapon[MAX_LEN +1], iVictim, status
read_data(4, sWeapon, MAX_LEN)
iVictim = read_data(2)
if(equali(sWeapon, "grenade")) status = 1
if(iVictim == iKiller) status = 2
if(status)
{
new sName[2][MAX_LEN +1]
get_user_name(iKiller, sName[0], MAX_LEN)
get_user_name(iVictim, sName[1], MAX_LEN)
client_cmd(0, "mp3 play sound/%s", KillSoundList[status -1])
chat_print(0, "^4[Сервер] ^1Игрок ^4%s ^1подорвал ^4%s ^1и стал ^3%s.", sName[0], sName[1], status < 2 ? "подрывником" : "самоубийцей")
}
}
stock chat_print(const id, const input[], any:...)
{
new nCount = 1, nNum[32], nMsgs[191]
vformat(nMsgs, 190, input, 3)
replace_all(nMsgs, 190, "!g", "^4")
replace_all(nMsgs, 190, "!n", "^1")
replace_all(nMsgs, 190, "!t", "^3")
static iMsg
if(!iMsg)
iMsg = get_user_msgid("SayText")
if(id) nNum[0] = id; else get_players(nNum, nCount, "ch")
{
for(new i; i < nCount; i++)
{
message_begin(MSG_ONE_UNRELIABLE, iMsg, .player = nNum[i])
write_byte(nNum[i])
write_string(nMsgs)
message_end()
}
}
}
А можешь вырезать звука ножаНе проверял!
Кодировку подправилКод:#include <amxmodx> #define PLUGIN "WeaponKill" #define VERSION "1.02" #define AUTHOR "Slove." #define MAX_LEN 32 new const KillSoundList[][] = { "zvukkill/granade_kill.mp3", "zvukkill/suicide.mp3" } public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_event("DeathMsg", "death_message", "a") } public plugin_precache() { precache_sound(KillSoundList[0]) precache_sound(KillSoundList[1]) } public death_message() { new iKiller = read_data(1) if(!is_user_connected(iKiller)) return; new sWeapon[MAX_LEN +1], iVictim, status read_data(4, sWeapon, MAX_LEN) iVictim = read_data(2) if(equali(sWeapon, "grenade")) status = 1 if(iVictim == iKiller) status = 2 if(status) { new sName[2][MAX_LEN +1] get_user_name(iKiller, sName[0], MAX_LEN) get_user_name(iVictim, sName[1], MAX_LEN) client_cmd(0, "mp3 play sound/%s", KillSoundList[status -1]) chat_print(0, "^4[Ñåðâåð] ^1Èãðîê ^4%s ^1ïîäîðâàë ^4%s ^1è ñòàë ^3%s.", sName[0], sName[1], status < 2 ? "ïîäðûâíèêîì" : "ñàìîóáèéöåé") } } stock chat_print(const id, const input[], any:...) { new nCount = 1, nNum[32], nMsgs[191] vformat(nMsgs, 190, input, 3) replace_all(nMsgs, 190, "!g", "^4") replace_all(nMsgs, 190, "!n", "^1") replace_all(nMsgs, 190, "!t", "^3") static iMsg if(!iMsg) iMsg = get_user_msgid("SayText") if(id) nNum[0] = id; else get_players(nNum, nCount, "ch") { for(new i; i < nCount; i++) { message_begin(MSG_ONE_UNRELIABLE, iMsg, .player = nNum[i]) write_byte(nNum[i]) write_string(nMsgs) message_end() } } }
Код:#include <amxmodx> #define PLUGIN "WeaponKill" #define VERSION "1.02" #define AUTHOR "Slove." #define MAX_LEN 32 new const KillSoundList[][] = { "zvukkill/granade_kill.mp3", "zvukkill/suicide.mp3" } public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_event("DeathMsg", "death_message", "a") } public plugin_precache() { precache_sound(KillSoundList[0]) precache_sound(KillSoundList[1]) } public death_message() { new iKiller = read_data(1) if(!is_user_connected(iKiller)) return; new sWeapon[MAX_LEN +1], iVictim, status read_data(4, sWeapon, MAX_LEN) iVictim = read_data(2) if(equali(sWeapon, "grenade")) status = 1 if(iVictim == iKiller) status = 2 if(status) { new sName[2][MAX_LEN +1] get_user_name(iKiller, sName[0], MAX_LEN) get_user_name(iVictim, sName[1], MAX_LEN) client_cmd(0, "mp3 play sound/%s", KillSoundList[status -1]) chat_print(0, "^4[Сервер] ^1Игрок ^4%s ^1подорвал ^4%s ^1и стал ^3%s.", sName[0], sName[1], status < 2 ? "подрывником" : "самоубийцей") } } stock chat_print(const id, const input[], any:...) { new nCount = 1, nNum[32], nMsgs[191] vformat(nMsgs, 190, input, 3) replace_all(nMsgs, 190, "!g", "^4") replace_all(nMsgs, 190, "!n", "^1") replace_all(nMsgs, 190, "!t", "^3") static iMsg if(!iMsg) iMsg = get_user_msgid("SayText") if(id) nNum[0] = id; else get_players(nNum, nCount, "ch") { for(new i; i < nCount; i++) { message_begin(MSG_ONE_UNRELIABLE, iMsg, .player = nNum[i]) write_byte(nNum[i]) write_string(nMsgs) message_end() } } }
#include <amxmodx>
#include <reapi>
new const g_sSound[][] = {
"zvukkill/granade_kill.mp3",
"zvukkill/suicide.mp3"
};
public plugin_init() {
new const AUTHOR[] = "Slove.";
register_plugin("Weapon Kill[RP]", "1.03", AUTHOR);
RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayerKilledPost", true);
}
public plugin_precache() {
precache_sound(g_sSound[0]);
precache_sound(g_sSound[1]);
}
public CBasePlayerKilledPost(iVictim, iAttacker, inflictor) {
if(!is_user_connected(iAttacker))
return;
new status;
if(FClassnameIs(inflictor, "grenade")) status = 1;
if(iVictim == iAttacker) status = 2;
if(status) {
rg_send_audio(0, g_sSound[status -1]);
client_print(0, print_chat, "WK| Игрок %n подорвал %n и стал %s", iAttacker, iVictim, status < 2 ? "подрывником" : "самоубийцей");
}
}
Не заметил, спасибо..А вообще держи, проверишь уже сам!
Код:#include <amxmodx> #include <reapi> new const g_sSound[][] = { "zvukkill/granade_kill.mp3", "zvukkill/suicide.mp3" }; public plugin_init() { new const AUTHOR[] = "Slove."; register_plugin("Weapon Kill[RP]", "1.03", AUTHOR); RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayerKilledPost", true); } public plugin_precache() { precache_sound(g_sSound[0]); precache_sound(g_sSound[1]); } public CBasePlayerKilledPost(iVictim, iAttacker, inflictor) { if(!is_user_connected(iAttacker)) return; new status; if(FClassnameIs(inflictor, "grenade")) status = 1; if(iVictim == iAttacker) status = 2; if(status) { rg_send_audio(0, g_sSound[status -1]); client_print(0, print_chat, "WK| Игрок %n подорвал %n и стал %s", iAttacker, iVictim, status < 2 ? "подрывником" : "самоубийцей"); } }
А можешь еще вырезать суицид?Не заметил, спасибо..
#include <amxmodx>
#include <reapi>
new const g_sSound[] = "zvukkill/suicide.mp3";
public plugin_init() {
new const AUTHOR[] = "Slove.";
register_plugin("Weapon Kill[RP]", "1.03", AUTHOR);
RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayerKilledPost", true);
}
public plugin_precache()
precache_sound(g_sSound);
public CBasePlayerKilledPost(iVictim, iAttacker, inflictor) {
if(!is_user_connected(iAttacker))
return;
if(FClassnameIs(inflictor, "grenade")) {
rg_send_audio(0, g_sSound);
client_print(0, print_chat, "WK| Игрок %n подорвал %n и стал подрывником", iAttacker, iVictim);
}
}
спасибо.Пора уже учиться и самому!!!!
Код:#include <amxmodx> #include <reapi> new const g_sSound[] = "zvukkill/suicide.mp3"; public plugin_init() { new const AUTHOR[] = "Slove."; register_plugin("Weapon Kill[RP]", "1.03", AUTHOR); RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayerKilledPost", true); } public plugin_precache() precache_sound(g_sSound); public CBasePlayerKilledPost(iVictim, iAttacker, inflictor) { if(!is_user_connected(iAttacker)) return; if(FClassnameIs(inflictor, "grenade")) { rg_send_audio(0, g_sSound); client_print(0, print_chat, "WK| Игрок %n подорвал %n и стал подрывником", iAttacker, iVictim); } }
//https://wiki.alliedmods.net/Half-Life_1_Game_Events#DeathMsg
register_event("DeathMsg", "Event_GrenadeKill", "b", "4=grenade");
public Event_GrenadeKill() {
enum {
_pVictim = 1,
_pAttacker
};
new pVictim = read_data(_pVictim);
new pAttacker = read_data(_pAttacker);
client_print_color(0,print_team_default,"Игрок ^4%n ^1подорвал ^4%n ^1и стал ^4%s",pAttacker,pVictim,pAttacker == pVictim ? "самоубийцей" : "подрывником");
}
не работает! плагин компилит но не работает звукспасибо.
Натив-функцияне работает! плагин компилит но не работает звук
rg_send_audio
подходит только для звуков в формате .wavemit_sound
/ client_cmd
идика по учись ты сам. Херню какую то делаешь. Нифига не работает.Пора уже учиться и самому!!!!
Код:#include <amxmodx> #include <reapi> new const g_sSound[] = "zvukkill/suicide.mp3"; public plugin_init() { new const AUTHOR[] = "Slove."; register_plugin("Weapon Kill[RP]", "1.03", AUTHOR); RegisterHookChain(RG_CBasePlayer_Killed, "CBasePlayerKilledPost", true); } public plugin_precache() precache_sound(g_sSound); public CBasePlayerKilledPost(iVictim, iAttacker, inflictor) { if(!is_user_connected(iAttacker)) return; if(FClassnameIs(inflictor, "grenade")) { rg_send_audio(0, g_sSound); client_print(0, print_chat, "WK| Игрок %n подорвал %n и стал подрывником", iAttacker, iVictim); } }
Спасибо дружище, звуки я не проверял, подправлю на emit_soundНатив-функцияrg_send_audio
подходит только для звуков в формате .wav
Для звуков в формате .mp3 только черезemit_sound
/client_cmd
А потом удивляешься, почему к тебе так относятся!! Что бы такие вещи писать, ты палец о палец не ударил, первый пост исправленый не под реапи верный. Вот бери его за основу и пиши сам.идика по учись ты сам. Херню какую то делаешь. Нифига не работает.
)Спасибо дружище, звуки я не проверял, подправлю на emit_sound
А потом удивляешься, почему к тебе так относятся!! Что бы такие вещи писать, ты палец о палец не ударил, первый пост исправленый не под реапи верный. Вот бери его за основу и пиши сам.