广告广告
  加入我的最爱 设为首页 风格修改
首页 首尾
 手机版   订阅   地图  繁体 
您是第 2372 个阅读者
 
发表文章 发表投票 回覆文章
  可列印版   加为IE收藏   收藏主题   上一主题 | 下一主题   
luoyunfeng
个人文章 个人相簿 个人日记 个人地图
路人甲
级别: 路人甲 该用户目前不上站
推文 x0 鲜花 x1
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片
推文 x0
[1.6] 在amxx里怎么给插件设权限
; m - custom level A (自定义权限A,专门为需要设置额外权限的插件而准备)
; n - custom level B (自定义权限B,专门为需要设置额外权限的插件而准备)
; o - custom level C (自定义权限C,专门为需要设置额外权限的插件而准备)
; p - custom level D (自定义权限D,专门为需要设置额外权限的插件而准备)
; q - custom level E (自定义权限E,专门为需要设置额外权限的插件而准备)
; r - custom level F (自定义权限F,专门为需要设置额外权限的插件而准备)
; s - custom level G (自定义权限G,专门为需要设置额外权限的插件而准备)
; t - custom level H (自定义权限H,专门为需要设置额外权限的插件而准备)




沙包sma


/*================================================================================
     
     -----------------------------------
     -*- [ZP] Sandbags -*-
     -----------------------------------
     
     ~~~~~~~~~~~~~~~
     - Description -
     ~~~~~~~~~~~~~~~
     
     Original by SAMURAI, Upgraded to zp by LARP
     larp.source@gmail.com (Chile) Languaje spanish!
     
================================================================================*/


#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <xs>
#include <fun>
#include <zombieplague.inc>

// The sizes of models
#define PALLET_MINS Float:{ -27.260000, -22.280001, -22.290001 }
#define PALLET_MAXS Float:{ 27.340000, 26.629999, 29.020000 }


// from fakemeta util by VEN
#define fm_find_ent_by_class(%1,%2) engfunc(EngFunc_FindEntityByString, %1, "classname", %2)
#define fm_remove_entity(%1) engfunc(EngFunc_RemoveEntity, %1)
// this is mine
#define fm_drop_to_floor(%1) engfunc(EngFunc_DropToFloor,%1)

// cvars
new pnumplugin, remove_nrnd, maxpallets, phealth;

// num of pallets with bags
new palletscout = 0;

/* Models for pallets with bags .
Are available 2 models, will be set a random of them */
new g_models[][] =
{
     "models/pallet_with_bags2.mdl",
     "models/pallet_with_bags.mdl"
}

new stuck[33]
new g_bolsas[33];
new cvar[3]

new const Float:size[][3] = {
     {0.0, 0.0, 1.0}, {0.0, 0.0, -1.0}, {0.0, 1.0, 0.0}, {0.0, -1.0, 0.0}, {1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 1.0, 1.0}, {1.0, 1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, -1.0}, {-1.0, -1.0, 1.0}, {1.0, -1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, -1.0, -1.0},
     {0.0, 0.0, 2.0}, {0.0, 0.0, -2.0}, {0.0, 2.0, 0.0}, {0.0, -2.0, 0.0}, {2.0, 0.0, 0.0}, {-2.0, 0.0, 0.0}, {-2.0, 2.0, 2.0}, {2.0, 2.0, 2.0}, {2.0, -2.0, 2.0}, {2.0, 2.0, -2.0}, {-2.0, -2.0, 2.0}, {2.0, -2.0, -2.0}, {-2.0, 2.0, -2.0}, {-2.0, -2.0, -2.0},
     {0.0, 0.0, 3.0}, {0.0, 0.0, -3.0}, {0.0, 3.0, 0.0}, {0.0, -3.0, 0.0}, {3.0, 0.0, 0.0}, {-3.0, 0.0, 0.0}, {-3.0, 3.0, 3.0}, {3.0, 3.0, 3.0}, {3.0, -3.0, 3.0}, {3.0, 3.0, -3.0}, {-3.0, -3.0, 3.0}, {3.0, -3.0, -3.0}, {-3.0, 3.0, -3.0}, {-3.0, -3.0, -3.0},
     {0.0, 0.0, 4.0}, {0.0, 0.0, -4.0}, {0.0, 4.0, 0.0}, {0.0, -4.0, 0.0}, {4.0, 0.0, 0.0}, {-4.0, 0.0, 0.0}, {-4.0, 4.0, 4.0}, {4.0, 4.0, 4.0}, {4.0, -4.0, 4.0}, {4.0, 4.0, -4.0}, {-4.0, -4.0, 4.0}, {4.0, -4.0, -4.0}, {-4.0, 4.0, -4.0}, {-4.0, -4.0, -4.0},
     {0.0, 0.0, 5.0}, {0.0, 0.0, -5.0}, {0.0, 5.0, 0.0}, {0.0, -5.0, 0.0}, {5.0, 0.0, 0.0}, {-5.0, 0.0, 0.0}, {-5.0, 5.0, 5.0}, {5.0, 5.0, 5.0}, {5.0, -5.0, 5.0}, {5.0, 5.0, -5.0}, {-5.0, -5.0, 5.0}, {5.0, -5.0, -5.0}, {-5.0, 5.0, -5.0}, {-5.0, -5.0, -5.0}
}

