设为首页收藏本站新闻投稿

MOD中国同盟社

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 150|回复: 0

[求助] 编写插件问题 [复制链接]

Rank: 3Rank: 3

帖子
110
精华
0
声望
454 点
金币
71 Mold
被赞许
2 次
注册时间
2011-8-1
发表于 2013-8-2 16:11:13 |显示全部楼层
源码上~~~new xp[33]
new level[33]

// =============================================

new const rank[][] =
{
"平民",
"新兵",
"二等兵",
"下士",
"上士",
"少尉",
"上尉",
"少校",
"上校",
"少將",
"大将军"
}
new const xp_level[] = { 0, 50000, 100000, 200000, 400000, 750000, 1200000, 1600000, 2200000, 3000000, 4000000 }
new const health[] = { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 }  // 额外生命值
//new const gravity[] = { 1, 0.95, 0.90, 0.85, 0.80, 0.75, 0.70, 0.65, 0.60, 0.55, 0.50} //重力
// =============================================
public plugin_init()
{
register_plugin("Damage Money",VERSION,"GHW_Chronic")
register_event("Damage","Damage","b")
//register_event("RoundTime", "show_msg", "be")
register_event("DeathMsg", "eNewRound", "bc")
register_event("DeathMsg", "show_msg", "bc")
}
public Damage(id)
{
new weapon, hitpoint, attacker = get_user_attacker(id,weapon,hitpoint)
if(is_user_alive(attacker) && attacker!=id)
{
  xp[attacker] += read_data(2) // + get_pcvar_num(mpd)//击中一枪加经验
  if (xp[attacker] >= xp_level[level[attacker]+1])
   {
    level[attacker]++
    set_user_health(attacker, get_user_health(attacker)+health[level[attacker]])
    //set_user_gravity(attacker,get_user_gravity(attacker)+gravity[level[attacker]])
    set_hudmessage(50,100,0,0.1, 0.8, 1, 0.5, 9999.0, 0.5, 0.15, 3)
    show_hudmessage(attacker,"恭喜你晋升为【%s】额外生命值: %d^n等级: %d 经验值: %d / %d", rank[level[attacker]], health[level[attacker]], level[attacker], xp[attacker], xp_level[level[attacker]+1])
   }
}
}
public show_msg(id)
{
new killer = read_data(1)
new victim = read_data(2)

if ( !killer || killer==victim || get_user_team(killer)==get_user_team(victim) )
{
  return PLUGIN_CONTINUE
}
else
{
set_hudmessage(0,100,0,0.1, 0.8, 0, 3.0, 9999.0, 0.5, 0.15, 1);
show_hudmessage(id,"军衔:【%s】额外生命值: %d^n等级: %d 经验值: %d / %d", rank[level[id]], health[level[id]], level[id], xp[id], xp_level[level[id]+1])
set_user_health(id, get_user_health(id)+health[level[id]])
}
}
public eNewRound(id)
{
    set_hudmessage(0,100,0,0.1, 0.8, 0, 3.0, 9999.0, 0.5, 0.15, 1);
   show_hudmessage(id,"军衔:【%s】额外生命值: %d^n等级: %d 经验值: %d / %d", rank[level[id]], health[level[id]], level[id], xp[id], xp_level[level[id]+1])
}




为什么人物活着的时候不显示等级~~~

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

回顶部