bishou 发表于 2008-8-18 10:22:13

关于users.ini的问题,希望高手指点!

; 权限标记:
; a - immunity   (免疫,不能被 踢/封/处死/伤害 或者其他的命令影响)
; b - reservation(可通过预留通道加入服务器)
; c - amx_kick command(拥有KICK权限)
; d - amx_ban and amx_unban commands (拥有ban的权限)
; e - amx_slay and amx_slap commands (拥有强行杀死某人的权限)
; f - amx_map command(拥有更换地图的权限)
; g - amx_cvar command(可以设置amx的设置参数,但并不是所有的都可以)
; h - amx_cfg command(可以加载某个AMX的CFG设置文件权限)
; i - amx_chat and other chat commands (可以以管理员身份发布消息)
; j - amx_vote and other vote commands (可以发起一个投票事件)
; k - access to sv_password cvar (可以更改为服务器加密码)
; l - access to amx_rcon command and rcon_password cvar (by amx_cvar command)(可以用rcon命令来以OP身份登陆服务器)
; m - custom level A (自定义管理级别,为附加的其他插件预留的权限等级)
; n - custom level B
; o - custom level C
; p - custom level D
; q - custom level E
; r - custom level F
; s - custom level G
; t - custom level H
; u - menu access (拥有打开MENU管理菜单的权限)
; z - user(普通用户权限)

这些是users.ini的权限标记
我的问题是:我有些插件,比如说火箭筒插件,如何加到 M—T 的 自定义权限里!

leiminlm 发表于 2008-8-18 13:26:20

回复: 关于users.ini的问题,希望高手指点!

只能在源码里修改为你所要的权限,重新编译

yiyuan 发表于 2008-8-18 14:27:40

回复: 关于users.ini的问题,希望高手指点!

修改custommenuitems.cfg,把火箭筒插件加上权限,这样只有特定权限的人才能使用了!

bishou 发表于 2008-8-18 17:28:07

回复: 关于users.ini的问题,希望高手指点!

:qqb022: 两位大虾能留下QQ吗!我想你们教教我。我的QQ是:249251187 非常感谢

bishou 发表于 2008-8-18 17:54:33

回复: 关于users.ini的问题,希望高手指点!

/*
Bazooka v0.99 , by KinSprite , 11/29,2006
【管理员命令】 —— 放火箭筒
amx_bazooka

【玩家命令】—— 购买火箭筒
buy_bazooka
buy_rpg
buy_bzk
say /buy_bazooka
say /buy_rpg
say /buy_bzk

【参数变量】
amx_bazooka_time "5.0"   //火箭弹最多飞行时间, 默认 5.0 秒
amx_bazooka_drop "1"   //火箭筒是否可丢弃,默认为1,1/0
amx_bazooka_num "4"    //最多可存在火箭筒的数量,默认为4
amx_bazooka_ammo "2"   //火箭筒的炮弹量,默认为2
amx_bazooka_damageradius "1000" //炮弹的杀伤范围,默认1000
amx_bazooka_maxdamage "150"//炮弹的最大伤害生命值,默认150
amx_bazooka_price "10000"//火箭筒的价格,默认10000$
amx_bazooka_ammoprice "1000" //火箭筒炮弹价格,默认1000$一发
amx_bazooka_reloadtime "4.0" //火箭筒重装炮弹的时间,默认4秒
amx_bazooka_velocity "800"//火箭弹速度, 默认800
amx_bazooka_normal "0"   //火箭筒使用普通模式, 默认0
amx_bazooka_heatskdelay "1.0" //热寻导延时,默认 1.0 秒
amx_bazooka_trailtime "30"//火箭弹拖尾时间, 默认30 (大概3秒)
amx_bazooka_teamcolors "1"//火箭弹拖尾颜色, 默认 1 --使用团队颜色
amx_bazooka_arena "0"   //火箭筒竞技场, 默认 0 ; 为1时, 火箭弹不减
amx_pazooka_buytime "1"   //火箭筒\火箭弹必需在购物时间内购买
amx_bazooka_buyzone "1"   //火箭筒\火箭弹必需在购物区中购买
amx_bazooka_adminsuper "0"//有免疫权限管理员不限制使用高级功能
Thanks : More & nwb13
*/

