|
发表于 2006-9-7 15:20:17
|
显示全部楼层
|阅读模式
来自 中国–广东–深圳–罗湖区
[php]
/****************************************
* (带语音)连续杀敌奖励 *
****************************************
* amxmodx插件 amxmodx 1.71,1.75 测试通过
* 每次间隔5秒,连续杀人超过3个执行奖励
* 带语音:例如当 5 秒 连续杀 3 人时,播放语音 “ three kill in five seconds ”
*
* 奖励=(爆头数 * 2000 + (杀人数 - 爆头数) * 1000) * 杀人数 / 时间总和
*
* 来源: http://cs-friends.com.cn
* 作者:iG_os ,version 0.3.16 2006-6-12
*/
#define PLUGIN "Consecutive Killer"
#define VERSION "0.3.16"
#define AUTHOR "iG_os"
#include <amxmodx>
#include <cstrike>
new g_KillSum[33] //连续杀人数量记录
new g_HeatshotSum[33] //爆头记录
new Float:g_Time[33][2] //保存杀人开始,结束时间
public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
register_event("DeathMsg","DeathEven","a")
}
public DeathEven()
{
new victimId = read_data(2) //被杀者
//ID死亡,结束已经开始计时的连杀计数//
if (task_exists(2006+victimId)){
remove_task(2006+victimId)
new param[1]
param[0] = victimId
TimeEnd(param)
}
new killerId = read_data(1) //杀人者
if (!killerId || killerId==victimId)
return PLUGIN_CONTINUE //排除自杀
if (get_user_team(killerId)==get_user_team(victimId))
return PLUGIN_CONTINUE //排除队友伤害
g_HeatshotSum[killerId] += read_data(3) //爆头记录
if (task_exists(2006+killerId))
remove_task(2006+killerId)
Killer_Count(killerId)
return PLUGIN_CONTINUE
}
//杀人计数,计时
public Killer_Count(id)
{
//执行保存时间,数量.//
new Float:TimeNow = get_gametime()
if (g_KillSum[id]<=0){
g_Time[id][0] = TimeNow
g_Time[id][1] = TimeNow
}
else g_Time[id][1] = TimeNow
g_KillSum[id]++ //杀人数加1//
new param[1]
param[0] = id
set_task(5.0, "TimeEnd", 2006+id, param, 1) //设定间隔时间5s//
}
//计时结束,执行显示数据//
public TimeEnd(param[])
{
new id = param[0]
if (g_KillSum[id]>2) //连续杀人超过3个才执行奖励
{
//计算时间//
new time_total = floatround(g_Time[id][1] - g_Time[id][0])
if (time_total<1) //预防time_total小于0
time_total = 1
new headshot = g_HeatshotSum[id]
//计算奖励//
new Rewardmoney = ( headshot * 2000 + (g_KillSum[id]-headshot) * 1000 ) * g_KillSum[id] / time_total
//玩家加钱//
cs_set_user_money(id,cs_get_user_money(id)+Rewardmoney,1)
//转换语音格式//
new temp_sec[3], H_sec[] = "00"
new w_killSUM[11],w_second1[11],w_second2[11]
num_to_str(time_total,temp_sec,2)
if (time_total>20){
H_sec[0] = temp_sec[0]
num_to_word(str_to_num(H_sec),w_second1,10)
if (temp_sec[1]!='0')
num_to_word(str_to_num(temp_sec[1]),w_second2,10)
}
else
num_to_word(time_total, w_second2, 10)
num_to_word(g_KillSum[id], w_killSUM, 10)
//播放语音//
client_cmd(0, "spk ^"vox/woop %s kill in %s %s seconds^"", w_killSUM, w_second1, w_second2)
//显示文字//
new name[32]
get_user_name(id, name, 31)
set_hudmessage( 0, 80, 220, 0.20, 0.12, 0, 3.0, 10.0, 0.1, 0.2, 4 )
show_hudmessage(0,"%s 在 %d 秒钟内^n连续杀敌 %d 人,爆头 %d 次,奖励 $%d",name,time_total,g_KillSum[id],headshot,Rewardmoney)
}
client_connected(id)
}
//数据初始化//
public client_connected(id)
{
g_KillSum[id] = 0
g_HeatshotSum[id] = 0
g_Time[id][0] = 0.0
g_Time[id][1] = 0.0
return PLUGIN_CONTINUE
}
public client_disconnect(id)
{
if (task_exists(2006+id))
remove_task(2006+id)
}
[/php] |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|