求高手在插件上添加t权限
/** _______ _ ___ __
*| _____/ | | | | \ \ __ / /
*| | | | | || | /\ | |
*| | | |____| || |/ __ \| |
*| | ___ | ______ || /\ |
*| ||_|| | | ||/ \|
*| | | || | | || | | |
*| |____| || | | || | | |
*|_______/ |_| |_|\_/ \_/
*
*
*
*Last Edited: 12-31-07
*
*============
* Changelog:
*============
*
*v2.0
* -Added ML
*
*v1.0
* -Initial Release
*
*/
#define VERSION "2.0"
#include <amxmodx>
#include <amxmisc>
#include <chr_engine>
#define PET_NUM 7
static const pet_name =
{
"Headcrab",
"Rat",
"Bat",
"Frog",
"Floater",
"Cockroach",
"Hyper Bat"
}
static const pet_models =
{
"models/headcrab.mdl",
"models/bigrat.mdl",
"models/boid.mdl",
"models/chumtoad.mdl",
"models/floater.mdl",
"models/roach.mdl",
"models/stukabat.mdl"
}
static const pet_idle =
{
0,
1,
0,
0,
0,
1,
13
}
static const Float:pet_idle_speed =
{
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
0.5
}
static const pet_run =
{
4,
4,
0,
5,
0,
0,
13
}
static const Float:pet_run_speed =
{
2.0,
3.0,
3.0,
0.75,
1.0,
1.0,
13.0
}
static const pet_die =
{
7,
7,
0,
12,
0,
0,
5
}
static const Float:pet_die_length =
{
2.4,
2.4,
0.1,
3.0,
0.1,
0.1,
3.0
}
static const Float:pet_minus_z_standing =
{
36.0,
36.0,
5.0,
36.0,
5.0,
36.0,
10.0
}
static const Float:pet_minus_z_crouching =
{
16.0,
16.0,
6.0,
16.0,
6.0,
16.0,
11.0
}
new pet
new pettype
new maxplayers
public plugin_init()
{
register_plugin("GHW Pet Followers",VERSION,"GHW_Chronic")
register_clcmd("say","say_hook")
register_clcmd("say_team","say_hook")
register_event("DeathMsg","DeathMsg","a")
register_forward(FM_Think,"FM_Think_hook")
maxplayers = get_maxplayers()
register_dictionary("GHW_Pet_Followers.txt")
}
public plugin_precache()
{
for(new i=0;i<PET_NUM;i++) precache_model(pet_models)
}
public DeathMsg(id) handle_DeathMsg(read_data(2))
public handle_DeathMsg(id)
{
if(pet && pev_valid(pet))
{
set_pev(pet,pev_sequence,pet_die])
set_pev(pet,pev_gaitsequence,pet_die])
set_pev(pet,pev_framerate,1.0)
set_pev(pet,pev_nextthink,pet_die_length] + 1.0)
set_task(pet_die_length],"remove_pet",pet)
}
pet=0
}
public remove_pet(ent) if(pev_valid(ent)) engfunc(EngFunc_RemoveEntity,ent)
public say_hook(id)
{
new arg
read_argv(1,arg,31)
if(equali(arg,"/pet Headcrab")) pet_cmd_handle(id,0)
else if(equali(arg,"/pet Rat")) pet_cmd_handle(id,1)
else if(equali(arg,"/pet Bat")) pet_cmd_handle(id,2)
else if(equali(arg,"/pet Frog")) pet_cmd_handle(id,3)
else if(equali(arg,"/pet Floater")) pet_cmd_handle(id,4)
else if(equali(arg,"/pet Cockroach")) pet_cmd_handle(id,5)
else if(equali(arg,"/pet Hyper") || equali(arg,"/pet Hyper Bat")) pet_cmd_handle(id,6)
else if(containi(arg,"/pet")==0) pet_cmd_handle(id,random_num(0,PET_NUM-1))
else if(containi(arg,"/nopet")==0)
{
handle_DeathMsg(id)
if(pet) client_print(id,print_chat," %L",id,"MSG_REMOVEPET")
else client_print(id,print_chat," %L",id,"MSG_NOREMOVEPET")
}
}
public pet_cmd_handle(id,num)
{
if(pet)
{
client_print(id,print_chat," %L",id,"MSG_NOGIVEPET_HAVE")
}
else if(!is_user_alive(id))
{
client_print(id,print_chat," %L",id,"MSG_NOGIVEPET_DEAD")
}
else
{
pet = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
set_pev(pet,pev_classname,"GHW_Pet")
pettype = num
engfunc(EngFunc_SetModel,pet,pet_models])
new Float:origin
pev(id,pev_origin,origin)
if(is_user_crouching(id)) origin -= pet_minus_z_crouching]
else origin -= pet_minus_z_standing]
set_pev(pet,pev_origin,origin)
set_pev(pet,pev_solid,SOLID_NOT)
set_pev(pet,pev_movetype,MOVETYPE_FLY)
set_pev(pet,pev_owner,33)
set_pev(pet,pev_nextthink,1.0)
set_pev(pet,pev_sequence,0)
set_pev(pet,pev_gaitsequence,0)
set_pev(pet,pev_framerate,1.0)
client_print(id,print_chat," %L",id,"MSG_GIVEPET",pet_name])
}
}
public FM_Think_hook(ent)
{
for(new i=0;i<=maxplayers;i++)
{
if(ent==pet)
{
static Float:origin
static Float:origin2
static Float:velocity
pev(ent,pev_origin,origin2)
get_offset_origin_body(i,Float:{50.0,0.0,0.0},origin)
if(is_user_crouching(i)) origin -= pet_minus_z_crouching]
else origin -= pet_minus_z_standing]
if(get_distance_f(origin,origin2)>300.0)
{
set_pev(ent,pev_origin,origin)
}
else if(get_distance_f(origin,origin2)>80.0)
{
get_speed_vector(origin2,origin,250.0,velocity)
set_pev(ent,pev_velocity,velocity)
if(pev(ent,pev_sequence)!=pet_run] || pev(ent,pev_framerate)!=pet_run_speed])
{
set_pev(ent,pev_sequence,pet_run])
set_pev(ent,pev_gaitsequence,pet_run])
set_pev(ent,pev_framerate,pet_run_speed])
}
}
else if(get_distance_f(origin,origin2)<75.0)
{
if(pev(ent,pev_sequence)!=pet_idle] || pev(ent,pev_framerate)!=pet_idle_speed])
{
set_pev(ent,pev_sequence,pet_idle])
set_pev(ent,pev_gaitsequence,pet_idle])
set_pev(ent,pev_framerate,pet_idle_speed])
}
set_pev(ent,pev_velocity,Float:{0.0,0.0,0.0})
}
pev(i,pev_origin,origin)
origin = origin2
entity_set_aim(ent,origin)
set_pev(ent,pev_nextthink,1.0)
break;
}
}
} 帮顶一下!
我也不知道 希望高手出来解答
貌似没有这样的教程!!! 没有高手能解决这个问题吗 那么久了还没解决吗?呵呵。。我也想要个pet 你们四个人 一个地方的吧 插件的注册命令register_concmd参数都是使用权限来判断的。ADMIN_后面都是权限的名称。参考amxconst.inc函数表改
页:
[1]