|
发表于 2008-3-12 11:51:41
|
显示全部楼层
来自 中国–北京–北京–海淀区
回复: 求助:领军人物插件(随机版)的问题
[PHP]#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[32], num
get_players(players, num, "ae", "CT")
g_ct = num == 1 ? players[0] : players[random_num(0, num - 1)]
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[0] : players[random_num(0, num - 1)]
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)
}
}[/PHP]
试试这个吧,我好长时间没写代码了,当初好多试验结果都忘了,印象中可以 |
|