搜索
查看: 3542|回复: 6

[AMXX 带源码] [AMXX]前五名杀敌奖励源代码

[复制链接]
发表于 2009-5-12 03:11:53 | 显示全部楼层 |阅读模式 来自 中国–广东–潮州
保存源代码后在相应的AMXX中的scripting目录中进行编译就可以正常运行了,至于奖励的多少大家也可以自行在源代码中进行修改。默认的是5000、4000、3000、2000、1000


/*
*   AMXMOD script.
*   (plugin_bonus1.sma)
*   by DreamZSW <DreamZSW@hotmail.com>
*   This file is provided as is (no warranties).
*
*/
#include <amxmod>
#define MAX_NAME_LENGTH 32
#define MAX_TEXT_LENGTH 512
#define ACCESS_LEVEL ADMIN_LEVEL_A
// Default on/off
new gBonusMode = 1
new gBonusCount = 0
new gBonusIndex[5] = { 5000,4000,3000,2000,1000 }
public admin_bonuskill(id)
{
// Check access level
if (!(get_user_flags(id)&ACCESS_LEVEL)) {
  console_print(id,"[AMX] You have no access to that command")
  return PLUGIN_HANDLED
}
// Check arguments
if (read_argc() < 2) {
  console_print(id,"[AMX] Usage: amx_bonuskill < 1 | 0 >")
  return PLUGIN_HANDLED
}
new sArg1[MAX_NAME_LENGTH]
read_argv(1,sArg1,MAX_NAME_LENGTH)

if (str_to_num(sArg1)) {
  gBonusMode = 1
  client_print(id,print_console,"[AMX] Bonus money for kills is now ON.")
}
else {
  gBonusMode = 0
  client_print(id,print_console,"[AMX] Bonus money for kills is now OFF.")
}

return PLUGIN_HANDLED
}
public event_death()
{
if (gBonusMode) {
  new iKiller = read_data(1)
  new iVictim = read_data(2)
  new sMsg[MAX_TEXT_LENGTH]
  new sName[MAX_NAME_LENGTH]
  get_user_name(iKiller,sName,MAX_NAME_LENGTH)
  
  if ((iKiller != iVictim) && (gBonusCount < sizeof gBonusIndex) && (get_user_team(iKiller) != get_user_team(iVictim))) {
   gBonusCount++
   set_user_money(iKiller,get_user_money(iKiller)+gBonusIndex[gBonusCount-1])
   if (gBonusCount == 1) {
    format(sMsg,MAX_TEXT_LENGTH,"%s first blood^n================^nget money +$%i",sName,gBonusIndex[gBonusCount-1])
    client_cmd(0, "spk misc/coin01")
    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.25, 0, 6.0, 6.0, 0.5, 0.15, 3)
   }
   else if (gBonusCount == 2) {
    format(sMsg,MAX_TEXT_LENGTH,"%s got the 2nd kill! Awarded (+$%i money)",sName,gBonusIndex[gBonusCount-1])
    client_cmd(0, "spk misc/coin01")
    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.26, 0, 6.0, 6.0, 0.5, 0.15, 3)
   }
   else if (gBonusCount == 3) {
    format(sMsg,MAX_TEXT_LENGTH,"%s got the 3rd kill! Awarded (+$%i money)",sName,gBonusIndex[gBonusCount-1])
    client_cmd(0, "spk misc/coin01")
    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.27, 0, 6.0, 6.0, 0.5, 0.15, 3)
   }
   else if (gBonusCount == 4) {
    format(sMsg,MAX_TEXT_LENGTH,"%s got the 4rd kill! Awarded (+$%i money)",sName,gBonusIndex[gBonusCount-1])
    client_cmd(0, "spk misc/coin01")
    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.28, 0, 6.0, 6.0, 0.5, 0.15, 3)
   }
   else {
    format(sMsg,MAX_TEXT_LENGTH,"%s got the %ith kill! Awarded (+$%i money)",sName,gBonusCount,gBonusIndex[gBonusCount-1])
    client_cmd(0, "spk misc/coin01")
    set_hudmessage(random_num(0,255), random_num(0,255), random_num(0,255), 0.02, 0.29, 0, 6.0, 6.0, 0.5, 0.15, 3)
   }
   show_hudmessage(0,sMsg)
  }
}
return PLUGIN_CONTINUE
}
public event_round_end() {
gBonusCount = 0
}
public plugin_precache(){
precache_sound( "misc/coin01.wav")
return PLUGIN_CONTINUE
}
/************************************************************
* PLUGIN FUNCTIONS
************************************************************/
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_concmd("amx_bonuskill","admin_bonuskill",ACCESS_LEVEL,"amx_powers < authid | part of nick >")
}
发表于 2009-5-12 10:00:39 | 显示全部楼层 来自 中国–广西–柳州
好插件啊,支持你一下。
回复

