man2008 发表于 2022-7-12 13:50:15

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

/*================================================================================
* 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

man2008 发表于 2022-7-12 14:07:06

2楼是全的源码,大神们帮个忙!万分感谢!

man2008 发表于 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

public plugin_init()
{
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
       
        new cvar_string
        for (new i = 0; i < sizeof weapon_classname; i++)
        {
                if (strlen(weapon_classname) == 0)
                        continue;
               
                formatex(cvar_string, charsmax(cvar_string), "weap_%s_recoil", weapon_classname)
                g_weap_recoil = register_cvar(cvar_string, weapon_recoil)
               
                RegisterHam(Ham_Weapon_PrimaryAttack, weapon_classname, "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)
       
        //if (multiplier == -1.0)
        if (multiplier < 0.0)
                return HAM_IGNORED;
       
        new Float:punchangle
        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)
       
        //if (multiplier == -1.0)
        if (multiplier < 0.0)
                return HAM_IGNORED;
       
        new Float:punchangle
        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);
}

wangjialin 发表于 2022-7-14 19:06:37

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

#define PLUGIN_NAME "Weapon Recoil Set"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "Jim"

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


const m_weapId = 43
const OFFSET_LINUX_WEAPONS = 4

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[][] = { "", "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" }

new g_weap_recoil

public plugin_init()
{
        register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
        new cvar_string
        for (new i = 0; i < sizeof weapon_classname; i++)
        {
                if (strlen(weapon_classname) == 0)
                        continue;
                formatex(cvar_string, charsmax(cvar_string), "weap_%s_recoil", weapon_classname)
                g_weap_recoil = register_cvar(cvar_string, weapon_recoil)
                RegisterHam(Ham_Weapon_PrimaryAttack, weapon_classname, "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)
        if(has_all_flags(owner,Access)== 0)
                return HAM_IGNORED;
        if (multiplier < 0.0)
                return HAM_IGNORED;
        new Float:punchangle
        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);
}


欢迎加群:923526724
页: [1]
查看完整版本: 大神在不?帮忙给这个插件加个m权限!谢!