Half-fixed at post #5
Two issues.
1) rg_fire_bullets3 and rg_fire_buckshots (rg_fire_bullets too)are not working aren't creating decals.
They do nothing.
2) Also hooks (recently added https://github.com/s1lentq/reapi/pull/202) are returning the value of pEntity same as pevAttacker value.
Seems to be a game mistake?
So, we have pevAttacker value two times.
Or probably is a mistake on documentation? https://github.com/s1lentq/reapi/blob/master/reapi/src/natives/natives_misc.cpp#L373
Test code (hook and natives):
Two issues.
1) rg_fire_bullets3 and rg_fire_buckshots (rg_fire_bullets too)
2) Also hooks (recently added https://github.com/s1lentq/reapi/pull/202) are returning the value of pEntity same as pevAttacker value.
Seems to be a game mistake?
So, we have pevAttacker value two times.
Or probably is a mistake on documentation? https://github.com/s1lentq/reapi/blob/master/reapi/src/natives/natives_misc.cpp#L373
Test code (hook and natives):
- Shot with a weapon. See console output. pEntity = pevAttacker
- Then type '/test' with any weapon (except shotguns).
- Decals aren't created.
TraceAttack isn't called, etc(https://github.com/s1lentq/ReGameDL...4b725d30/regamedll/dlls/cbase.cpp#L1242#L1466) - See output again, hook is well called. So? Why isn't working?
Код:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <reapi>
public plugin_init()
{
register_clcmd("say /test", "clcmd_saytest")
// weapons except shotguns
RegisterHookChain(RG_CBaseEntity_FireBullets3, "RG_CBaseEntity_FireBullets3_pre", 0);
RegisterHookChain(RG_CBaseEntity_FireBullets3, "RG_CBaseEntity_FireBullets3_post", 1);
// only shotguns
RegisterHookChain(RG_CBaseEntity_FireBuckshots, "RG_CBaseEntity_FireBuckshots_pre", 0);
RegisterHookChain(RG_CBaseEntity_FireBuckshots, "RG_CBaseEntity_FireBuckshots_post", 1);
// don't know
RegisterHookChain(RG_CBaseEntity_FireBullets, "RG_CBaseEntity_FireBullets_pre", 0);
RegisterHookChain(RG_CBaseEntity_FireBullets, "RG_CBaseEntity_FireBullets_post", 1);
}
public clcmd_saytest(id)
{
fireBullets3(id)
}
fireBullets3(pevOwner)
{
new this = get_member(pevOwner, m_pActiveItem);
new Float:vecSrc[3], Float:vecDir[3];
ExecuteHam(Ham_Player_GetGunPosition, pevOwner, vecSrc);
global_get(glb_v_forward, vecDir);
new Float:flBurstSpread = get_member(this, m_Weapon_fBurstSpread);
new iRandomSeed = get_member(pevOwner, random_seed);
rg_fire_bullets3(this, pevOwner, vecSrc, vecDir, flBurstSpread, 8192.0, 5, BULLET_PLAYER_762MM, 32, 8.0, false, iRandomSeed);
// that's how hook is been called by game (wrong 1st parameter?)
//rg_fire_bullets3(pevOwner, pevOwner, vecSrc, vecDir, flBurstSpread, 8192.0, 5, BULLET_PLAYER_762MM, 32, 8.0, false, iRandomSeed);
//new Float:flSpread[3]
//rg_fire_buckshots(this, pevOwner, 1, vecSrc, vecDir, flSpread, 8192.0, 0, 10)
//rg_fire_bullets(this, pevOwner, 1, vecSrc, vecDir, flSpread, 8192.0, BULLET_PLAYER_762MM, 0, 10)
}
public RG_CBaseEntity_FireBullets3_pre(pEntity, Float:vecSrc[3], Float:vecDirShooting[3], Float:vecSpread, Float:flDistance, iPenetration, iBulletType, iDamage, Float:flRangeModifier, pevAttacker, bool:bPistol, shared_rand)
{
server_print("RG_CBaseEntity_FireBullets3_pre: pEntity %i, Float:vecSrc[3] {%f, %f, %f}, Float:vecDirShooting[3] {%f, %f, %f}, Float:vecSpread %f, ",
pEntity, vecSrc[0], vecSrc[1], vecSrc[2], vecDirShooting[0], vecDirShooting[1], vecDirShooting[2], vecSpread);
server_print("Float:flDistance %f, iPenetration %i, iBulletType %i, iDamage %i, Float:flRangeModifier %f, pevAttacker %i, bool:bPistol %i, shared_rand %i",
flDistance, iPenetration, iBulletType, iDamage, flRangeModifier, pevAttacker, bPistol, shared_rand);
}
public RG_CBaseEntity_FireBullets3_post(pEntity, Float:vecSrc[3], Float:vecDirShooting[3], Float:vecSpread, Float:flDistance, iPenetration, iBulletType, iDamage, Float:flRangeModifier, pevAttacker, bool:bPistol, shared_rand)
{
server_print("RG_CBaseEntity_FireBullets3_post: pEntity %i, Float:vecSrc[3] {%f, %f, %f}, Float:vecDirShooting[3] {%f, %f, %f}, Float:vecSpread %f, ",
pEntity, vecSrc[0], vecSrc[1], vecSrc[2], vecDirShooting[0], vecDirShooting[1], vecDirShooting[2], vecSpread);
server_print("Float:flDistance %f, iPenetration %i, iBulletType %i, iDamage %i, Float:flRangeModifier %f, pevAttacker %i, bool:bPistol %i, shared_rand %i",
flDistance, iPenetration, iBulletType, iDamage, flRangeModifier, pevAttacker, bPistol, shared_rand);
}
public RG_CBaseEntity_FireBuckshots_pre(pEntity, cShots, Float:vecSrc[3], Float:vecDirShooting[3], Float:vecSpread[3], Float:flDistance, iTracerFreq, iDamage, pevAttacker)
{
server_print("RG_CBaseEntity_FireBuckshots_pre: pEntity %i, cShots %i, Float:vecSrc[3] {%f, %f, %f}, Float:vecDirShooting[3] {%f, %f, %f}, Float:vecSpread[3] {%f, %f, %f}, ",
pEntity, cShots, vecSrc[0], vecSrc[1], vecSrc[2], vecDirShooting[0], vecDirShooting[1], vecDirShooting[2], vecSpread[0], vecSpread[1], vecSpread[2]);
server_print("Float:flDistance %f, iTracerFreq %i, iDamage %i, pevAttacker %i",
flDistance, iTracerFreq, iDamage, pevAttacker);
}
public RG_CBaseEntity_FireBuckshots_post(pEntity, cShots, Float:vecSrc[3], Float:vecDirShooting[3], Float:vecSpread[3], Float:flDistance, iTracerFreq, iDamage, pevAttacker)
{
server_print("RG_CBaseEntity_FireBuckshots_post: pEntity %i, cShots %i, Float:vecSrc[3] {%f, %f, %f}, Float:vecDirShooting[3] {%f, %f, %f}, Float:vecSpread[3] {%f, %f, %f}, ",
pEntity, cShots, vecSrc[0], vecSrc[1], vecSrc[2], vecDirShooting[0], vecDirShooting[1], vecDirShooting[2], vecSpread[0], vecSpread[1], vecSpread[2]);
server_print("Float:flDistance %f, iTracerFreq %i, iDamage %i, pevAttacker %i",
flDistance, iTracerFreq, iDamage, pevAttacker);
}
public RG_CBaseEntity_FireBullets_pre(pEntity, cShots, Float:vecSrc[3], Float:vecDirShooting[3], Float:vecSpread[3], Float:flDistance, iBulletType, iTracerFreq, iDamage, pevAttacker)
{
server_print("RG_CBaseEntity_FireBullets_pre: pEntity %i, cShots %i, Float:vecSrc[3] {%f, %f, %f}, Float:vecDirShooting[3] {%f, %f, %f}, Float:vecSpread[3] {%f, %f, %f}, ",
pEntity, cShots, vecSrc[0], vecSrc[1], vecSrc[2], vecDirShooting[0], vecDirShooting[1], vecDirShooting[2], vecSpread[0], vecSpread[1], vecSpread[2]);
server_print("Float:flDistance %f, iBulletType %i, iTracerFreq %i, iDamage %i, pevAttacker %i",
flDistance, iBulletType, iTracerFreq, iDamage, pevAttacker);
}
public RG_CBaseEntity_FireBullets_post(pEntity, cShots, Float:vecSrc[3], Float:vecDirShooting[3], Float:vecSpread[3], Float:flDistance, iBulletType, iTracerFreq, iDamage, pevAttacker)
{
server_print("RG_CBaseEntity_FireBullets_post: pEntity %i, cShots %i, Float:vecSrc[3] {%f, %f, %f}, Float:vecDirShooting[3] {%f, %f, %f}, Float:vecSpread[3] {%f, %f, %f}, ",
pEntity, cShots, vecSrc[0], vecSrc[1], vecSrc[2], vecDirShooting[0], vecDirShooting[1], vecDirShooting[2], vecSpread[0], vecSpread[1], vecSpread[2]);
server_print("Float:flDistance %f, iBulletType %i, iTracerFreq %i, iDamage %i, pevAttacker %i",
flDistance, iBulletType, iTracerFreq, iDamage, pevAttacker);
}
Последнее редактирование: