|
楼主 |
发表于 2011-1-10 07:34:22
|
显示全部楼层
来自 中国–黑龙江–哈尔滨
#include <amxmodx>
#include <cstrike>
#define MAX_NAME_LENGTH 32
#define MAX_TEXT_LENGTH 512
new g_BonusCount = 0
new g_BonusCount2 = 0
new g_TeamScore[ CsTeams ]
new g_SupermanMoney
new g_HeroMoney
new g_MinPlayers
public plugin_init()
{
register_plugin("Bonus for Hero", "1.0", "无所谓")
register_event("TeamScore", "fw_EvTeamScore", "a")
register_event("DeathMsg", "event_death", "a")
register_event("SendAudio", "event_round_end", "a", "2&%!MRAD_terwin", "2&%!MRAD_ctwin", "2&%!MRAD_rounddraw")
g_SupermanMoney = register_cvar("Superman_Money", "3000");
g_HeroMoney = register_cvar("Hero_Money", "1500");
g_MinPlayers = register_cvar("Bonus_minplayers", "4");
}
public fw_EvTeamScore()
{
new szTeam[2];
read_data(1, szTeam, 1);
g_TeamScore[ ( szTeam[0] == 'T' ) ? CS_TEAM_T : CS_TEAM_CT ] = read_data(2);
}
public event_death()
{
new i_numplayers = get_playersnum(0);
if (i_numplayers < get_pcvar_num(g_MinPlayers)) return PLUGIN_CONTINUE;
new iKiller = read_data(1)
new iVictim = read_data(2)
new sMsg[MAX_TEXT_LENGTH]
new sName[MAX_NAME_LENGTH]
new sMsg2[MAX_TEXT_LENGTH]
new sName2[MAX_NAME_LENGTH]
get_user_name(iKiller, sName, MAX_NAME_LENGTH)
get_user_name(iVictim, sName2, MAX_NAME_LENGTH)
new CsTeams:ctLosingTeam
if( g_TeamScore[ CS_TEAM_T ] > g_TeamScore[ CS_TEAM_CT ] )
{
ctLosingTeam = CS_TEAM_CT;
}
else if( g_TeamScore[ CS_TEAM_CT ] > g_TeamScore[ CS_TEAM_T ] )
{
ctLosingTeam = CS_TEAM_T;
}
else
{
return PLUGIN_CONTINUE
}
if ( (cs_get_user_team(iKiller) == ctLosingTeam) && (iKiller != iVictim) && (g_BonusCount < 1) && (cs_get_user_team(iKiller) != cs_get_user_team(iVictim)) )
{
g_BonusCount++
cs_set_user_money(iKiller, cs_get_user_money(iKiller) + get_pcvar_num(g_SupermanMoney))
format(sMsg, MAX_TEXT_LENGTH, "因 %s 第一个杀人!^n奖励 $%i ", sName, get_pcvar_num(g_SupermanMoney))
client_print(0, print_chat, "比分落后一方的壮士 %s 第一个杀人! 奖励 $%i (领先一方不适用)", sName, get_pcvar_num(g_SupermanMoney))
display_msg(sMsg, random_num(0,255), random_num(0,255), random_num(0,255))
}
if ( (cs_get_user_team(iVictim) == ctLosingTeam) && (iKiller != iVictim) && (g_BonusCount2 < 1) && (cs_get_user_team(iKiller) != cs_get_user_team(iVictim)) )
{
g_BonusCount2++
cs_set_user_money(iVictim, cs_get_user_money(iVictim) + get_pcvar_num(g_HeroMoney))
format(sMsg2, MAX_TEXT_LENGTH, "因 %s 第一个冲锋!^n奖励 $%i ", sName2, get_pcvar_num(g_HeroMoney))
client_print(0, print_chat, "比分落后一方的英雄 %s 第一个冲锋战死! 奖励 $%i (领先一方不适用)", sName2, get_pcvar_num(g_HeroMoney))
display_msg2(sMsg2, random_num(0,255), random_num(0,255), random_num(0,255))
}
return PLUGIN_CONTINUE
}
public event_round_end()
{
g_BonusCount = 0
g_BonusCount2 = 0
}
public display_msg(msg[], r, g, b)
{
set_hudmessage(r, g, b, -1.0, 0.70, 2, 0.3, 6.0, 0.03, 2.0, 153)
show_hudmessage(0, msg)
}
public display_msg2(msg[], r, g, b)
{
set_hudmessage(r, g, b, -1.0, 0.80, 2, 0.3, 6.0, 0.03, 2.0, 154)
show_hudmessage(0, msg)
} |
|