搜索
查看: 2398|回复: 8

[AMXX 无源码] 依连输场次补助现金

[复制链接]
发表于 2010-6-23 23:14:41 | 显示全部楼层 |阅读模式 来自 北京西城
按照连输的场次 , 给予一定的补助金 (0, 1000, 2500, 3500, 4500, 5500)

源码:

#include <amxmodx>
#include <cstrike>

#define AWARD_LEVELS 5
#define MAX_AWARD 9000

new const award[] = {0, 1000, 2500, 3500, 4500, 5500}
new score[] = {0, 0}
new scale = 0

public teamscore()
{
  new team[2]
  read_data(1,team,1)
  new curTeam = (team[0] == 'C') ? 0 : 1
  new curScore = read_data(2)

  if (curScore == score[curTeam])
    return PLUGIN_CONTINUE

  score[curTeam] = curScore

  // Keep a sliding scale of losses clamped to 7
  // Scale is positive when CT's are winning
  if (curTeam)
  {
    scale += 1
  } else
  {
    scale -= 1
  }
  scale = clamp(scale, 0-AWARD_LEVELS, AWARD_LEVELS)
  log_message("「平安夜公告」 當前按物價計酬法 %d.", scale)

  if (!get_cvar_num("extramoney"))
    return PLUGIN_CONTINUE
  
  // find the pot amount by converting the sliding scale to an index
  // in the award lookup table
  new pindex = scale
  if (!curTeam)
    pindex = 0-pindex

  new pot = award[clamp(pindex-1, 0, 5)]
  if (!pot)
    return PLUGIN_CONTINUE

  new players[32];
  new playerCount, i
  get_players(players, playerCount, "ce", curTeam ? "CT" : "TERRORIST")
  for (i=0;i < playerCount; i++)
  {
    new money = cs_get_user_money(players[i])
    new newmoney = max(clamp(money+pot, 0, MAX_AWARD), money) // Only give extra money up to 8000
    cs_set_user_money(players[i], newmoney, 1)
  }

  return PLUGIN_CONTINUE
}

public plugin_init()
{
  register_plugin("JETB", "0.5", "Janzert")
  register_cvar("extramoney", "1")
  register_event("TeamScore", "teamscore", "a");

  return PLUGIN_CONTINUE
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
 楼主| 发表于 2010-6-23 23:15:41 | 显示全部楼层 来自 北京西城
sofa~ No.1!{:3_53:}
回复

使用道具 举报

发表于 2010-6-24 00:49:38 | 显示全部楼层 来自 辽宁
好像有人发过了
回复

使用道具 举报

 楼主| 发表于 2010-6-24 01:55:19 | 显示全部楼层 来自 北京西城
好像有人发过了
baiduqq1314 发表于 2010-6-24 00:49



{:3_55:} 不是吧。。。。那我就再发点别的
回复

使用道具 举报

发表于 2010-6-24 12:46:58 | 显示全部楼层 来自 新疆乌鲁木齐
...郁闷的..
回复

使用道具 举报

发表于 2010-6-25 13:04:13 | 显示全部楼层 来自 广西钦州
“高...实在是高"      伪军司令与鬼子的对话
回复

使用道具 举报

发表于 2010-6-30 12:46:09 | 显示全部楼层 来自 广东惠州
嗯,好东西,收下了。
回复

使用道具 举报

发表于 2010-7-1 08:30:38 | 显示全部楼层 来自 北京昌平
这个插件真好呀
回复

使用道具 举报

发表于 2011-7-31 18:35:27 | 显示全部楼层 来自 浙江杭州
晕到!!!这插件怎么用!!!!!
回复

使用道具 举报

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

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