使用道具 举报

发表于 2009-5-12 11:22:52 | 显示全部楼层 来自 中国–安徽–合肥
什么啊??1.5的???
public event_death()
{
    if (gBonusMode && gRoundStart) {
       new iKiller = read_data(1)
       new iVictim = read_data(2)
       new sMsg[MAX_TEXT_LENGTH]
       new sName[MAX_NAME_LENGTH]
       get_user_name(iKiller,sName,MAX_NAME_LENGTH)
      
       if ((iKiller != iVictim) && (gBonusCount < sizeof gBonusIndex) && (get_user_team(iKiller) != get_user_team(iVictim))) {
          gBonusCount++
          set_user_money(iKiller,get_user_money(iKiller)+gBonusIndex[gBonusCount-1])

          if (gBonusCount == 1) {
             format(sMsg,MAX_TEXT_LENGTH,"%s 第1个杀人! 奖励$%i ",sName,gBonusIndex[gBonusCount-1])
             format(_tmpStr, 255, "%s 第1个杀人!获得$%i奖励",sName,gBonusIndex[gBonusCount-1])
             set_hudmessage(0,255,0,-1.58,0.18,0,6.0,6.0,0.5,0.5,158)
             _showChatGreenMsg(iKiller, _tmpStr)
    }
          else if (gBonusCount == 2) {
             format(sMsg,MAX_TEXT_LENGTH,"%s 第2个杀人! 奖励$%i ",sName,gBonusIndex[gBonusCount-1])
             format(_tmpStr, 255, "%s 第2个杀人!获得$%i奖励",sName,gBonusIndex[gBonusCount-1])
             set_hudmessage(255, 0, 255,-1.58,0.26,0,6.0,6.0,0.5,0.5,157)
             _showChatGreenMsg(iKiller, _tmpStr)
           }
          else if (gBonusCount == 3) {
             format(sMsg,MAX_TEXT_LENGTH,"%s 第3个杀人! 奖励$%i ",sName,gBonusIndex[gBonusCount-1])
             format(_tmpStr, 255, "%s 第3个杀人!获得$%i奖励",sName,gBonusIndex[gBonusCount-1])
             set_hudmessage(255, 242, 0,-1.58,0.34,0,6.0,6.0,0.5,0.5,156)
             _showChatGreenMsg(iKiller, _tmpStr)
           }   
          else {
             format(sMsg,MAX_TEXT_LENGTH,"%s 第%i个杀人! 奖励$%i ",sName,gBonusCount,gBonusIndex[gBonusCount-1])
             format(_tmpStr, 255, "%s 第%i个杀人!获得$%i奖励",sName,gBonusCount,gBonusIndex[gBonusCount-1])
             set_hudmessage(0,100,255,-1.58,0.42,0,6.0,6.0,0.5,0.5,150)
             _showChatGreenMsg(iKiller, _tmpStr)
           }
          //display_msg(sMsg,200,200,200)
          show_hudmessage(0,sMsg)
       }
    }
    return PLUGIN_CONTINUE
}

public event_round_end() {
    gRoundStart = false
    gBonusCount = 0
}
public round_start() { //增加行
gRoundStart = true //增加行
} //增加行

//public display_msg(msg[],r,g,b)
//{
    //set_hudmessage(r,g,b,-1.0,0.40,0,6.0,6.0,0.5,0.15,2)
    //set_hudmessage(random_num(0,255),random_num(0,255),random_num(0,255),-1.0,0.80,2,0.3,6.0,0.03,2.0,153)
    //show_hudmessage(0,msg)
//}

// 显示(Green)颜色的聊天信息
public _showChatGreenMsg(id, msg[256]) {
format(msg, 255, "^x01^x04%s^x01", msg)
new g_msgSayText = get_user_msgid("SayText")
message_begin(MSG_ALL,g_msgSayText, {0,0,0}, id)
write_byte(id)
write_string(msg)
message_end()
}
回复

使用道具 举报

发表于 2009-10-16 17:16:13 | 显示全部楼层 来自 中国–河北–石家庄
谢谢楼主提供源码,我已经改成第一个杀人奖励了。
回复

使用道具 举报

发表于 2010-10-15 15:12:51 | 显示全部楼层 来自 中国–上海–上海
1.5???1.6可用否??
回复

使用道具 举报

发表于 2010-10-18 23:33:29 | 显示全部楼层 来自 中国–广东–云浮
好插件啊,支持你一下。
回复

使用道具 举报

发表于 2010-10-20 13:51:40 | 显示全部楼层 来自 中国–广东–云浮
还不错,支持下~~
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表