|
发表于 2009-10-13 00:54:11
|
显示全部楼层
|阅读模式
来自 中国–湖北–武汉
这是个 杀敌前5人奖励插件
因看不懂其奖励方法 请高手指点
[php]
#include <amxmodx>
#include <cstrike>
#include <unlimited_money>
new bool:gRoundStart
new gBonusCount = 0
new rewards[20]={50,100,300,500,1000,3000,5000,8000,10000,15000,20000,25000,40000,50000,80000,100000,150000,200000,500000,900000}
public event_death(){
if (gRoundStart) {
new iKiller = read_data(1)
new iVictim = read_data(2)
if (!iKiller || iKiller==iVictim)
return PLUGIN_CONTINUE
if (get_user_team(iKiller)==get_user_team(iVictim))
return PLUGIN_CONTINUE
new sName[32]
get_user_name(iKiller,sName,31)
if ((iKiller != iVictim) && (gBonusCount < 5) && (get_user_team(iKiller) != get_user_team(iVictim))) {
gBonusCount++
new x = random_num(50, 10000)
cs_set_user_money2(iKiller,cs_get_user_money2(iKiller)+x)
new msg[512]
if (gBonusCount == 1) {
new amount = rewards[random(20)]
set_hudmessage(80,180,101,-1.0, 0.25, 0, 0.02, 6.0, 0.01, 0.1, -1)
show_hudmessage(0,"%s率先杀敌^n奖励%d金钱",sName,amount)
cs_set_user_money2(iKiller,cs_get_user_money2(iKiller)+amount)
client_cmd(0,"spk misc/coin01")
}
else if (gBonusCount == 2) {
format(msg,511,"^x03%s^x01 第 ^x04 2 ^x01个杀敌,奖励^x04 %d ^x01金钱",sName,x)
client_color(0,iKiller,msg)
}
else if (gBonusCount == 3) {
format(msg,511,"^x03%s^x01 第 ^x04 3 ^x01个杀敌,奖励^x04 %d ^x01金钱",sName,x)
client_color(0,iKiller,msg)
}
else if (gBonusCount == 4) {
format(msg,511,"^x03%s^x01 第 ^x04 4 ^x01个杀敌,奖励^x04 %d ^x01金钱",sName,x)
client_color(0,iKiller,msg)
}
else if (gBonusCount == 5) {
format(msg,511,"^x03%s^x01 第 ^x04 5 ^x01个杀敌,奖励^x04 %d ^x01金钱",sName,x)
client_color(0,iKiller,msg)
}
}
}
return PLUGIN_CONTINUE
}
public event_round_end(){
gRoundStart = false
gBonusCount = 0
}
public round_start(){
gRoundStart = true
}
public client_color(playerid, colorid, msg[]){
message_begin(playerid?MSG_ONE:MSG_ALL,get_user_msgid("SayText"),_,playerid)
write_byte(colorid)
write_string(msg)
message_end()
}
public plugin_precache(){
precache_sound( "misc/coin01.wav")
return PLUGIN_CONTINUE
}
public plugin_init(){
register_plugin("Plugin Money Bonus","1.0","DreamZSW")
register_event("DeathMsg","event_death","a")
register_event("SendAudio","event_round_end","a","2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
register_event("HLTV", "round_start", "a", "1=0", "2=0")
}
[/php] |
|