new const g_item_name[] = { "15 Sandbags" }
const g_item_bolsas = 0
new g_itemid_bolsas
new ZPSTUCK, g_BINDMODE, g_MSGMODE

/*************************************************************
************************* AMXX PLUGIN *************************
**************************************************************/


public plugin_init()
{
     /* Register the plugin */
     //register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
     
     register_plugin("[ZP] Extra: SandBags", "1.1", "LARP")
     set_task(0.1,"checkstuck",0,"",0,"b")
     g_itemid_bolsas = zp_register_extra_item(g_item_name, g_item_bolsas, ZP_TEAM_HUMAN)
     /* Register the cvars */
     g_BINDMODE      = register_cvar("zp_pb_bind","0");            //Auto bind L Key!
     g_MSGMODE      = register_cvar("zp_pb_msg","1");            //
     ZPSTUCK = register_cvar("zp_pb_stuck","1")
     pnumplugin = register_cvar("zp_pb_enable","1"); // 1 = ON ; 0 = OFF
     remove_nrnd = register_cvar("zp_pb_remround","1");
     maxpallets = register_cvar("zp_pb_limit","200"); // max number of pallets with bags
     phealth = register_cvar("zp_pb_health","200"); // set the health to a pallet with bags
     
     /* Game Events */
     register_event("HLTV","event_newround", "a","1=0", "2=0"); // it's called every on new round
     
     /* This is for menuz: */
     register_menucmd(register_menuid("\ySand Bags:"), 1023, "menu_command" );
     register_clcmd("say /pb","show_the_menu");
     register_clcmd("/pb","show_the_menu");
     //cvar[0] = register_cvar("zp_autounstuck","1")
     cvar[1] = register_cvar("zp_pb_stuckeffects","1")
     cvar[2] = register_cvar("zp_pb_stuckwait","7")

}


public plugin_precache()
{
     for(new i;i < sizeof g_models;i++)
           engfunc(EngFunc_PrecacheModel,g_models);
}

public show_the_menu(id,level,cid)
{
     // check if user doesen't have admin
     /*if( ! cmd_access( id,level, cid , 0 ))
           return PLUGIN_HANDLED;
     */
     
     // check if the plugin cvar is turned off
     if( ! get_pcvar_num( pnumplugin ) )
           return PLUGIN_HANDLED;
           
           
     // check if user isn't alive
     if( ! is_user_alive( id ) )
     {
           client_print( id, print_chat, "" ); //msg muerto
           return PLUGIN_HANDLED;
     }
                 
     if ( !zp_get_user_zombie(id) )
     {            
           new szMenuBody[256];
           new keys;
           
           new nLen = format( szMenuBody, 255, "\ySand Bags:^n" );
           nLen += format( szMenuBody[nLen], 255-nLen, "^n\w1. Place a Sandbags (%i Remaining)", g_bolsas[id] );
           //nLen += format( szMenuBody[nLen], 255-nLen, "^n\w2. Remove a pallet with bags" );
           nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\w0. Exit" );

           keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<9)

           show_menu( id, keys, szMenuBody, -1 );

           // depends what you want, if is continue will appear on chat what the admin sayd
           return PLUGIN_HANDLED;
     }
     client_print(id, print_chat, "[ZP] The zombies can not use this command!")
     return PLUGIN_HANDLED;
}


