|
#include <amxmodx>
#include <csx>
new g_KillSum[33] //连续杀人数量记录
new g_HeatshotSum[33] //爆头记录
new Float:g_Time[33][5] //保存杀人开始,结束时间
new gg_HeatshotSum[33][33]
native cs_get_user_money2(index)
native cs_set_user_money2(index, money, flash=1)
public plugin_init(){
register_plugin("连杀奖励","1.0", "3344")
register_event("DeathMsg","eDeathMsg","a")
register_cvar("RewardConsecutive","34000")//连杀基数
}
//连杀插入**********************************************************************
public eDeathMsg(){
new killer,victim,wpnname[4]
read_data(4 , wpnname , 3)
if(equal(wpnname,"c4")) return
killer=read_data(1)
if(!killer) return
victim=read_data(2)
if(get_user_team(killer)==get_user_team(victim)) return
if(killer == victim) return
if(get_cvar_num("RewardConsecutive") > 0){
new Float:TimeNow = get_gametime()
new param[1]
param[0] = killer
g_KillSum[killer]++
g_HeatshotSum[killer] += read_data(3)
g_Time[killer][4] = TimeNow
if(g_KillSum[killer]==1){
g_Time[killer][1] = TimeNow
gg_HeatshotSum[killer][1] = read_data(3)
}
if(g_KillSum[killer]==2){
g_Time[killer][2] = TimeNow
gg_HeatshotSum[killer][2] = read_data(3)
}
if (g_KillSum[killer]==3){
g_Time[killer][3] = TimeNow
gg_HeatshotSum[killer][3] = read_data(3)
if(floatround(g_Time[killer][3] - g_Time[killer][1])<=8)
set_task(8.0 + g_Time[killer][1] - g_Time[killer][3], "TimeEnd", 3344+killer, param, 1)
else{
g_KillSum[killer]--
g_HeatshotSum[killer]-=gg_HeatshotSum[killer][1]
g_Time[killer][1] = g_Time[killer][2]
g_Time[killer][2] = g_Time[killer][3]
gg_HeatshotSum[killer][1] = gg_HeatshotSum[killer][2]
gg_HeatshotSum[killer][2] = gg_HeatshotSum[killer][3]
}
}
}
}
//******************************************************************************
public TimeEnd(param[]){
new id = param[0]
new time_total = floatround(g_Time[id][4] - g_Time[id][1])
if (time_total<=0)
time_total = 1
new Rewardmoney=(g_HeatshotSum[id]+g_KillSum[id])*get_cvar_num("RewardConsecutive")/time_total
cs_set_user_money2(id,cs_get_user_money2(id)+Rewardmoney)
new name[32], Cmsg[128]
get_user_name(id, name, 31)
format(Cmsg,sizeof Cmsg - 1,"!G『!T连杀奖!G』!T%s!W在!T%d!W秒内,连挂!T%d!W敌,!T%d!W爆头.!G奖励金钱!T%d",name,time_total,g_KillSum[id],g_HeatshotSum[id],Rewardmoney)
client_color(0, id, Cmsg)
set_hudmessage(100, 100, 255, 0.7, 0.25, 0, 6.0, 4.0, 0.5, 0.15, 3)
show_hudmessage(0,"%s^n在%d秒内,连杀%d敌(%d爆头)^n奖励%d",name,time_total,g_KillSum[id],g_HeatshotSum[id],Rewardmoney)
g_KillSum[id] = 0
g_HeatshotSum[id] = 0
}
public client_disconnect(id){
if(task_exists(3344+id))
remove_task(3344+id)
g_KillSum[id] = 0
g_HeatshotSum[id] = 0
}
public client_color(playerid, colorid, msg[]){
while(replace(msg,127,"!W","^x01")){}
while(replace(msg,127,"0x02","^x02")){}
while(replace(msg,127,"!T","^x03")){}
while(replace(msg,127,"!G","^x04")){}
message_begin(playerid?MSG_ONE:MSG_ALL,get_user_msgid("SayText"),_,playerid)
write_byte(colorid)
write_string(msg)
message_end()
client_print(playerid, print_console,msg)
} |
|