a7811311622
我…在工作了…
级别: 版主
版区: CS提问区
x771
x2152
|
分享:
▲
▼
下面是引用 chuchung712 于 2010-07-18 16:51 发表的 : 因为大神的改后座力插件是 复制程式
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_???", "fw_WeapPriAttack")
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_???", "fw_WeapPriAttack_Post", 1) 所以我把,1拿掉了... 有关系的吗? 大神的改后座力是这样的吗…?你该不会是搞错插件了吧…? 我手边大神的插件是这样耶: 复制程式
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)
}
}
把那最重要的「, 1」拿掉当然有关系…<hamsandwich.inc>有注明: /** * Hooks the virtual table for the specified entity class. * An example would be: RegisterHam(Ham_TakeDamage, "player", "player_hurt"); * Look at the Ham enum for parameter lists. * * @param function The function to hook. * @param EntityClass The entity classname to hook. * @param callback The forward to call. * @param post Whether or not to forward this in post. * @return Returns a handle to the forward. Use EnableHamForward/DisableHamForward to toggle the forward on or off. */ native HamHook:RegisterHam(Ham:function, const EntityClass[], const Callback[], Post=0);
如果没写就是预设为「, 0」…这样你写在这RegisterHam里的内容会比CS预设的内容先执行… 「Ham_Weapon_PrimaryAttack」里面执行的内容也包括了「pev_punchangle」… 等同先执行「你修改pev_punchangle后的内容」后再执行「CS预设pev_punchangle的内容」… 插件的执行顺序会导致「后面的内容会覆盖掉前面的内容」… 这样你辛苦写的内容就被CS预设的内容覆盖掉了…当然没效果…
|
|
x1
[22 楼]
From:台湾中华电信 | Posted:2010-07-18 17:09 |
|
|
chuchung712
|
分享:
▲
▼
?! 莫非被骗了... ?! 我手边的改后座力: (注解是我删掉的、不想占空间太多) 复制程式
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>
// plugin's main information
#define PLUGIN_NAME "[CS] 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.0", //-----
"-1.0", //deagle
"-1.0", //sg552
"-1.0", //ak47
"-1.0", //-----
"-1.0" //p90
}
new g_weap_recoil[sizeof weapon_classname]
new Float:user_punchangle[33][3]
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")
RegisterHam(Ham_Weapon_PrimaryAttack, weapon_classname[i], "fw_WeapPriAttack_Post", 1)
}
}
public fw_WeapPriAttack(weapon)
{
if (!pev_valid(weapon))
return HAM_IGNORED;
static owner
owner = pev(weapon, pev_owner)
pev(owner, pev_punchangle, user_punchangle[owner])
return HAM_IGNORED;
}
public fw_WeapPriAttack_Post(weapon)
{
if (!pev_valid(weapon))
return HAM_IGNORED;
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_sub(punchangle, user_punchangle[owner], punchangle)
xs_vec_mul_scalar(punchangle, multiplier, punchangle)
xs_vec_add(punchangle, user_punchangle[owner], 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);
} -------------------------------------------------------------------------------- 但我本来就有加1的 为什么也没效果 话说 fw_WeapPriAttack_Post 跟 fw_WeapPriAttack 有分别的
|
没有理想的世界
|
x1
[23 楼]
From:香港有线宽频 | Posted:2010-07-18 17:24 |
|
|
a7811311622
我…在工作了…
级别: 版主
版区: CS提问区
x771
x2152
|
分享:
▲
▼
下面是引用 chuchung712 于 2010-07-18 17:24 发表的 : ?! 莫非被骗了... ?!
我手边的改后座力: (注解是我删掉的、不想占空间太多) 复制程式
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <xs>
// plugin's main information
#define PLUGIN_NAME "[CS] 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.0", //-----
"-1.0", //deagle
"-1.0", //sg552
"-1.0", //ak47
"-1.0", //-----
"-1.0" //p90
}
new g_weap_recoil[sizeof weapon_classname]
new Float:user_punchangle[33][3]
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")
RegisterHam(Ham_Weapon_PrimaryAttack, weapon_classname[i], "fw_WeapPriAttack_Post", 1)
}
}
public fw_WeapPriAttack(weapon)
{
if (!pev_valid(weapon))
return HAM_IGNORED;
static owner
owner = pev(weapon, pev_owner)
pev(owner, pev_punchangle, user_punchangle[owner])
return HAM_IGNORED;
}
public fw_WeapPriAttack_Post(weapon)
{
if (!pev_valid(weapon))
return HAM_IGNORED;
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_sub(punchangle, user_punchangle[owner], punchangle)
xs_vec_mul_scalar(punchangle, multiplier, punchangle)
xs_vec_add(punchangle, user_punchangle[owner], 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);
}
--------------------------------------------------------------------------------
但我本来就有加1的
为什么也没效果
话说 fw_WeapPriAttack_Post 跟 fw_WeapPriAttack 有分别的
不…那没错…后来发现是我的版本是旧版的…但是这不影响结果… 主要修改后座力的内容还是在「public fw_WeapPriAttack_Post(weapon)」内… 你到底最终是写成如何…列出来吧…不然我还真不知道哪边出问题了…
|
|
x1
[24 楼]
From:台湾中华电信 | Posted:2010-07-18 17:58 |
|
|
|