求助:领军人物插件(随机版)的问题
其实之前也做过一个领军人物插件(team_leader.amxx)。所谓领军人物,指的是交战双方中战绩最好,在各自阵营中排名第一的两个玩家,包括CT方的一个领军人物和T方的一个领军人物。既然身为领军人物,那么当然就有他们的过人之处!1. 双方的领军人物均可获得一个VIP的皮肤模型;
2. 每一局开始时可获得200生命值和200盔甲值;
3. 并且每一局开始时均能获得16000$的全额奖金。
不过用了一段时间之后觉得不是很公平,因为如果每次都是第一名的玩家获得上面的特权的话,那么只会让强者越强,弱者越弱,对其他的玩家不公平。因此,今天我又修改了一下插件:每局开始时,都会分别从双方的队伍里随机选择一个玩家(即CT方会随机选一个玩家,T方也会随机选择一个玩家,一共两人),让其成为领军人物,并且获得上面的三大特权。这样一来,那么人人都有份,就比较公平了。
插件(team_leader_random.amxx)是编好了,可以正常运行,不过发现了两个问题:
1. 控制台会出现以下的debug信息:
L 03/11/2008 - 16:25:36: Player out of range (0)
L 03/11/2008 - 16:25:36: Displaying debug trace (plugin "team_leader_random.amxx")
L 03/11/2008 - 16:25:36: Run time error 10: native error (native "set_user_health")
L 03/11/2008 - 16:25:36: team_leader_random.sma::new_round (line 28)
2. 不知道是怎么回事,前一局的领军人物在下一局居然还是穿着那件vip的衣服,尽管这时他已经不是真正的Leader了。有什么办法能让已经不是领军人物的玩家脱下vip服装,恢复正常的皮肤呢?
#include <amxmodx>
#include <cstrike>
#include <fun>
new g_mark
public plugin_init() {
register_plugin("Random Team Leader","1.0","X-man")
register_logevent("new_round",2,"0=World triggered","1=Round_Start")
register_event("DeathMsg","eDeathMsg","a")
}
public plugin_precache() {
precache_model("models/player/vip/vip.mdl")
precache_model("models/player/vip/vip.mdl")
return PLUGIN_CONTINUE
}
public new_round() {
// 分别给予双方的领军人物一个特殊的皮肤模型,200生命值和200盔甲值,并且每一局开始时自动获得16000$的全额资金
new players, numplayers
get_players( players, numplayers,"ae","CT" )
g_mark = players[ random_num(0, numplayers-1) ]
set_user_health(g_mark,200)
set_user_armor(g_mark,200)
cs_set_user_money(g_mark,16000)
cs_set_user_model(g_mark,"vip")
get_players( players, numplayers,"ae","TERRORIST" )
g_mark = players[ random_num(0, numplayers-1) ]
set_user_health(g_mark,200)
set_user_armor(g_mark,200)
cs_set_user_money(g_mark,16000)
cs_set_user_model(g_mark,"vip")
}
// 让领军人物阵亡后恢复原来的皮肤模型
public eDeathMsg()
{
new victim=read_data(2);
if(is_user_connected(victim))
cs_reset_user_model(victim);
}
public client_death(killer, victim, wpnindex, hitplace, TK)
{
if(wpnindex == CSW_C4 && is_user_connected(victim))
cs_reset_user_model(victim);
}
回复: 求助:领军人物插件(随机版)的问题
#include <amxmodx>
#include <cstrike>
#include <engine>
public plugin_init()
{
register_plugin("Random Team Leader","1.0","X-man")
register_logevent("new_round",2,"0=World triggered","1=Round_Start")
}
public new_round()
{
if(get_playersnum() <= 2)
return
new id, players, num
get_players(players, num, "ae", "CT")
id = num == 1 ? players : players
become_a_leader(id, 0, 0, 255)
get_players(players, num, "ae", "TERRORIST")
id = num == 1 ? players : players
become_a_leader(id, 255, 0, 0)
}
public become_a_leader(id, r, g, b)
{
entity_set_float(id, EV_FL_health, 200.0)
cs_set_user_armor(id, 200, CS_ARMOR_VESTHELM)
cs_set_user_money(id, 16000)
set_rendering(id, kRenderFxGlowShell, r, g, b, kRenderNormal, 20)
}
没测试过,这个是让领队身体发光的,t发红,ct发蓝,你测试一下吧。
回复: 求助:领军人物插件(随机版)的问题
大哥啊,我只希望你能帮我解决上面的那两个BUG,你怎么把我添加的VIP服装也弄没了?:cry:回复: 求助:领军人物插件(随机版)的问题
public become_a_leader(id, r, g, b){
entity_set_float(id, EV_FL_health, 200.0)
cs_set_user_armor(id, 200, CS_ARMOR_VESTHELM)
cs_set_user_money(id, 16000)
cs_set_user_model(id,"vip")
set_rendering(id, kRenderFxGlowShell, r, g, b, kRenderNormal, 20)
}
是不是这样。。:rolleyes:
回复: 求助:领军人物插件(随机版)的问题
#include <amxmodx>#include <cstrike>
#include <engine>
new g_t, g_ct
new CsInternalModel:g_t_model
new CsInternalModel:g_ct_model
public plugin_init()
{
register_plugin("Random Team Leader","1.0","X-man")
register_logevent("new_round",2,"0=World triggered","1=Round_Start")
register_event("DeathMsg", "death", "a")
}
public new_round()
{
if(get_playersnum() <= 2)
return
new id, players, num
get_players(players, num, "ae", "CT")
g_ct = num == 1 ? players : players
cs_set_user_team(g_ct, cs_get_user_team(id, g_ct_model), CS_CT_VIP)
become_a_leader(g_ct, team, 0, 0, 255)
get_players(players, num, "ae", "TERRORIST")
g_t = num == 1 ? players : players
cs_set_user_team(g_t, cs_get_user_team(id, g_t_model), CS_CT_VIP)
become_a_leader(g_t, 255, 0, 0)
}
public become_a_leader(id, r, g, b)
{
entity_set_float(id, EV_FL_health, 200.0)
cs_set_user_armor(id, 200, CS_ARMOR_VESTHELM)
cs_set_user_money(id, 16000)
set_rendering(id, kRenderFxGlowShell, r, g, b, kRenderNormal, 20)
}
public death()
{
new id = read_data(2)
switch(id)
{
case: g_ct: cs_set_user_team(id, CS_TEAM_CT, g_ct_model)
case: g_t: cs_set_user_team(id, CS_TEAM_T, g_t_model)
}
}
试试这个吧,我好长时间没写代码了,当初好多试验结果都忘了,印象中可以
回复: 求助:领军人物插件(随机版)的问题
重申一遍,我希望高手能遵照我发的那个代码,不要再改动了,只要能帮我把那两个BUG解决掉就好了。:burn: 如果你希望下一局开始的时候将上一局是第一而这一局不再是第一的人的皮肤改回去的话,我想应该再加一段代码:public EventEndRound(){
new nums, players;
get_players(players, nums);
for(new i = 0; i < nums; i++)
{
cs_reset_user_model(players)
}
}当然,在public plugin_init()中需要注册 register_logevent("EventEndRound", 2, "0=World triggered", "1=Round_Draw", "1=Round_End")
关于你的插件报错,说第28行有问题,但是我不想自己数28行是哪一行,所以帮不上忙 很麻烦! 额.确实是很麻烦. 什么领军 不领军的,直接 用 guartian不就完了仿战争机器2翻译 做 母体模式 母体 多 血 多甲 母体不死 ,其他人 复活自动
页:
[1]