Вот первый. Выводит дамаг который нанес игрок другому. Отредактированный под мои пожелания.
Код:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
new bool: ncd_rec, ncd_msg_1, ncd_msg_2
public plugin_init()
{
register_plugin("Nice Colored Damage", "1.0", "sector")
register_event("Damage", "ncd_damage", "b", "2!0", "3=0", "4!0")
register_event("HLTV", "ncd_new_round", "a", "1=0", "2=0")
ncd_msg_1 = CreateHudSyncObj()
ncd_msg_2 = CreateHudSyncObj()
}
public ncd_new_round()
{
ncd_rec = true
}
public ncd_damage(i)
{
static attack; attack = get_user_attacker(i)
static damage; damage = read_data(2)
if(ncd_rec)
{
set_hudmessage(50, 50, 50, 0.52, 0.47, 0, 0.1, 4.0, 0.1, 0.1, -1)
ShowSyncHudMsg(i, ncd_msg_1, "", damage)
}
if(is_user_connected(attack))
{
if(fm_is_ent_visible(attack, i))
{
set_hudmessage(50, 50, 50, 0.52, 0.47, 0, 0.1, 4.0, 0.02, 0.02, -1)
ShowSyncHudMsg(attack, ncd_msg_2, " %i ^n", damage)
}
}
}
Вот второй, пишет разного рода сообщения double kill, multikill то же по моим пожеланиям
Код:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
new KillCounter[33]
public plugin_init()
{
register_plugin("multikill", "0.1", "jhon")
RegisterHam(Ham_Spawn, "player", "ham_PlayerSpawned_Post", 1);
}
public client_death(killer, victim, wpnindex, hitplace, TK)
{
if(!is_user_connected(killer)) return
KillCounter[killer]++
if(KillCounter[killer] == 2){
set_hudmessage(50,50,50, 0.38, 0.51, .holdtime=2.0, .fadeintime=0.3, .fadeouttime=2.0, .channel=3)
show_hudmessage(killer, "Double kill")
}else if(KillCounter[killer] == 3){
set_hudmessage(200,0,0, 0.38, 0.51, .holdtime=2.0, .fadeintime=0.3, .fadeouttime=2.0, .channel=3)
show_hudmessage(killer, "Triple kill")
}else if(KillCounter[killer] == 5){
set_hudmessage(200,50,50, 0.52, 0.51, .holdtime=2.0, .fadeintime=0.3, .fadeouttime=2.0, .channel=3)
show_hudmessage(killer, "Multi kill")
}else if(KillCounter[killer] == 7){
set_hudmessage(200,0,0, 0.38, 0.51, .holdtime=2.0, .fadeintime=0.3, .fadeouttime=2.0, .channel=3)
show_hudmessage(killer, "Ultra kill")
}else if(KillCounter[killer] == 9){
set_hudmessage(50,50,50, 0.52, 0.51, .holdtime=2.0, .fadeintime=0.3, .fadeouttime=2.0, .channel=3)
show_hudmessage(killer, "Rampage!")
}
}
public ham_PlayerSpawned_Post(id)
{
if (is_user_connected(id) && is_user_alive(id))
{
KillCounter[id] = 0
}
else
{
KillCounter[id] = 0
}
}
Вот третий. Тупо ставит крестик когда убил игрока.
Код:
#include <amxmodx>
#include <hamsandwich>
public plugin_init()
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled_Post", true);
public fw_PlayerKilled_Post(id, attacker)
{
if (is_user_connected(attacker) && id != attacker)
{
set_hudmessage( 150, 150, 150, 0.48, 0.47, 0, 0.1, 0.7, 0.1, 0.1, -1);
show_hudmessage(attacker, "X");
}
}
И 4ый. Который пишет у игрока firstblood и всем это в чат сообщает. Вот тут желательно убрать все лишнее и оставить лишь firstblood и сообщение в чат
Код:
#include <amxmodx>
#include <amxmisc> // is_running()
#pragma tabsize 4
#define MY_PLUGIN_NAME "FirstBloodEx"
#define MY_PLUGIN_VERSION "0.9.11"
#define MY_PLUGIN_AUTHOR "Sonic & SL"
#define FB_FLAG_HUD_E (1<<0)
#define FB_FLAG_HUD_A (1<<1)
#define FB_FLAG_NO_HUD (FB_FLAG_HUD_E|FB_FLAG_HUD_A)
#define FB_FLAG_CHAT (1<<2)
#define FB_FLAG_SND (1<<3)
#define FB_FLAG_FH (1<<4)
#define FLAGS_COUNT 5
//#define _DEBUG
static const g_sSoundPath[] = "misc/firstblood.wav"
new bool:g_bUnderCS // flag: amxmod is running under CS or CZ
new bool:g_bPauseDeathMsg
new bool:g_bPauseDamageMsg
new g_cvarMode
new g_cvarFFA
new g_cvarTeamPlay
//-----------------------------------------------------------------------------
public plugin_init()
{
g_bUnderCS = bool:cstrike_running()
g_bPauseDeathMsg = true
g_bPauseDamageMsg = true
register_plugin(MY_PLUGIN_NAME, MY_PLUGIN_VERSION, MY_PLUGIN_AUTHOR)
if(g_bUnderCS) {
register_logevent("onRoundRestart", 2, "1=Round_Start")
}
register_event("DeathMsg", "death_msg", "a")
register_event("Damage", "damage_msg", "b", "2!0", "4!0") // dmg != 0 && x != 0
g_cvarMode = register_cvar("amx_fb_mode", "bc")
server_print("[Bpatctvo] Plugin %s initialized for %s mod", MY_PLUGIN_NAME, g_bUnderCS ? "CS": "HLDM")
return PLUGIN_CONTINUE
}
//-----------------------------------------------------------------------------
public plugin_cfg()
{
g_cvarFFA = get_cvar_pointer("mp_freeforall")
g_cvarTeamPlay = get_cvar_pointer("mp_teamplay")
if(!g_bUnderCS) switchEvent()
return PLUGIN_CONTINUE
}
//-----------------------------------------------------------------------------
public onRoundRestart()
{
switchEvent()
return PLUGIN_CONTINUE
}
//-----------------------------------------------------------------------------
public switchEvent()
{
new iFlags = getCvarAsFlags(g_cvarMode)
g_bPauseDeathMsg = iFlags & FB_FLAG_FH ? true: false
g_bPauseDamageMsg = !g_bPauseDeathMsg
}
//-----------------------------------------------------------------------------
public death_msg()
{
if(g_bPauseDeathMsg)
return PLUGIN_CONTINUE
new aIndex = read_data(1)
new vIndex = read_data(2)
#if defined _DEBUG
server_print("[Bpatctvo] FirstBloodEx::death_msg(%d, %d)", aIndex, vIndex)
#endif
if(fb_event(aIndex, vIndex))
g_bPauseDeathMsg = true
return PLUGIN_CONTINUE
}
//-----------------------------------------------------------------------------
public damage_msg()
{
if(g_bPauseDamageMsg)
return PLUGIN_CONTINUE
new vIndex = read_data(0) // index of player who has just died
new aIndex = get_user_attacker(vIndex) // get attacker's id (0 if nobody)
#if defined _DEBUG
server_print("[AMXX] FirstBloodEx::damage_msg(v=%d, a=%d)", vIndex, aIndex)
#endif
if(fb_event(aIndex, vIndex))
g_bPauseDamageMsg = true
return PLUGIN_CONTINUE
}
//-----------------------------------------------------------------------------
fb_event(aIndex, vIndex)
{
#if defined _DEBUG
server_print("[AMXX] FirstBloodEx::fb_event(%d, %d)", aIndex, vIndex)
#endif
new bool:bCheckTeams = true
if(!aIndex || aIndex == vIndex) // common check
return false
if(g_cvarFFA && get_pcvar_num(g_cvarFFA)
|| (g_cvarTeamPlay && !get_pcvar_num(g_cvarTeamPlay)))
bCheckTeams = false
if(bCheckTeams && (get_user_team(aIndex) == get_user_team(vIndex)))
return false
new aName[32], sMsg[128], sMsg2[128]
new iFlags = getCvarAsFlags(g_cvarMode)
get_user_name(aIndex, aName, 31)
format(sMsg, 127, "%s делает First Blood!!", aName)
format(sMsg2, 127, "first blood", aName)
if ((iFlags & FB_FLAG_NO_HUD) != FB_FLAG_NO_HUD) {
new iPlayerID = -1 // 0 - everybody
if (iFlags & FB_FLAG_HUD_E) iPlayerID = 0
if (iFlags & FB_FLAG_HUD_A) iPlayerID = aIndex
if(iPlayerID >= 0) {
set_hudmessage(200,0,0, 0.52, 0.51, .holdtime=2.0, .fadeintime=0.3, .fadeouttime=2.0, .channel=3)
show_hudmessage(iPlayerID, sMsg2)
cs_set_user_money(iPlayerID,cs_get_user_money(id) + 777)
}
}
if (iFlags & FB_FLAG_CHAT) client_print(0, print_chat, "%s", sMsg)
if (iFlags & FB_FLAG_SND) client_cmd(aIndex, "spk misc/firstblood")
return true
}
//-----------------------------------------------------------------------------
getCvarAsFlags(const pcvar)
{
new sValue[27]
get_pcvar_string(pcvar, sValue, sizeof(sValue)-1)
return read_flags(sValue)
}
//-----------------------------------------------------------------------------