搜索
查看: 3333|回复: 3

修改DOD自由换枪插件

[复制链接]
发表于 2008-11-21 00:48:31 | 显示全部楼层 |阅读模式 来自 中国–山东–东营
/*
Weapons Mod 2.0
Brought to you by TooLz
Special thanks to DoDPlugins.net for providing the wonderful community!
*/
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <dodx>
#include <fakemeta>
#define MAXWEAPON 23
new got_weapon[32], Weapon_Name[33][32]
enum WeaponData {
WMOD_Weapon,
WMOD_SayCmd[32],
WMOD_Disabled[32]
}
new WEAPON[MAXWEAPON][WeaponData] = {
{DODW_KAR,"k98","amx_disable_k98"},     //0
{DODW_GARAND,"garand","amx_disable_garand"},    //1
{DODW_K43,"k43","amx_disablek43"},     //2
{DODW_M1_CARBINE,"carbine","amx_disable_carbine"},   //3
{DODW_MP40,"mp40","amx_disable_mp40"},     //4
{DODW_THOMPSON,"thompson","amx_disable_thompson"},   //5
{DODW_STG44,"stg44","amx_disable_stg44"},    //6
{DODW_GREASEGUN,"greasegun","amx_disable_greasegun"},   //7
{DODW_SCOPED_KAR,"scopedk98","amx_disable_scopedk98"},   //8
{DODW_SPRINGFIELD,"springfield","amx_disable_springfield"},  //9
{DODW_MG34,"mg34","amx_disable_mg34"},     //10
{DODW_BAR,"bar","amx_disable_bar"},     //11
{DODW_MG42,"mg42","amx_disable_mg42"},     //12
{DODW_30_CAL,"30cal","amx_disable_30cal"},    //13
{DODW_PANZERSCHRECK,"panzerschreck","amx_disable_panzerschreck"}, //14
{DODW_BAZOOKA,"bazooka","amx_disable_bazooka"},    //15
{DODW_ENFIELD,"enfield","amx_disable_enfield"},    //16
{DODW_STEN,"sten","amx_disable_sten"},     //17
{DODW_BREN,"bren","amx_disable_bren"},     //18
{DODW_PIAT,"piat","amx_disable_piat"},     //19
{DODW_FG42,"fg42","amx_disable_fg42"},     //20
{DODW_SCOPED_FG42,"scopedfg42","amx_disable_scopedfg42"},  //21
{DODW_SCOPED_ENFIELD,"scopedenfield","amx_disable_scopedenfield"} //22
}
public plugin_init()
{
register_plugin("Weapons Mod 2.0","2.0","TooLz")
register_event("ResetHUD","respawn","be")
register_clcmd("say","cmdSay",0,"- Checks which weapon was said")
register_cvar("amx_weapon_changes", "2")
register_cvar("amx_disable_scopedfg42","0")
register_cvar("amx_disable_scopedenfield","0")
register_cvar("amx_disable_k98", "0")
register_cvar("amx_disable_garand", "0")
register_cvar("amx_disable_carbine", "0")
register_cvar("amx_disable_k43", "0")
register_cvar("amx_disable_mp40", "0")
register_cvar("amx_disable_thompson", "0")
register_cvar("amx_disable_stg44", "0")
register_cvar("amx_disable_bar", "0")
register_cvar("amx_disable_fg42", "0")
register_cvar("amx_disable_greasegun", "0")
register_cvar("amx_disable_bazooka", "0")
register_cvar("amx_disable_enfield", "0")
register_cvar("amx_disable_sten", "0")
register_cvar("amx_disable_mg42", "0")
register_cvar("amx_disable_mg34", "0")
register_cvar("amx_disable_30cal", "0")
register_cvar("amx_disable_springfield", "0")
register_cvar("amx_disable_scopedk98", "0")
register_cvar("amx_disable_bren", "0")
register_cvar("amx_disable_panzerschreck", "0")
register_cvar("amx_disable_piat", "0")
}
public respawn(id){
got_weapon[id] = 0
}
stock detect_weapon_id(id) {
// Big thanks to Wilson for this stock!
new m_iCurEnt = -1, m_iWpnEnt = 0, m_szWpn[32];
new clip, ammo, m_iWpn = get_user_weapon(id,clip,ammo);
xmod_get_wpnlogname(m_iWpn, m_szWpn, 31);
format(m_szWpn, 31, "weapon_%s", m_szWpn);
if(equal(m_szWpn, "weapon_scoped_enfield")) m_szWpn = "weapon_enfield";
if(equal(m_szWpn, "weapon_scoped_fg42")) m_szWpn = "weapon_fg42";
new Float:m_flOrigin[3];
pev(id, pev_origin, m_flOrigin);
while((m_iCurEnt = engfunc(EngFunc_FindEntityInSphere, m_iCurEnt, m_flOrigin, Float:1.0)) != 0) {
  new m_szClassname[32];
  pev(m_iCurEnt, pev_classname, m_szClassname, 31);
  if(equal(m_szClassname, m_szWpn))
   m_iWpnEnt = m_iCurEnt;
}
return m_iWpnEnt;
}
stock cmdWeapon(WeaponID, WeaponName[32]) {
xmod_get_wpnlogname(WeaponID, WeaponName, 31);
format(WeaponName, 31, "weapon_%s", WeaponName);
}
stock dod_get_scoped(id) {
    new m_iCurEnt = -1, m_iWpnEnt = 0, m_szWpn[32];
    new clip, ammo, m_iWpn = get_user_weapon(id,clip,ammo);
    new is_scoped
    xmod_get_wpnlogname(m_iWpn, m_szWpn, 31);
    format(m_szWpn, 31, "weapon_%s", m_szWpn);
    if(equal(m_szWpn, "weapon_scoped_enfield")) m_szWpn = "weapon_enfield";
    if(equal(m_szWpn, "weapon_scoped_fg42")) m_szWpn = "weapon_fg42";
    new Float:m_flOrigin[3];
    pev(id, pev_origin, m_flOrigin);
    while((m_iCurEnt = engfunc(EngFunc_FindEntityInSphere, m_iCurEnt, m_flOrigin, Float:1.0)) != 0) {
        new m_szClassname[32];
        pev(m_iCurEnt, pev_classname, m_szClassname, 31);
        if(equal(m_szClassname, m_szWpn))
            m_iWpnEnt = m_iCurEnt;
    }
    is_scoped = get_pdata_int(m_iWpnEnt,115,4);
    return is_scoped;
}
public cmdMakeScoped(id){
new is_scoped = dod_get_scoped(id)
while(is_scoped != 1){
  is_scoped = dod_get_scoped(id)
  set_pdata_int(detect_weapon_id(id),115,1,4)
}
client_cmd(id,"slot2;wait;slot3")
}
public cmdGiveWeapon(id){
if (!equali(Weapon_Name[id],"weapon_scoped_fg42") && !equali(Weapon_Name[id], "weapon_scoped_enfield")){
  give_item(id,Weapon_Name[id])
}
if(equali(Weapon_Name[id],"weapon_scoped_fg42")){
  give_item(id,"weapon_fg42")
  set_task(0.2,"cmdMakeScoped",id)
}
if(equali(Weapon_Name[id],"weapon_scoped_enfield")){
  give_item(id,"weapon_enfield")
  set_task(0.2,"cmdMakeScoped",id)
}
got_weapon[id]++
}
public cmdSay(id) {
new said[32]
read_argv(1,said,31)
if(said[0] != '/')
  return PLUGIN_CONTINUE;
for(new i = 0 ; i < MAXWEAPON ; i++) {
  if(equali(said[1],WEAPON[WMOD_SayCmd])) {
   if(get_cvar_num(WEAPON[WMOD_Disabled]) != 0){
    client_print(id,print_chat, "[Weapons Mod 2.0] This weapon is disabled on this server.")
    return PLUGIN_HANDLED
   }
   if (got_weapon[id] == get_cvar_num("amx_weapon_changes")){
    client_print(id,print_chat, "[Weapons Mod 2.0] You've used up your gun changes, you must wait until respawn to change guns again.")
    return PLUGIN_HANDLED
   }
   cmdWeapon(WEAPON[WMOD_Weapon],Weapon_Name[id])
   client_cmd(id, "drop")
   set_task(0.3,"cmdGiveWeapon", id)
   break;
  }
}
return PLUGIN_HANDLED
}


想修改成 如果是会员才可以换枪,并提示换枪成功,否则就提示你不是会员无法换枪,谢谢各位
 楼主| 发表于 2008-11-23 20:30:34 | 显示全部楼层 来自 中国–山东–东营

回复: 修改DOD自由换枪插件

再次恳请高人指点一二
回复

使用道具 举报

 楼主| 发表于 2008-11-27 10:22:13 | 显示全部楼层 来自 中国–山东–东营

回复: 修改DOD自由换枪插件

再次恳请斑竹指点,谢谢
回复

使用道具 举报

发表于 2011-3-1 21:55:02 | 显示全部楼层 来自 中国–广东–江门
这个是什么,请高手指点,我想问的是更换P模型怎么弄,要什么插件,如果单单替换模型的话说模型不一致导致断开连接+QQ314205702
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表