public menu_command(id,key,level,cid)
{
     
     switch( key )
     {
           // place a pallet with bags
           case 0:
           {
                 if ( !zp_get_user_zombie(id) )
                 {
                       new money = g_bolsas[id]
                       if ( money < 1 )
                       {
                             if ( get_pcvar_num(g_MSGMODE) == 1 )
                                   {
                                         set_hudmessage(0, 0, 100, 0.80, 0.80, 0, 6.0, 2.0, 1.0, 1.0)
                                         show_hudmessage(id, "You do not have to^nplace sandbags")
                                         return PLUGIN_CONTINUE
                                   }
                             client_print(id, print_chat, "[ZP] You do not have to place sandbags!")
                             return PLUGIN_CONTINUE
                       }
                       g_bolsas[id]-= 1
                       place_palletwbags(id);
                       show_the_menu(id,level,cid);
                       return PLUGIN_CONTINUE      
                 }
                 client_print(id, print_chat, "[ZP] The zombies can not use this!!")
                 return PLUGIN_CONTINUE      
           }
           
           // remove a pallet with bags
           /*case 1:
           {
                 if ( !zp_get_user_zombie(id) )
                 {
                       new ent, body, class[32];
                       get_user_aiming(id, ent, body);
                       if (pev_valid(ent))
                       {
                             pev(ent, pev_classname, class, 31);
                             
                             if (equal(class, "amxx_pallets"))
                             {
                                   g_bolsas[id]+= 1
                                   fm_remove_entity(ent);
                             }
                             
                             else
                                   client_print(id, print_chat, "[ZP] You are not aiming at a pallet with bags");
                       }
                       else
                             client_print(id, print_chat, "[ZP] You are not aiming at a valid entity !");
                             
                       show_the_menu(id,level,cid);
                 }
           }
           */
           
           // remove all pallets with bags
           /*case 2:
           {
                 g_bolsas[id]= 0
                 remove_allpalletswbags();
                 client_print(id,print_chat,"[AMXX] You removed all pallets with bags !");
                 show_the_menu(id,level,cid);
           }
                 */
                 
     }
     
     return PLUGIN_HANDLED;
}



public place_palletwbags(id)
{
     
     if( palletscout == get_pcvar_num(maxpallets) )
     {
           client_print(id,print_chat,"[ZP] For security reasons only allow %d Sandbags on the server!",get_pcvar_num(maxpallets));
           return PLUGIN_HANDLED;
     }
     
     // create a new entity
     new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_wall"));
     
     
     // set a name to the entity
     set_pev(ent,pev_classname,"amxx_pallets");
     
     // set model            
     engfunc(EngFunc_SetModel,ent,g_models[random(sizeof g_models)]);
     
     // register a new var. for origin
     static Float:xorigin[3];
     get_user_hitpoint(id,xorigin);
     
     
     // check if user is aiming at the air
     if(engfunc(EngFunc_PointContents,xorigin) == CONTENTS_SKY)
     {
           client_print(id,print_chat,"[ZP] You can not put sandbags in the sky!");
           return PLUGIN_HANDLED;
     }
     
     
     // set sizes
     static Float:p_mins[3], Float:p_maxs[3];
     p_mins = PALLET_MINS;
     p_maxs = PALLET_MAXS;
     engfunc(EngFunc_SetSize, ent, p_mins, p_maxs);
     set_pev(ent, pev_mins, p_mins);
     set_pev(ent, pev_maxs, p_maxs );
     set_pev(ent, pev_absmin, p_mins);
     set_pev(ent, pev_absmax, p_maxs );

     
     // set the rock of origin where is user placed
     engfunc(EngFunc_SetOrigin, ent, xorigin);
     
     
     // make the rock solid
     set_pev(ent,pev_solid,SOLID_BBOX); // touch on edge, block
     
     // set the movetype
     set_pev(ent,pev_movetype,MOVETYPE_FLY); // no gravity, but still collides with stuff
     
     // now the damage stuff, to set to take it or no
     // if you set the cvar "pallets_wbags_health" 0, you can't destroy a pallet with bags
     // else, if you want to make it destroyable, just set the health > 0 and will be
     // destroyable.
     new Float:p_cvar_health = get_pcvar_float(phealth);
     switch(p_cvar_health)
     {
           case 0.0 :
           {
                 set_pev(ent,pev_takedamage,DAMAGE_NO);
           }
           
           default :
           {
                 set_pev(ent,pev_health,p_cvar_health);
                 set_pev(ent,pev_takedamage,DAMAGE_YES);
           }
     }
     
                 
     static Float:rvec[3];
     pev(id,pev_v_angle,rvec);
     
     rvec[0] = 0.0;
     
     set_pev(ent,pev_angles,rvec);
     
     // drop entity to floor
     fm_drop_to_floor(ent);
     
     // num ..
     palletscout++;
     
     // confirm message
     if ( get_pcvar_num(g_MSGMODE) == 1 )
     {
           set_hudmessage(0, 0, 100, 0.80, 0.80, 0, 6.0, 2.0, 1.0, 1.0)
           show_hudmessage(id, "You placed a SandBag^n%i Remaining", g_bolsas[id])
           return PLUGIN_HANDLED
     }
     client_print(id, print_chat, "[ZP] You have placed a Sandbag.")
     return PLUGIN_HANDLED;
}
     
