搜索
查看: 3277|回复: 3

大神在不?帮忙给这个插件加个m权限!谢!

[复制链接]
发表于 2022-7-12 13:50:15 | 显示全部楼层 |阅读模式 来自 美国–加利福尼亚州–洛杉矶–洛杉矶
/*================================================================================
* Please don't change plugin register information.

CS武器後座力設定

[設定變數]                [預設值]
weap_p228_recoil        -1.0
weap_scout_recoil        -1.0
weap_xm1014_recoil        -1.0
weap_mac10_recoil        -1.0
weap_aug_recoil                -1.0
weap_elite_recoil        -1.0
weap_fiveseven_recoil        -1.0
weap_ump45_recoil        -1.0
weap_sg550_recoil        -1.0
weap_galil_recoil        -1.0
weap_famas_recoil        -1.0
weap_usp_recoil                -1.0
weap_glock18_recoil        -1.0
weap_awp_recoil                -1.0
weap_mp5navy_recoil        -1.0
weap_m249_recoil        -1.0
weap_m3_recoil                -1.0
weap_m4a1_recoil        -1.0
weap_tmp_recoil                -1.0
weap_g3sg1_recoil        -1.0
weap_deagle_recoil        -1.0
weap_sg552_recoil        -1.0
weap_ak47_recoil        -1.0
weap_p90_recoil                -1.0

================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

// plugin's main information
#define PLUGIN_NAME "Weapon Recoil Set"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "Jim"

// Weapons Offsets
const m_weapId = 43
const OFFSET_LINUX_WEAPONS = 4

// Weapons calssname
new const weapon_classname[][] = { "", "weapon_p228", "", "weapon_scout", "", "weapon_xm1014", "", "weapon_mac10",
        "weapon_aug", "", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas",
        "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1",
        "weapon_tmp", "weapon_g3sg1", "", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_p90" }

// Recoil set (正常後座力=1.0 , 後座力減半=0.5 , 無後座力=0.0 , 無設定=-1.0)
new const weapon_recoil[][] = {
        "-1.0",        //-----
        "-1.0",        //p228
        "-1.0",        //-----
        "-1.0",        //scout
        "-1.0",        //-----
        "-1.0",        //xm1014
        "-1.0",        //-----
        "-1.0",        //mac10
        "-1.0",        //aug
        "-1.0",        //-----
        "-1.0",        //elites
        "-1.0",        //fiveseven
        "-1.0",        //ump45
        "-1.0",        //sg550
        "-1.0",        //galil
        "-1.0",        //famas
        "-1.0",        //usp
        "-1.0",        //glock
        "-1.0",        //awp
        "-1.0",        //mp5navy
        "-1.0",        //m249
        "-1.0",        //m3
        "-1.0",        //m4a1
        "-1.0",        //tmp
        "-1.0",        //g3sg1
        "-1
 楼主| 发表于 2022-7-12 14:07:06 | 显示全部楼层 来自 美国
2楼是全的源码,大神们帮个忙!万分感谢!
回复 0 1

使用道具 举报

 楼主| 发表于 2022-7-12 14:04:33 | 显示全部楼层 来自 美国

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

// plugin's main information
#define PLUGIN_NAME "Weapon Recoil Set"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "Jim"

// Weapons Offsets
const m_weapId = 43
const OFFSET_LINUX_WEAPONS = 4

// Weapons calssname
new const weapon_classname[][] = { "", "weapon_p228", "", "weapon_scout", "", "weapon_xm1014", "", "weapon_mac10",
        "weapon_aug", "", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas",
        "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1",
        "weapon_tmp", "weapon_g3sg1", "", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_p90" }

// Recoil set (正常後座力=1.0 , 後座力減半=0.5 , 無後座力=0.0 , 無設定=-1.0)
new const weapon_recoil[][] = {
        "-1.0",        //-----
        "-1.0",        //p228
        "-1.0",        //-----
        "-1.0",        //scout
        "-1.0",        //-----
        "-1.0",        //xm1014
        "-1.0",        //-----
        "-1.0",        //mac10
        "-1.0",        //aug
        "-1.0",        //-----
        "-1.0",        //deagle
        "-1.0",        //sg552
        "-1.0",        //ak47
        "-1.0"        //p90
}

new g_weap_recoil[sizeof weapon_classname]

public plugin_init()
{
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
       
        new cvar_string[32]
        for (new i = 0; i < sizeof weapon_classname; i++)
        {
                if (strlen(weapon_classname[i]) == 0)
                        continue;
               
                formatex(cvar_string, charsmax(cvar_string), "weap_%s_recoil", weapon_classname[i][7])
                g_weap_recoil[i] = register_cvar(cvar_string, weapon_recoil[i])
               
                RegisterHam(Ham_Weapon_PrimaryAttack, weapon_classname[i], "fw_WeapPriAttack", 1)
        }
}

public fw_WeapPriAttack(weapon)
{
        static owner
        owner = pev(weapon, pev_owner)
       
        static weap_id
        weap_id = fm_get_weaponid(weapon)
       
        static Float:multiplier
        multiplier = get_pcvar_float(g_weap_recoil[weap_id])
       
        //if (multiplier == -1.0)
        if (multiplier < 0.0)
                return HAM_IGNORED;
       
        new Float:punchangle[3]
        pev(owner, pev_punchangle, punchangle)
        xs_vec_mul_scalar(punchangle, multiplier, punchangle)
        set_pev(owner, pev_punchangle, punchangle)
       
        return HAM_IGNORED;
}

stock fm_get_weaponid(entity)
{
        return get_pdata_int(entity, m_weapId, OFFSET_LINUX_WEAPONS);
}
public fw_WeapPriAttack(weapon)
{
        static owner
        owner = pev(weapon, pev_owner)
       
        static weap_id
        weap_id = fm_get_weaponid(weapon)
       
        static Float:multiplier
        multiplier = get_pcvar_float(g_weap_recoil[weap_id])
       
        //if (multiplier == -1.0)
        if (multiplier < 0.0)
                return HAM_IGNORED;
       
        new Float:punchangle[3]
        pev(owner, pev_punchangle, punchangle)
        xs_vec_mul_scalar(punchangle, multiplier, punchangle)
        set_pev(owner, pev_punchangle, punchangle)
       
        return HAM_IGNORED;
}

stock fm_get_weaponid(entity)
{
        return get_pdata_int(entity, m_weapId, OFFSET_LINUX_WEAPONS);
}
回复

使用道具 举报

发表于 2022-7-14 19:06:37 | 显示全部楼层 来自 美国
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #include <hamsandwich>
  5. #include <xs>

  6. #define PLUGIN_NAME "Weapon Recoil Set"
  7. #define PLUGIN_VERSION "1.0"
  8. #define PLUGIN_AUTHOR "Jim"

  9. #define        Access        "m"        //权限代码


  10. const m_weapId = 43
  11. const OFFSET_LINUX_WEAPONS = 4

  12. new const weapon_classname[][] = { "", "weapon_p228", "", "weapon_scout", "", "weapon_xm1014", "", "weapon_mac10",
  13.         "weapon_aug", "", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas",
  14.         "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1",
  15.         "weapon_tmp", "weapon_g3sg1", "", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_p90" }

  16. // Recoil set (正常後座力=1.0 , 後座力減半=0.5 , 無後座力=0.0 , 無設定=-1.0)
  17. new const weapon_recoil[][] = { "", "0.5", "", "0.5", "", "0.5", "", "0.5",
  18.         "0.5", "", "0.5", "0.5", "0.5", "0.5", "0.5", "0.5",
  19.         "0.5", "0.5", "0.5", "0.5", "0.5", "0.5", "0.5",
  20.         "0.5", "0.5", "", "0.5", "0.5", "0.5", "0.5" }

  21. new g_weap_recoil[sizeof weapon_classname]

  22. public plugin_init()
  23. {
  24.         register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
  25.         new cvar_string[32]
  26.         for (new i = 0; i < sizeof weapon_classname; i++)
  27.         {
  28.                 if (strlen(weapon_classname[i]) == 0)
  29.                         continue;
  30.                 formatex(cvar_string, charsmax(cvar_string), "weap_%s_recoil", weapon_classname[i][7])
  31.                 g_weap_recoil[i] = register_cvar(cvar_string, weapon_recoil[i])
  32.                 RegisterHam(Ham_Weapon_PrimaryAttack, weapon_classname[i], "fw_WeapPriAttack", 1)
  33.         }
  34. }

  35. public fw_WeapPriAttack(weapon)
  36. {
  37.         static owner
  38.         owner = pev(weapon, pev_owner)
  39.         static weap_id
  40.         weap_id = fm_get_weaponid(weapon)
  41.         static Float:multiplier
  42.         multiplier = get_pcvar_float(g_weap_recoil[weap_id])
  43.         if(has_all_flags(owner,Access)== 0)
  44.                 return HAM_IGNORED;
  45.         if (multiplier < 0.0)
  46.                 return HAM_IGNORED;
  47.         new Float:punchangle[3]
  48.         pev(owner, pev_punchangle, punchangle)
  49.         xs_vec_mul_scalar(punchangle, multiplier, punchangle)
  50.         set_pev(owner, pev_punchangle, punchangle)
  51.         return HAM_IGNORED;
  52. }

  53. stock fm_get_weaponid(entity)
  54. {
  55.         return get_pdata_int(entity, m_weapId, OFFSET_LINUX_WEAPONS);
  56. }
复制代码



欢迎加群:923526724
回复

使用道具 举报

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

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