宇洋的前3名杀人奖励插件有问题
/** knifekillaward 1 是否开启刀杀奖励
* knifekillmoney 10000 刀杀奖励多少钱
* killmoney 1000 死后小于多少钱才补钱设为0则关闭
* amx_bonuskill 1 是否开启前三人杀人奖励
* gBonusIndex 前三人杀人奖励金额
*/
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <unlimited_money>
#define MAX_NAME_LENGTH 32
#define MAX_TEXT_LENGTH 256
new bool:gRoundStart
new gBonusCount = 0
new gBonusIndex = { 1000,500,300 }
new SayText
public plugin_init() {
register_plugin("Money Bonus","1.0","alt")
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")
register_cvar("knifekillaward","1")
register_cvar("knifekillmoney","10000")
register_cvar("killmoney","1000")
register_cvar("amx_bonuskill","1")
SayText = get_user_msgid("SayText")
}
public event_death() {
new iKiller = read_data(1)
new iVictim = read_data(2)
if(get_user_flags(iKiller)&ADMIN_ALL)
{
new wpn
read_data(4,wpn,31)
if (get_cvar_num("amx_bonuskill") == 1 && gRoundStart)
{
new message
new sName
get_user_name(iKiller,sName,MAX_NAME_LENGTH)
if ((iKiller != iVictim) && (gBonusCount < sizeof gBonusIndex) && (get_user_team(iKiller) != get_user_team(iVictim)))
{
gBonusCount++
cs_set_user_money2(iKiller,cs_get_user_money2(iKiller)+gBonusIndex,1)
if (gBonusCount == 1)
{
format(message, 255, "^x01* [^x04第1杀人奖励^x01] ^x03%s ^x01得到金钱 $%i",sName,gBonusIndex)
message_begin(MSG_ALL,SayText)
write_byte(iKiller)
write_string(message)
message_end()
// format(message,MAX_TEXT_LENGTH,"%s 第1个杀人奖励 $%i",sName,gBonusIndex)
// set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.25, 0, 6.0, 10.0, 0.0, 0.0, 1)
}
else if (gBonusCount == 2)
{
format(message, 255, "^x01* [^x04第2杀人奖励^x01] ^x03%s ^x01得到金钱 $%i",sName,gBonusIndex)
message_begin(MSG_ALL,SayText)
write_byte(iKiller)
write_string(message)
message_end()
// format(message,MAX_TEXT_LENGTH,"%s 第2个杀人奖励 $%i",sName,gBonusIndex)
// set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.30, 0, 6.0, 10.0, 0.0, 0.0, 2)
}
else
{
format(message, 255, "^x01* [^x04第%i杀人奖励^x01] ^x03%s ^x01得到金钱 $%i",gBonusCount,sName,gBonusIndex)
message_begin(MSG_ALL,SayText)
write_byte(iKiller)
write_string(message)
message_end()
// format(message,MAX_TEXT_LENGTH,"%s 第%i个杀人奖励 $%i",sName,gBonusCount,gBonusIndex)
// set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.35, 0, 6.0, 10.0, 0.0, 0.0, 3)
}
// show_hudmessage(0,message)
}
}
if ( !iKiller || iKiller==iVictim || get_user_team(iKiller)==get_user_team(iVictim))
{
return PLUGIN_CONTINUE
}
else
{
if (iKiller)
{
if (equal(wpn,"knife"))
{
if (get_cvar_num("knifekillaward") == 1)
{
new killer_name,id_name
new award = get_cvar_num("knifekillmoney")
new oldmoney = cs_get_user_money2(iKiller)
get_user_name(iKiller,killer_name,31)
get_user_name(iVictim,id_name,31)
new newmoney
newmoney = oldmoney + award
cs_set_user_money2(iKiller, newmoney, 1)
client_print(0,print_chat,"* %s 用小刀杀死 %s 得到奖励 $%d",killer_name,id_name,award)
client_print(0,print_console,"* %s 用小刀杀死 %s 得到奖励 $%d",killer_name,id_name,award)
}
}
}
}
}
if(get_user_flags(iVictim)&ADMIN_ALL)
{
if(is_user_connected(iVictim))
{
new message
new amoney = get_cvar_num("killmoney")
new pmoney = cs_get_user_money2(iVictim)
if( pmoney < amoney )
{
cs_set_user_money2( iVictim, amoney, 1);
format(message, 255, "^x01* [^x04提示^x01] 你的金钱增加到%d元.",amoney)
message_begin(MSG_ONE,SayText,{0,0,0},iVictim)
write_byte(iVictim)
write_string(message)
message_end()
}
}
}
return PLUGIN_CONTINUE
}
public event_round_end() {
gRoundStart = false
gBonusCount = 0
}
public round_start() {
gRoundStart = true
}此插件需要无限金钱插件支持,也安装了,但没作用.不知为何.
页:
[1]