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 |
|
|
|