|
发表于 2007-12-28 06:44:08
|
显示全部楼层
|阅读模式
来自 中国–甘肃–兰州
领军人物插件(team_leader.amxx)由管理员特殊服装插件(amx_adminmodel.amxx)和双方排名第一的玩家身体发光插件(leader_glow.amxx)糅合而成,插件的功能如下:
所谓领军人物,指的是交战双方中战绩最好,在各自阵营中排名第一的两个玩家,包括CT方的一个领军人物和T方的一个领军人物.既然身为领军人物,那么当然就有他们的过人之处!
1. 双方的领军人物均可获得一个特殊的皮肤模型.(CT变身vip模型,T变身rabbit[兔子]模型)
2. 每一局开始时可获得200生命值和200盔甲值.
3. 并且每一局开始时均能获得16000$的全额奖金.
这个插件可以在一定程度上削弱OP的权力,旨在鼓励玩家英勇杀敌,争当第一!只要能杀到第一位,任何玩家都可以获得上面的三大特权!呵呵~ 到时候估计连管理员都无法撼动你的地位,只能干瞪眼咯!那么,就让普通玩家也过一把OP瘾吧!
插件代码编完以后,编译成功,可以在服务器运行.不过还是发现了两个BUG:
A. 玩家一旦成为领军人物,将获得特殊的人物皮肤,这个皮肤一旦给予了玩家,那么他将一直保持着,就算你已经不再是领军人物了,却依然会穿着这身特殊的衣服!所以,我想问一下,当玩家不再是领军人物时,如何让他恢复正常的皮肤模型呢?
B. 同时,控制台也出现了一些debug信息:L 12/28/2007 - 03:46:24: [FUN] Player out of range (-1)
L 12/28/2007 - 03:46:24: [AMXX] Displaying debug trace (plugin "team_leader.amxx")
L 12/28/2007 - 03:46:24: [AMXX] Run time error 10: native error (native "set_user_health")
L 12/28/2007 - 03:46:24: [AMXX] [0] team_leader.sma:: resetModel (line 94)
L 12/28/2007 - 03:46:25: [FUN] Player out of range (-1)
L 12/28/2007 - 03:46:25: [AMXX] Displaying debug trace (plugin "team_leader.amxx")
L 12/28/2007 - 03:46:25: [AMXX] Run time error 10: native error (native "set_user_health")
L 12/28/2007 - 03:46:25: [AMXX] [0] team_leader.sma:: resetModel (line 94) 对于问题B,我一点办法也没有;对于问题A,我试过在插件源代码的最下面添加以下代码:{
else
{
cs_reset_user_model()
}
return PLUGIN_CONTINUE;
} 但添加上面的代码之后插件就编译不了了~ 希望高手能帮一下忙.
[php]#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
/* Keep Track of Player ID for Lead Player on each Team */
new g_Lead_CT = -1
new g_Lead_T = -1
/*
*********************************************************
* Find the lead player for each team and make them glow *
*********************************************************
*/
public plugin_init()
{
register_plugin("Team Leader", "1.0", "X-man");
register_event("ResetHUD", "resetModel", "b");
return PLUGIN_CONTINUE;
}
public plugin_precache() {
precache_model("models/player/vip/vip.mdl")
precache_model("models/player/rabbit/rabbit.mdl")
return PLUGIN_CONTINUE
}
public resetModel() {
/* Skip the glowing if there's only two people playing */
new i_numplayers = get_playersnum(0); /* get number of alive players */
if (i_numplayers < 2) return
i_numplayers = get_playersnum(1); /* get total number of players, including ones connecting */
/* Figure out who the Lead Player is for each team */
new i_Lead_CT_frags = -100
new i_Lead_T_frags = -100
new i_Lead_CT_deaths = -100
new i_Lead_T_deaths = -100
new s_team[3]
new i_frags
new i_deaths
g_Lead_CT = -1
g_Lead_T = -1
for (new i_player = 0; i_player < i_numplayers; i_player++) {
i_frags = get_user_frags(i_player)
i_deaths = get_user_deaths(i_player)
get_user_team(i_player, s_team, 3)
/* is player Lead CT? */
if (equali(s_team,"CT",2))
if ((i_frags > i_Lead_CT_frags) ||
((i_frags == i_Lead_CT_frags) && (i_deaths < i_Lead_CT_deaths))) {
i_Lead_CT_frags = i_frags
i_Lead_CT_deaths = i_deaths
g_Lead_CT = i_player
}
/* is player Lead Terrorist? */
if (equali(s_team,"TE",2))
if ((i_frags > i_Lead_T_frags) ||
((i_frags == i_Lead_T_frags) && (i_deaths < i_Lead_T_deaths))) {
i_Lead_T_frags = i_frags
i_Lead_T_deaths = i_deaths
g_Lead_T = i_player
}
}
/* 分别给予双方的领军人物一个特殊的皮肤模型,200生命值和200盔甲值,并且每一局开始时自动获得16000$的全额资金 */
if (g_Lead_CT != -1)
cs_set_user_model(g_Lead_CT,"vip")
set_user_health(g_Lead_CT,200)
set_user_armor(g_Lead_CT,200)
cs_set_user_money(g_Lead_CT,16000)
if (g_Lead_T != -1)
cs_set_user_model(g_Lead_T,"rabbit")
set_user_health(g_Lead_T,200)
set_user_armor(g_Lead_T,200)
cs_set_user_money(g_Lead_T,16000)
}[/php] |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注个册吧
×
|