/* ====================================================
get_user_hitpoin stock . Was maked by P34nut, and is
like get_user_aiming but is with floats and better :o
====================================================*/      
stock get_user_hitpoint(id, Float:hOrigin[3])
{
     if ( ! is_user_alive( id ))
           return 0;
 
     new Float:fOrigin[3], Float:fvAngle[3], Float:fvOffset[3], Float:fvOrigin[3], Float:feOrigin[3];
     new Float:fTemp[3];
 
     pev(id, pev_origin, fOrigin);
     pev(id, pev_v_angle, fvAngle);
     pev(id, pev_view_ofs, fvOffset);
 
     xs_vec_add(fOrigin, fvOffset, fvOrigin);
 
     engfunc(EngFunc_AngleVectors, fvAngle, feOrigin, fTemp, fTemp);
 
     xs_vec_mul_scalar(feOrigin, 9999.9, feOrigin);
     xs_vec_add(fvOrigin, feOrigin, feOrigin);
 
     engfunc(EngFunc_TraceLine, fvOrigin, feOrigin, 0, id);
     global_get(glb_trace_endpos, hOrigin);
 
     return 1;
}


/* ====================================================
This is called on every round, at start up,
with HLTV logevent. So if the "pallets_wbags_nroundrem"
cvar is set to 1, all placed pallets with bugs will be
removed.
====================================================*/
public event_newround()
{
     if( get_pcvar_num ( remove_nrnd ) == 1)
           remove_allpalletswbags();
           
}


/* ====================================================
This is a stock to help for remove all pallets with
bags placed . Is called on new round if the cvar
"pallets_wbags_nroundrem" is set 1.
====================================================*/
stock remove_allpalletswbags()
{
     new pallets = -1;
     while((pallets = fm_find_ent_by_class(pallets, "amxx_pallets")))
           fm_remove_entity(pallets);
           
     palletscout = 0;
}

public checkstuck() {
     if ( get_pcvar_num(ZPSTUCK) == 1 )
     {
           static players[32], pnum, player
           get_players(players, pnum)
           static Float:origin[3]
           static Float:mins[3], hull
           static Float:vec[3]
           static o,i
           for(i=0; i<pnum; i++){
                 player = players
                 if (is_user_connected(player) && is_user_alive(player)) {
                       pev(player, pev_origin, origin)
                       hull = pev(player, pev_flags) & FL_DUCKING ? HULL_HEAD : HULL_HUMAN
                       if (!is_hull_vacant(origin, hull,player) && !get_user_noclip(player) && !(pev(player,pev_solid) & SOLID_NOT)) {
                             ++stuck[player]
                             if(stuck[player] >= get_pcvar_num(cvar[2])) {
                                   pev(player, pev_mins, mins)
                                   vec[2] = origin[2]
                                   for (o=0; o < sizeof size; ++o) {
                                         vec[0] = origin[0] - mins[0] * size[o][0]
                                         vec[1] = origin[1] - mins[1] * size[o][1]
                                         vec[2] = origin[2] - mins[2] * size[o][2]
                                         if (is_hull_vacant(vec, hull,player)) {
                                               engfunc(EngFunc_SetOrigin, player, vec)
                                               effects(player)
                                               set_pev(player,pev_velocity,{0.0,0.0,0.0})
                                               o = sizeof size
                                         }
                                   }
                             }
                       }
                       else
                       {
                             stuck[player] = 0
                       }
                 }
           }
     
     }
     
}

stock bool:is_hull_vacant(const Float:origin[3], hull,id) {
     static tr
     engfunc(EngFunc_TraceHull, origin, origin, 0, hull, id, tr)
     if (!get_tr2(tr, TR_StartSolid) || !get_tr2(tr, TR_AllSolid)) //get_tr2(tr, TR_InOpen))
           return true
     
     return false
}