#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <fun>
#include <cstrike>
#include <amxmisc>
#define PER_VELOCITY_USER_GUIDED 0.65
#define ARENA_DAMAGERADIUS 72
#define ICON_SHOWTIME 3.0
#define ICON_SPRITE "item_longjump"
#define COLOR_R 0
#define COLOR_G 150
#define COLOR_B 0
#define BZK_CLASSNAME "super_bazooka"
enum { IconHide, IconShow, IconFlash };
enum { bzk_droped = 1, bzk_rocket};
new explosion, smoke, white
new g_bazooka_nums
new gWpnUsed
new bool:CanShoot
new bool:buy_in_time
new bool:have_bazooka
new bool:in_freezetime
new Munni
new mode
new user_controll
new g_msgDeathMsg
new gmsgScoreInfo
new g_msgStatusIcon
new rocketsmoke
new g_bazooka_time
new g_bazooka_drop
new g_bazooka_num
new g_bazooka_ammo
new g_bazooka_damageradius
new g_bazooka_maxdamage
new g_bazooka_price
new g_bazooka_ammoprice
new g_bazooka_reloadtime
new g_bazooka_velocity
new g_bazooka_normal
new g_bazooka_heatskdelay
new g_bazooka_trailtime
new g_bazooka_teamcolors
new g_bazooka_arena
new g_bazooka_buytime
new g_bazooka_buyzone
new g_bazooka_adminsuper
new g_bazooka_adminunlimitammo
new g_shield
public plugin_init() {
register_plugin("Bazooka", "v0.99", "KinSprite")
register_dictionary("bazooka.txt")

register_clcmd("amx_bazooka", "drop_rpg", ADMIN_KICK, " - Drop A bazooka in front of you.")
register_concmd("amx_bazooka_startarena", "start_bazooka_arena", ADMIN_KICK, " - Start bazooka arena.")
register_concmd("amx_bazooka_endarena", "end_bazooka_arena", ADMIN_KICK, " - Start bazooka arena.")

g_bazooka_time = register_cvar("amx_bazooka_time", "5.0")
g_bazooka_drop = register_cvar("amx_bazooka_drop", "1")
g_bazooka_num = register_cvar("amx_bazooka_num", "4")
g_bazooka_ammo = register_cvar("amx_bazooka_ammo", "2")
g_bazooka_damageradius = register_cvar("amx_bazooka_damageradius", "1000")
g_bazooka_maxdamage = register_cvar("amx_bazooka_maxdamage", "150")
g_bazooka_price = register_cvar("amx_bazooka_price", "10000")
g_bazooka_ammoprice = register_cvar("amx_bazooka_ammoprice", "1000")
g_bazooka_reloadtime = register_cvar("amx_bazooka_reloadtime", "4.0")
g_bazooka_velocity = register_cvar("amx_bazooka_velocity", "800")
g_bazooka_normal = register_cvar("amx_bazooka_normal", "0")
g_bazooka_heatskdelay = register_cvar("amx_bazooka_heatskdelay", "1.0")
g_bazooka_trailtime = register_cvar("amx_bazooka_trailtime", "30") // roughly 3 seconds
g_bazooka_teamcolors = register_cvar("amx_bazooka_teamcolors", "1") // set to 1 for team colored trails
g_bazooka_arena = register_cvar("amx_bazooka_arena", "0") //requires direct hit to kill
g_bazooka_buytime = register_cvar("amx_bazooka_buytime", "1") // requires buy bazooka or shell in buytime
g_bazooka_buyzone = register_cvar("amx_bazooka_buyzone", "1") // requires buy bazooka or shell at buyzone
g_bazooka_adminsuper = register_cvar("amx_bazooka_adminsuper", "0")
g_bazooka_adminunlimitammo = register_cvar("amx_bazooka_adminunlimitammo", "0")
register_clcmd("buy_bazooka", "buy_bazooka", 0, " - Buy a bazooka (RPG)")
register_clcmd("buy_bzk", "buy_bazooka", 0, " - Buy a bazooka (RPG)")
register_clcmd("buy_rpg", "buy_bazooka", 0, " - Buy a bazooka (RPG)")

register_clcmd("say","check_say")
register_clcmd("say_team","check_say")

register_clcmd("buyammo1","buy_bazooka_ammo")
register_event("Damage", "on_Damage", "b", "2!0") // check killed by C4 bomb
register_event("DeathMsg", "player_die", "a")
register_event("RoundTime", "new_round", "bc")// time change
register_event("CurWeapon", "change_weapon", "be", "1=1")
register_event("ResetHUD", "player_spawn", "b")
register_event("WeapPickup","check_model","b")
register_event("TextMsg","on_RoundRestart","a","2&#Game_will_restart_in")

register_touch(BZK_CLASSNAME, "*", "bzk_touch")
register_logevent("freezetimecomplete", 2, "1=Round_Start") // freezetime complete
register_logevent("EndRound",2,"0=World triggered","1=Round_End")


register_clcmd("drop", "handle_drop")
g_msgDeathMsg = get_user_msgid("DeathMsg")
gmsgScoreInfo = get_user_msgid("ScoreInfo")
g_msgStatusIcon = get_user_msgid("StatusIcon")

g_shield = file_exists("models/p_shield.mdl") & file_exists("models/w_shield.mdl")
}
public plugin_precache() {
precache_model("models/rpgrocket.mdl")
precache_model("models/w_rpg.mdl")
precache_model("models/w_rpgt.mdl")
precache_model("models/v_rpg.mdl")
precache_model("models/p_rpg.mdl")

precache_sound("weapons/rocketfire1.wav")
precache_sound("weapons/nuke_fly.wav")
precache_sound("weapons/mortarhit.wav")
precache_sound("weapons/dryfire_rifle.wav")
precache_sound("common/wpn_select.wav")
precache_sound("items/ammopickup1.wav")
precache_sound("items/gunpickup3.wav")
precache_sound("items/gunpickup4.wav")
precache_sound("items/nvg_on.wav")
explosion = precache_model("sprites/fexplo.spr")
smoke= precache_model("sprites/steam1.spr")
white = precache_model("sprites/white.spr")

rocketsmoke = precache_model("sprites/smoke.spr")
}
public check_say(id) {
new said
read_args(said,31)

if (equali(said, "^"/buy_bazooka^"")
|| equali(said, "^"/buy_bzk^"")
|| equali(said, "^"/buy_rpg^"")
|| equali(said, "^"buy_bazooka^"")
|| equali(said, "^"buy_bzk^"")
|| equali(said, "^"buy_rpg^""))
buy_bazooka(id)

return PLUGIN_CONTINUE
}
public buy_bazooka(id){
if (have_bazooka){
client_print(id,print_chat,"%L", id, "HAVE_BAZOOKA")
return PLUGIN_HANDLED
}

if (!is_user_alive(id)){
client_print(id,print_chat,"%L", id, "CANT_BUY_RPG")
return PLUGIN_HANDLED
}

if (get_pcvar_num(g_bazooka_buyzone))
if (!cs_get_user_buyzone(id)){
   client_print(id,print_chat,"%L", id, "NOT_AT_BUYZONE")
   return PLUGIN_HANDLED
}

if (!buy_in_time){
client_print(id,print_chat,"%L", id, "NOT_BUY_TIME")
return PLUGIN_HANDLED
}

new user_money = cs_get_user_money(id)
new bazooka_price = get_pcvar_num(g_bazooka_price)

if (user_money >= bazooka_price)
{
if (g_bazooka_nums >= get_pcvar_num(g_bazooka_num) && !get_pcvar_num(g_bazooka_arena)) {
   client_print(id,print_chat,"%L", id, "NO_MORE_BAZOOKA")
   return PLUGIN_HANDLED
}
cs_set_user_money(id, user_money - bazooka_price)

player_get_bozooka(id)

new name
get_user_name(id,name,31)
client_print(0, print_chat, "%L", LANG_PLAYER, "BUY_BAZOOKA", name)

}else{
client_print(id, print_chat, "%L", id, "LACK_MONEY" ,get_pcvar_num(g_bazooka_price))
}
return PLUGIN_HANDLED
}
public player_get_bozooka(id) {
Create_StatusIcon(id, IconShow, ICON_SPRITE, COLOR_R, COLOR_G, COLOR_B)

set_task(ICON_SHOWTIME, "Clear_Icons", id)

g_bazooka_nums++
have_bazooka = true
CanShoot = true

new ammo = get_pcvar_num(g_bazooka_ammo)
if (ammo > 2)    // 初始最多给两枚火箭弹
ammo = 2
Munni = ammo

check_model(id)
   
mode = 0
user_controll = 0

client_print(id, print_chat, "%L", id, "PRESS_KEY")
emit_sound(id, CHAN_WEAPON, "items/gunpickup3.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}

public buy_bazooka_ammo(id){
if (!is_user_connected(id) || !is_user_alive(id) || !have_bazooka)
return PLUGIN_CONTINUE

if (Munni >= get_pcvar_num(g_bazooka_ammo))
   return PLUGIN_CONTINUE

if (get_pcvar_num(g_bazooka_buyzone))
if (!cs_get_user_buyzone(id)){
   client_print(id, print_chat, "%L", id, "NOT_AT_BUYZONE_SHELL")
   return PLUGIN_CONTINUE
}

if (!buy_in_time){
client_print(id,print_chat,"%L" , id, "NOT_BUY_TIME")
return PLUGIN_CONTINUE
}
//engclient_cmd(id,"primammo")
//engclient_cmd(id,"buyammo1")

new user_money = cs_get_user_money(id)
new bazooka_ammoprice = get_pcvar_num(g_bazooka_ammoprice)

if (user_money >= bazooka_ammoprice)
{
if (!buy_in_time)
   return PLUGIN_CONTINUE

Create_StatusIcon(id, IconFlash, ICON_SPRITE, COLOR_R, COLOR_G, COLOR_B)

if ( task_exists(id) )
   remove_task(id)
set_task(1.5, "Clear_Icons", id)

Munni++
cs_set_user_money(id,user_money - bazooka_ammoprice)

new weaponid, clip, ammo
weaponid = get_user_weapon(id, clip, ammo)
if (weaponid == CSW_KNIFE)
   ammo_hud(id, 1)
emit_sound(id, CHAN_WEAPON, "items/ammopickup1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}

return PLUGIN_CONTINUE
}
public fire_rocket(id) {
if (Munni <= 0) {
    client_print(id,print_center, "%L", id, "NO_MORE_SHELL")
    emit_sound(id, CHAN_WEAPON, "weapons/dryfire_rifle.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
    return PLUGIN_HANDLED
}
if (!CanShoot && Munni > 0){
    client_print(id, print_center, "%L", id, "STILL_LOADING")
    return PLUGIN_HANDLED
}
new Float:StartOrigin, Float:Angle
new PlayerOrigin
get_user_origin(id, PlayerOrigin, 1)
StartOrigin = float(PlayerOrigin)
StartOrigin = float(PlayerOrigin)
StartOrigin = float(PlayerOrigin)
entity_get_vector(id, EV_VEC_v_angle, Angle)
Angle = Angle * -1.0
new RocketEnt = create_entity("info_target")
entity_set_string(RocketEnt, EV_SZ_classname, BZK_CLASSNAME)
entity_set_model(RocketEnt, "models/rpgrocket.mdl")
entity_set_origin(RocketEnt, StartOrigin)
entity_set_vector(RocketEnt, EV_VEC_angles, Angle)
new Float:MinBox = {-1.0, -1.0, -1.0}
new Float:MaxBox = {1.0, 1.0, 1.0}
entity_set_vector(RocketEnt, EV_VEC_mins, MinBox)
entity_set_vector(RocketEnt, EV_VEC_maxs, MaxBox)
entity_set_int(RocketEnt, EV_INT_solid, 2)
entity_set_int(RocketEnt, EV_INT_movetype, 5)
entity_set_edict(RocketEnt, EV_ENT_owner, id)
entity_set_int(RocketEnt, EV_INT_team, bzk_rocket)
new Float:Velocity
new myvelocity = get_pcvar_num(g_bazooka_velocity)
VelocityByAim(id, myvelocity, Velocity)
entity_set_vector(RocketEnt, EV_VEC_velocity, Velocity)
emit_sound(RocketEnt, CHAN_WEAPON, "weapons/rocketfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(RocketEnt, CHAN_VOICE, "weapons/nuke_fly.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

new CsTeams:iTeam =cs_get_user_team(id)
new trailtime =get_pcvar_num(g_bazooka_trailtime)
new colorr =random_num(0,255)
new colorg =random_num(0,255)
new colorb =random_num(0,255)
if (get_pcvar_num(g_bazooka_teamcolors) == 1) {
   switch(iTeam) {
    case CS_TEAM_T: { //if team T color=red
   message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
   write_byte(22)
   write_short(RocketEnt)
   write_short(rocketsmoke)
   write_byte(trailtime)
   write_byte(3)
   write_byte(255)
   write_byte(0)
   write_byte(0)
   write_byte(255)
   message_end()
    }
    case CS_TEAM_CT: { // if team CT color=blue
   message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
   write_byte(22)
   write_short(RocketEnt)
   write_short(rocketsmoke)
   write_byte(trailtime)
   write_byte(3)
   write_byte(0)
   write_byte(0)
   write_byte(255)
   write_byte(255)
   message_end()
    }
}
}
else { // random colors anyone?
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(22)
write_short(RocketEnt)
write_short(rocketsmoke)
write_byte(trailtime)
write_byte(3)
write_byte(colorr)
write_byte(colorg)
write_byte(colorb)
write_byte(255)
message_end()
}

if ((get_pcvar_num(g_bazooka_normal) || get_pcvar_num(g_bazooka_arena)) && !has_bazooka_adminsuper(id))
{
   if (mode != 0)
   return_normalmode(id)
}
else
{
   if (mode == 1) {   // 热寻导模式
   new info
   info = RocketEnt
   set_task(get_pcvar_float(g_bazooka_heatskdelay), "find_and_follow", 0, info, 1)
   }
   else if (mode == 2) {// 用户导航模式
   entity_set_int(RocketEnt, EV_INT_rendermode, 1)
   attach_view(id, RocketEnt)
   user_controll = RocketEnt
   }
}

if (get_pcvar_num(g_bazooka_arena) != 1 && !(has_bazooka_adminsuper(id) && get_pcvar_num(g_bazooka_adminunlimitammo))) {
Munni--
}

CanShoot = false
if (Munni == 0)
client_print(id,print_center,"%L", id, "NO_MORE_SHELL")
else
client_print(id,print_center,"%L", id,"STILL_LOADING")

new data
data = id
set_task(has_bazooka_adminsuper(id) ? 0.5 * get_pcvar_float(g_bazooka_reloadtime) : get_pcvar_float(g_bazooka_reloadtime), "bazooka_reload", id+9477, data, 1)
ammo_hud(id, 0)

data = RocketEnt
set_task(has_bazooka_adminsuper(id) ? 1.5 * get_pcvar_float(g_bazooka_time) : get_pcvar_float(g_bazooka_time), "detonate_rocket", id+8356, data, 1)

return PLUGIN_HANDLED
}
public bazooka_reload(data[]) {
if (is_user_alive(data) && have_bazooka]){
if (Munni] != 0)
client_print(data,print_center,"%L", data, "FINISH_LOADING")
CanShoot] = true
ammo_hud(data, 1)
}
}
public detonate_rocket(data[]) {
if (is_valid_ent(data))
bzk_touch(data, 0)
}
public find_and_follow(info[]) {
new RocketEnt = info
new Float:shortestDist = 10000.0
new nearestPlayer = 0

if (is_valid_ent(RocketEnt)) {
new players, count, owner, owner_team
get_players(players, count)
owner = entity_get_edict(RocketEnt, EV_ENT_owner)
owner_team = get_user_team(owner)
for (new i = 0; i < count; i++) {
   if (is_user_alive(players) && owner != players && get_user_team(players) != owner_team) {
    new Float:PlayerOrigin, Float:RocketOrigin
    entity_get_vector(players, EV_VEC_origin, PlayerOrigin)
    entity_get_vector(RocketEnt, EV_VEC_origin, RocketOrigin)
   
    new Float:distance = vector_distance(PlayerOrigin, RocketOrigin)
   
    if (distance <= shortestDist) {
   shortestDist = distance
   nearestPlayer = players
    }
   }
}
}

if (nearestPlayer > 0) {
new data
data = RocketEnt
data = nearestPlayer
set_task(0.1, "follow_and_catch", RocketEnt, data, 2, "b")
}
else {
bzk_touch(RocketEnt, 0)
}
}
public follow_and_catch(data[]) {
new RocketEnt = data
new target = data
new myvelocity = get_pcvar_num(g_bazooka_velocity)

if (is_user_alive(target) && is_valid_ent(RocketEnt)) {
entity_set_follow(RocketEnt, target, (myvelocity+0.0))

new Float:Velocity
new Float:NewAngle
entity_get_vector(RocketEnt, EV_VEC_velocity, Velocity)
vector_to_angle(Velocity, NewAngle)
entity_set_vector(RocketEnt, EV_VEC_angles, NewAngle)
}
else {
remove_task(RocketEnt)
new info
info = RocketEnt
set_task(0.1, "find_and_follow", 0, data, 1)
}
}

public bzk_touch(ptr, ptd) {
if (!is_valid_ent(ptr))
return PLUGIN_CONTINUE

new bzk_type = entity_get_int(ptr, EV_INT_team)

if (bzk_type == bzk_rocket) {      // bazooka_rocket
new Float:EndOrigin
entity_get_vector(ptr, EV_VEC_origin, EndOrigin)
new iOrigin
FVecIVec(EndOrigin,iOrigin)

emit_sound(ptr, CHAN_WEAPON, "weapons/mortarhit.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
emit_sound(ptr, CHAN_VOICE, "weapons/mortarhit.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)

message_begin(MSG_BROADCAST, SVC_TEMPENTITY)// Feuerball 火球
write_byte(17)
write_coord(iOrigin)
write_coord(iOrigin)
write_coord(iOrigin + 128)
write_short(explosion)
write_byte(60)
write_byte(255)
message_end()

message_begin(MSG_BROADCAST, SVC_TEMPENTITY)// Rauchwolke 烟云效果
write_byte(5)
write_coord(iOrigin)
write_coord(iOrigin)
write_coord(iOrigin + 256)
write_short(smoke)
write_byte(125)
write_byte(5)
message_end()

new maxdamage = get_pcvar_num(g_bazooka_maxdamage)
new damageradius = get_pcvar_num(g_bazooka_arena) ? ARENA_DAMAGERADIUS : get_pcvar_num(g_bazooka_damageradius)
new friendlyfire = get_cvar_num("mp_friendlyfire")

new PlayerPos, distance, damage
new num
new players
new victim
new frikillsum = 0
new attacker = entity_get_edict(ptr, EV_ENT_owner)
new attacker_team = get_user_team(attacker)

get_players(players, num, "a")
for (new j = 0; j < num; j++) {
   victim = players
   get_user_origin(victim, PlayerPos)
   
   distance = get_distance(PlayerPos, iOrigin)
   if (distance <= damageradius) {// Schadensradius
    message_begin(MSG_ONE, get_user_msgid("ScreenShake"), {0,0,0}, victim)// Schteln 屏幕抖动效果
    write_short(1<<14)
    write_short(1<<14)
    write_short(1<<14)
    message_end()
    damage = maxdamage - floatround(floatmul(float(maxdamage), floatdiv(float(distance), float(damageradius))))
    if (get_user_godmode(victim))
   continue
    new newHealth = get_user_health(victim) - damage
    if (newHealth <= 0) {
   if (attacker == victim ) {
      if (!friendlyfire && has_bazooka_adminsuper(victim))
      continue
      
      user_kill(victim, 1)
      continue
   }
   else if (attacker_team == get_user_team(victim)) {
      if ( !friendlyfire )
       continue
      frikillsum ++
      client_print(attacker, print_chat, "%L", attacker, "KILL_TEAMMATE")
   }
   
   set_msg_block(g_msgDeathMsg, BLOCK_ONCE)
   set_user_health(victim, newHealth)
      
   message_begin(MSG_ALL, g_msgDeathMsg, {0, 0, 0} ,0)
   write_byte(attacker)
   write_byte(victim)
   write_byte(0)
   write_string("bazooka")
   message_end()
   
   update_info(attacker, victim)
    }
    else {
   if ( attacker_team == get_user_team(victim) && attacker != victim)
   {
      if ( !friendlyfire )
       continue
      client_print(attacker, print_chat, "%L", attacker,"INJURE_TEAMMATE")
   }
   
   if (attacker == victim && !friendlyfire && has_bazooka_adminsuper(victim))
      continue
   
   set_user_health(victim, newHealth)
    }
   }
}

if (frikillsum > 0){
   server_cmd("amx_pcheater #%i %i", get_user_userid(attacker), (frikillsum * 2))
   server_exec()
   }

message_begin(MSG_ALL, SVC_TEMPENTITY, iOrigin)
write_byte(21)
write_coord(iOrigin)
write_coord(iOrigin)
write_coord(iOrigin)
write_coord(iOrigin)
write_coord(iOrigin)
write_coord(iOrigin+damageradius)
write_short(white)
write_byte(0)
write_byte(1)
write_byte(6)
write_byte(8)
write_byte(1)
write_byte(255)
write_byte(255)
write_byte(192)
write_byte(128)
write_byte(5)
message_end()

new classname2
if ((ptd > 0) && is_valid_ent(ptd)){
    entity_get_string(ptd,EV_SZ_classname,classname2,31)
    if(equal(classname2,"func_breakable"))
   force_use(ptr,ptd)
}

attach_view(attacker, attacker)
user_controll = 0
if (task_exists(attacker + 8356))
   remove_task(attacker + 8356)
   
remove_entity(ptr)
}
else if (bzk_type == bzk_droped) {// bazooka_droped
    new Picker
    if (is_valid_ent(ptd)) {
      entity_get_string(ptd, EV_SZ_classname, Picker, 31)
    }
    if (equal(Picker, "player") ) {
if(!have_bazooka)
{
   Munni = entity_get_int(ptr, EV_INT_iuser1)
   CanShoot = true
   have_bazooka = true
   
   Create_StatusIcon(ptd, IconShow, ICON_SPRITE, COLOR_R, COLOR_G, COLOR_B)
   set_task(ICON_SHOWTIME, "Clear_Icons", ptd)
   
   remove_entity(ptr)
   client_print(ptd, print_center, "%L", ptd, "PICK_UP")
   client_print(ptd, print_chat, "%L", ptd, "PRESS_KEY")
   mode = 0
   user_controll = 0
   emit_sound(ptd, CHAN_WEAPON, "items/gunpickup3.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
   check_model(ptd)
}
    }
}

return PLUGIN_CONTINUE
}
update_info(killer_id, victim_id)
{
new victim_frags, killer_frags, victim_deaths, killer_deaths, victim_team, killer_team
new killer_money = cs_get_user_money(killer_id)

victim_team = get_user_team(victim_id)
killer_team = get_user_team(killer_id)

if (killer_team != victim_team){
killer_frags = get_user_frags(killer_id) + 1
killer_money =killer_money + 300
}
else {
killer_frags = get_user_frags(killer_id) - 1
killer_money = killer_money - 300
}

if (killer_money > 16000)
killer_money = 16000

if (killer_money < 0)
killer_money = 0

cs_set_user_money(killer_id, killer_money)


victim_frags = get_user_frags(victim_id) + 1

victim_deaths = get_user_deaths(victim_id)
killer_deaths = get_user_deaths(killer_id)

set_user_frags(victim_id, victim_frags)
set_user_frags(killer_id, killer_frags )

Create_ScoreInfo(victim_id, victim_frags, victim_deaths, 0, victim_team)
Create_ScoreInfo(killer_id, killer_frags, killer_deaths, 0, killer_team)
}
Create_ScoreInfo(id, frags, deaths, playerClass, team ) {
message_begin(MSG_ALL,gmsgScoreInfo)
write_byte(id)
write_short(frags)
write_short(deaths)
write_short(playerClass)
write_short(team)
message_end()
}
public drop_rpg(id, level, cid) {
if (!cmd_access(id, level, cid, 1)) {
    return PLUGIN_HANDLED
}
if(g_bazooka_nums >= get_pcvar_num(g_bazooka_num) && !get_pcvar_num(g_bazooka_arena)){
    client_print(id,print_chat,"%L", id, "TO_LIMIT", g_bazooka_nums)
    return PLUGIN_HANDLED
}
new Float:PlayerOrigin, Float:End, Float:Return, Float:TraceDirection
entity_get_vector(id, EV_VEC_origin, PlayerOrigin)
VelocityByAim(id, 64, TraceDirection)
End = TraceDirection + PlayerOrigin
End = TraceDirection + PlayerOrigin
End = TraceDirection + PlayerOrigin
trace_line(id, PlayerOrigin, End, Return)
Return = PlayerOrigin
new RPG = create_entity("info_target")
entity_set_string(RPG, EV_SZ_classname, BZK_CLASSNAME)
entity_set_model(RPG, "models/w_rpg.mdl")
entity_set_origin(RPG, Return)
new Float:MinBox = {-16.0, -16.0, 0.0}
new Float:MaxBox = {16.0, 16.0, 16.0}
entity_set_vector(RPG, EV_VEC_mins, MinBox)
entity_set_vector(RPG, EV_VEC_maxs, MaxBox)
entity_set_int(RPG, EV_INT_solid, 1)
entity_set_int(RPG, EV_INT_movetype, 6)

new ammo = get_pcvar_num(g_bazooka_ammo)
if (ammo > 2)    // 初始最多给两枚火箭弹
ammo = 2
entity_set_int(RPG, EV_INT_iuser1, ammo)
entity_set_int(RPG, EV_INT_team, bzk_droped)

g_bazooka_nums++
return PLUGIN_HANDLED
}
public start_bazooka_arena(id, level, cid) {
if (!cmd_access(id, level, cid, 1)) {
return PLUGIN_HANDLED
}

set_pcvar_num(g_bazooka_arena, 1)

new players, plNum, i
get_players(players, plNum, "a")

for (; i < plNum; ++i) {
if (!have_bazooka])
   player_get_bozooka(players)
}

return PLUGIN_HANDLED
}
public end_bazooka_arena(id, level, cid) {
if (!cmd_access(id, level, cid, 1)) {
return PLUGIN_HANDLED
}
set_pcvar_num(g_bazooka_arena, 0)

new players, plNum, i
get_players(players, plNum, "a")

for (; i < plNum; ++i) {
if (have_bazooka]) {
   have_bazooka] = false
   check_model(players)
}
}

return PLUGIN_HANDLED
}
public return_normalmode(id)
{
mode = 0
emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_center, "%L", id, "NORMAL_MODE")
ammo_hud(id, 1)
}
public client_PreThink(id)
{
if (is_user_alive(id) && have_bazooka)
{
new weaponid, clip, ammo
weaponid = get_user_weapon(id, clip, ammo)
if (weaponid == CSW_KNIFE)
{
   new attack = get_user_button(id) & IN_ATTACK
   new oldattack = get_user_oldbutton(id) & IN_ATTACK
   new attack2 = get_user_button(id) & IN_ATTACK2
   new oldattack2 = get_user_oldbutton(id) & IN_ATTACK2
   
   if (attack && !oldattack)
   {
    if (CanShoot) {
   fire_rocket(id)
    }
   }
   else if (attack2 && !oldattack2)
   {
    if ((get_pcvar_num(g_bazooka_normal) || get_pcvar_num(g_bazooka_arena)) && !has_bazooka_adminsuper(id))
    {
   if (mode != 0)
      return_normalmode(id)
    }
    else
    {
   switch(mode)
   {
      case 0:
      {
      mode = 1
      emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
      emit_sound(id, CHAN_WEAPON, "items/nvg_on.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
      client_print(id, print_center, "%L", id, "HEAT_SEEK_MODE")
      }
      case 1:
      {
       mode = 2
       emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
       emit_sound(id, CHAN_WEAPON, "items/gunpickup4.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
       client_print(id, print_center, "%L", id, "USER_GUIDED_MODE")
      }
      case 2:
      {
       mode = 0
       emit_sound(id, CHAN_ITEM, "common/wpn_select.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
       client_print(id, print_center, "%L", id, "NORMAL_MODE")
      }
   }
    }
    ammo_hud(id, 1)
   }
   
   if (user_controll > 0)// 用户导航
   {
    new RocketEnt = user_controll
    if (is_valid_ent(RocketEnt)) {
   new Float:Velocity
   new myvelocity = floatround(PER_VELOCITY_USER_GUIDED * get_pcvar_num(g_bazooka_velocity))
   VelocityByAim(id, myvelocity, Velocity)
   entity_set_vector(RocketEnt, EV_VEC_velocity, Velocity)
   new Float:NewAngle
   entity_get_vector(id, EV_VEC_v_angle, NewAngle)
   entity_set_vector(RocketEnt, EV_VEC_angles, NewAngle)
    }
    else {
   user_controll = 0
   attach_view(id, id)
    }
   }
}
else
{
   if (user_controll > 0)
   {
    user_controll = 0
    attach_view(id, id)
   }
}
}

return FMRES_IGNORED
}
public change_weapon(id) {
new iWpnNum = read_data(2)

if (iWpnNum != gWpnUsed) {
gWpnUsed = iWpnNum
check_model(id)
}

return PLUGIN_CONTINUE
}
public player_spawn(id) {
if (get_pcvar_num(g_bazooka_arena) && !have_bazooka)
player_get_bozooka(id)

set_task(0.1, "check_model", id)

return PLUGIN_CONTINUE
}
public check_model(id) {
if (!is_user_alive(id))
    return PLUGIN_CONTINUE
new weaponid, clip, ammo
weaponid = get_user_weapon(id, clip, ammo)
if (weaponid == CSW_KNIFE && have_bazooka) {
    ammo_hud(id, 1)
    entity_set_string(id, EV_SZ_viewmodel, "models/v_rpg.mdl")
    entity_set_string(id, EV_SZ_weaponmodel, "models/p_rpg.mdl")
    emit_sound(id, CHAN_WEAPON, "items/gunpickup3.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
    if ( !CanShoot ){
      new data
      data = id
      set_task(get_pcvar_float(g_bazooka_reloadtime), "bazooka_reload", id+9477, data, 1)
    }
}
else {
new with_shield
if (g_shield) {
if (cs_get_user_shield(id))
   with_shield = 1
}

switch (weaponid) {
case CSW_HEGRENADE: {
   if (with_shield) {
    entity_set_string(id, EV_SZ_viewmodel, "models/shield/v_shield_hegrenade.mdl")
    entity_set_string(id, EV_SZ_weaponmodel, "models/shield/p_shield_hegrenade.mdl")
   }
   else {
    entity_set_string(id, EV_SZ_viewmodel, "models/v_hegrenade.mdl")
    entity_set_string(id, EV_SZ_weaponmodel, "models/p_hegrenade.mdl")
   }
}
case CSW_FLASHBANG: {
   if (with_shield) {
    entity_set_string(id, EV_SZ_viewmodel, "models/shield/v_shield_flashbang.mdl")
    entity_set_string(id, EV_SZ_weaponmodel, "models/shield/p_shield_flashbang.mdl")
   }
   else {
    entity_set_string(id, EV_SZ_viewmodel, "models/v_flashbang.mdl")
    entity_set_string(id, EV_SZ_weaponmodel, "models/p_flashbang.mdl")
   }
}
case CSW_SMOKEGRENADE: {
   if (with_shield) {
    entity_set_string(id, EV_SZ_viewmodel, "models/shield/v_shield_smokegrenade.mdl")
    entity_set_string(id, EV_SZ_weaponmodel, "models/shield/p_shield_smokegrenade.mdl")
   }
   else {
    entity_set_string(id, EV_SZ_viewmodel, "models/v_smokegrenade.mdl")
    entity_set_string(id, EV_SZ_weaponmodel, "models/p_smokegrenade.mdl")
   }
}
case CSW_C4: {
    entity_set_string(id, EV_SZ_viewmodel, "models/v_c4.mdl")
    entity_set_string(id, EV_SZ_weaponmodel, "models/p_c4.mdl")
   }
case CSW_KNIFE: {
   if (with_shield) {
    entity_set_string(id, EV_SZ_viewmodel, "models/shield/v_shield_knife.mdl")
    entity_set_string(id, EV_SZ_weaponmodel, "models/shield/p_shield_knife.mdl")
   }
   else {
    entity_set_string(id, EV_SZ_viewmodel, "models/v_knife.mdl")
    entity_set_string(id, EV_SZ_weaponmodel, "models/p_knife.mdl")
   }
}
}

if (have_bazooka)
ammo_hud(id, 0)

if (task_exists(id+9477)){
remove_task(id+9477)
client_print(id,print_center,"")
    }
}

return PLUGIN_CONTINUE
}
public client_connect(id) {
have_bazooka = false
CanShoot = false
Munni = 0
mode = 0
user_controll = 0
return PLUGIN_CONTINUE
}
public client_disconnect(id) {
if (have_bazooka)
g_bazooka_nums--
return PLUGIN_CONTINUE
}
ammo_hud(id, show) {
new AmmoHud
switch (mode)
{
case 0: format(AmmoHud, 63, "%L", id, "STATUS_NORMAL" , Munni)
case 1: format(AmmoHud, 63, "%L", id, "STATUS_HEAT_SEEKING" , Munni)
case 2: format(AmmoHud, 63, "%L", id, "STATUS_USER_GUIDED" , Munni)
}

if (show) {
    message_begin(MSG_ONE, get_user_msgid("StatusText"), {0,0,0}, id)
    write_byte(0)
    write_string(AmmoHud)
    message_end()
}
else {
    message_begin(MSG_ONE, get_user_msgid("StatusText"), {0,0,0}, id)
    write_byte(0)
    write_string("")
    message_end()
}
}
public player_die() {
new victim
victim = read_data(2)
ammo_hud(victim, 0)
if (have_bazooka && !get_pcvar_num(g_bazooka_arena))
drop_rpg_from_player(victim)
}
public on_RoundRestart(){
if (task_exists(9476))
remove_task(9476)
for(new i=0; i<33; i++)
{
    have_bazooka = false
    CanShoot = false
}
in_freezetime = true
return PLUGIN_CONTINUE
}
public cant_buy(){
buy_in_time = false
}
public new_round() {
if ((read_data(1) == (get_cvar_num("mp_freezetime"))) && in_freezetime)
{
if (task_exists(9476))
   remove_task(9476)
buy_in_time = true
g_bazooka_nums = 0

new TempRPG = find_ent_by_class(-1, BZK_CLASSNAME)
while (is_valid_ent(TempRPG)) {
   remove_entity(TempRPG)
   TempRPG = find_ent_by_class(TempRPG, BZK_CLASSNAME)
}

new pln,plid
get_players(plid,pln,"")
for (new i=0; i < pln; i++){
   if (task_exists(plid + 8356))
    remove_task(plid + 8356)
   if (have_bazooka])
    g_bazooka_nums++
}
}
return PLUGIN_CONTINUE
}
public freezetimecomplete()
{
buy_in_time = true
in_freezetime = false
if (get_pcvar_num(g_bazooka_buytime))
set_task(get_cvar_float("mp_buytime")*60.0,"cant_buy",9476)
for (new i=1; i<33; i++)
{
if (have_bazooka)
   CanShoot = true
}
}
public EndRound()
{
set_task(4.8, "round_prestart")
}
public round_prestart() {
in_freezetime = true
for (new i=1; i<33; i++)
{
CanShoot = false
}
}
public handle_drop(id) {
new weaponid, clip, ammo
weaponid = get_user_weapon(id, clip, ammo)
if (weaponid == CSW_KNIFE && have_bazooka) {
    if (get_pcvar_num(g_bazooka_drop) == 1) {
if (user_controll > 0)
{
   user_controll = 0
   attach_view(id, id)
}
drop_rpg_from_player(id)
    }
    else {
      return PLUGIN_CONTINUE
    }
}
return PLUGIN_CONTINUE
}
public drop_rpg_from_player(id) {
new Float:PlayerOrigin, Float:End, Float:Return, Float:TraceDirection, Float:Angles
entity_get_vector(id, EV_VEC_origin, PlayerOrigin)
entity_get_vector(id, EV_VEC_angles, Angles)
VelocityByAim(id, 96, TraceDirection)
End = TraceDirection + PlayerOrigin
End = TraceDirection + PlayerOrigin
End = TraceDirection + PlayerOrigin
trace_line(id, PlayerOrigin, End, Return)
Return = PlayerOrigin
new RPG = create_entity("info_target")
entity_set_string(RPG, EV_SZ_classname, BZK_CLASSNAME)
entity_set_model(RPG, "models/w_rpg.mdl")
entity_set_origin(RPG, Return)
Angles = 0.0
Angles = 0.0
entity_set_vector(RPG, EV_VEC_angles, Angles)
new Float:MinBox = {-16.0, -16.0, 0.0}
new Float:MaxBox = {16.0, 16.0, 16.0}
entity_set_vector(RPG, EV_VEC_mins, MinBox)
entity_set_vector(RPG, EV_VEC_maxs, MaxBox)
entity_set_int(RPG, EV_INT_solid, 1)
entity_set_int(RPG, EV_INT_movetype, 6)
entity_set_int(RPG, EV_INT_iuser1, Munni)
entity_set_int(RPG, EV_INT_team, bzk_droped)
Munni = 0
have_bazooka = false

entity_set_string(id, EV_SZ_viewmodel, "models/v_knife.mdl")
entity_set_string(id, EV_SZ_weaponmodel, "models/p_knife.mdl")
ammo_hud(id, 0)
return PLUGIN_CONTINUE
}
public on_Damage(victim){
if ( victim < 1 || victim > 32 )
return PLUGIN_CONTINUE

if (!have_bazooka || get_pcvar_num(g_bazooka_arena))
return PLUGIN_CONTINUE

new wpnindex = 0, hitplace = 0, attacker = get_user_attacker(victim,wpnindex,hitplace)
new damage = read_data(2)

call_damage(victim, attacker, damage, wpnindex, hitplace)

return PLUGIN_CONTINUE
}
public call_damage(victim, attacker, damage, wpnindex, hitplace){
new inflictor = entity_get_edict(victim, EV_ENT_dmg_inflictor)

// Check to see if the damage was from the bomb
if(wpnindex != 4 && attacker != victim && inflictor > 0 ){

if ( is_valid_ent ( inflictor ) )
{
   new szClassName
   entity_get_string(inflictor, EV_SZ_classname, szClassName, 63)
   
   // Technically I don't think we need to check the classname, but just in case
   if ( equali(szClassName, "grenade") || equali(szClassName, "env_explosion") ){
    // We need to call the death function manually b/c DeathMsg isn't broadcasted when the bomb explodes and kills someone
    if (get_user_health(victim) - damage < 0 ){
   drop_rpg_from_player(victim)
    }
   }
}
}

return PLUGIN_CONTINUE
}
public Clear_Icons(id) {
Create_StatusIcon(id, IconHide, ICON_SPRITE, 0, 0, 0)
}
stock entity_set_follow(entity, target, Float:speed) {
if (!is_valid_ent(entity) || !is_valid_ent(target)) return 0
new Float:entity_origin, Float:target_origin
entity_get_vector(entity, EV_VEC_origin, entity_origin)
entity_get_vector(target, EV_VEC_origin, target_origin)
new Float:diff
diff = target_origin - entity_origin
diff = target_origin - entity_origin
diff = target_origin - entity_origin
new Float:length = floatsqroot(floatpower(diff, 2.0) + floatpower(diff, 2.0) + floatpower(diff, 2.0))
new Float:Velocity
Velocity = diff * (speed / length)
Velocity = diff * (speed / length)
Velocity = diff * (speed / length)
entity_set_vector(entity, EV_VEC_velocity, Velocity)
return 1
}
stock Create_StatusIcon(id, status, sprite[], red, green, blue){
message_begin( MSG_ONE, g_msgStatusIcon , {0,0,0}, id )
write_byte( status )   // status 0 - hide, 1 - show, 2 - flash
write_string( sprite )   // sprite name >>"dmg_rad","item_longjump","dmg_shock","item_healthkit","dmg_heat","suit_full","cross","dmg_gas"
write_byte( red )    // red
write_byte( green )    // green
write_byte( blue )    // blue
message_end()
}
stock has_bazooka_adminsuper(id) {
return get_user_flags(id) & ADMIN_IMMUNITY && get_pcvar_num(g_bazooka_adminsuper)
}

bishou 发表于 2008-8-18 17:56:00

回复: 关于users.ini的问题,希望高手指点!

这个是我火箭筒的源文件,请问怎么加!

Rulzy 发表于 2008-8-18 18:58:26

回复: 关于users.ini的问题,希望高手指点!

stock has_bazooka_adminsuper(id) {
return get_user_flags(id) & ADMIN_IMMUNITY && get_pcvar_num(g_bazooka_adminsuper)
}
改成stock has_bazooka_adminsuper(id) {
return get_user_flags(id) & ADMIN_LEVEL_A && get_pcvar_num(g_bazooka_adminsuper)
}
ADMIN_LEVEL_A 对应 m 权限,
ADMIN_LEVEL_B 对应 n 权限,
ADMIN_LEVEL_C 对应 o 权限,
ADMIN_LEVEL_D 对应 p 权限,
ADMIN_LEVEL_E 对应 q 权限,
ADMIN_LEVEL_F 对应 r 权限,
ADMIN_LEVEL_G 对应 s 权限,
ADMIN_LEVEL_H 对应 t 权限。
页: [1]
查看完整版本: 关于users.ini的问题,希望高手指点!