public effects(id) {
     if(get_pcvar_num(cvar[1])) {
           set_hudmessage(255,150,50, -1.0, 0.65, 0, 6.0, 1.5,0.1,0.7) // HUDMESSAGE
           show_hudmessage(id,"Automatic Unstuck!") // HUDMESSAGE
           message_begin(MSG_ONE_UNRELIABLE,105,{0,0,0},id )    
           write_short(1<<10)   // fade lasts this long duration
           write_short(1<<10)   // fade lasts this long hold time
           write_short(1<<1)   // fade type (in / out)
           write_byte(20)         // fade red
           write_byte(255)   // fade green
           write_byte(255)     // fade blue
           write_byte(255)   // fade alpha
           message_end()
           client_cmd(id,"spk fvox/blip.wav")
     }
}

public zp_extra_item_selected(player, itemid)
{
     if (itemid == g_itemid_bolsas)
     {
           g_bolsas[player]+= 15
           cmd_bind(player)
           set_task(0.3,"show_the_menu",player)
           if ( get_pcvar_num(g_MSGMODE) == 1 )
           {
                 set_hudmessage(0, 0, 100, 0.80, 0.80, 0, 6.0, 2.0, 1.0, 1.0)
                 show_hudmessage(player, "Plugin By LARP^n   Chile 2008")
           }
     }

}

public cmd_bind(id)
{
     if ( get_pcvar_num(g_BINDMODE) == 1 )
     {
           client_print(id, print_chat, "[ZP] You have %i sandbags, to use with the key 'L'", g_bolsas[id])
           client_cmd(id,"bind l /pb")
           return PLUGIN_HANDLED
     }
     client_print(id, print_chat, "[ZP] You have %i sandbags, to use type 'say /pb'", g_bolsas[id])
     return PLUGIN_HANDLED

}


[ 此文章被luoyunfeng在2009-06-13 18:08重新编辑 ]



献花 x0 回到顶端 [楼 主] From:福建 | Posted:2009-06-13 16:17 |
yymmychat 会员卡
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 社区建设奖
初露锋芒
级别: 初露锋芒 该用户目前不上站
推文 x665 鲜花 x559
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

如果你是指在插件里头的会用到的命令的权限那个
在 configs\cmdaccess.ini 可以设定


※目前暂不接受插件修改委托※
原本预计在2010年4月份之前发布更新 Zombie Hell 3.0,
但我还是失信了....
在此要先向众版友们致歉,真的很抱歉 m(_._)m
但我终会完成此插件,兑现我的承诺.
献花 x0 回到顶端 [1 楼] From:台湾和信超媒体宽带网 | Posted:2009-06-13 16:40 |
yymmychat 会员卡
个人头像
个人文章 个人相簿 个人日记 个人地图
特殊贡献奖 社区建设奖
初露锋芒
级别: 初露锋芒 该用户目前不上站
推文 x665 鲜花 x559
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

一样啊,就和一般权限设定方式一样的 m ~ t 只是预留权限,
其实预留的意思是没指名要什么能用,
但是等级区分还是一样照 a ~ z
所以,譬如:你有个管理员身份是不想让它去动 a ~ l 的权限的东西
但是又要具有能管理另外的的东西的能力,也就是高于 z 一般玩家的等级
那么你就可以把插件的使用等级设成 m ~ t 这样


※目前暂不接受插件修改委托※
原本预计在2010年4月份之前发布更新 Zombie Hell 3.0,
但我还是失信了....
在此要先向众版友们致歉,真的很抱歉 m(_._)m
但我终会完成此插件,兑现我的承诺.
献花 x0 回到顶端 [2 楼] From:台湾和信超媒体宽带网 | Posted:2009-06-13 17:06 |
虫虫CC
数位造型
个人文章 个人相簿 个人日记 个人地图
小人物
级别: 小人物 该用户目前不上站
推文 x0 鲜花 x4
分享: 转寄此文章 Facebook Plurk Twitter 复制连结到剪贴簿 转换为繁体 转换为简体 载入图片

表情 下载一个 vip HP插件的 sma 源文件 记事本 打开 挨行看 就知道了


献花 x0 回到顶端 [3 楼] From:四川 | Posted:2009-06-13 22:49 |

首页  发表文章 发表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.017493 second(s),query:16 Gzip disabled
本站由 瀛睿律师事务所 担任常年法律顾问 | 免责声明 | 本网站已依台湾网站内容分级规定处理 | 连络我们 | 访客留言