I've been trying to recreate the CSO 's SPAS12 using the M3 as a base
Now I am using dias' weapon base and I learned AMXX quite a bit from his code, however...
In trying to create a shotgun reload I've ran into some issues
- I cannot seem to figure out how to get an animation to play before the shell insert loop
- I cannot seem to keep the clip limit from going over.
To explain #2 better, I have the clip size at 6
So it begins to reload, and as soon as it reaches 6, it quickly runs to 7 then 8 in just a few frames, as if it were the M3's clip
Code:
public fw_Ham_Reload(ent)
{
if(!pev_valid(ent))
return HAM_IGNORED
new id
id = pev(ent, pev_owner)
if(!is_user_alive(id) || !g_had_spas12[id])
return HAM_IGNORED
g_spas12_clip[id] = -1
new bpammo = cs_get_user_bpammo(id, CSW_SPAS12)
if (bpammo <= 0)
return HAM_SUPERCEDE
new iClip = get_pdata_int(ent, 51, 4)
if(iClip >= get_pcvar_num(cvar_default_clip))
return HAM_SUPERCEDE
g_spas12_clip[id] = iClip
g_spas12_reload[id] = 1
return HAM_IGNORED
}
public fw_Ham_Reload_Post(ent)
{
if(!pev_valid(ent))
return HAM_IGNORED
new id
id = pev(ent, pev_owner)
if(!is_user_alive(id) || !g_had_spas12[id])
return HAM_IGNORED
if (g_spas12_clip[id] == -1)
return HAM_IGNORED
set_pdata_int(ent, 51, g_spas12_clip[id], 4)
set_pdata_float(ent, 48, 0.534, 4)
set_pdata_float(id, 83, 0.534, 5)
set_pdata_int(ent, 55, 1, 4)
set_weapon_anim(id, ANIM_INSERT)
return HAM_IGNORED
}
public fw_Ham_PostFrame(ent)
{
if(!pev_valid(ent))
return HAM_IGNORED
new id
id = pev(ent, pev_owner)
if(!is_user_alive(id) || !g_had_spas12[id])
return HAM_IGNORED
new Float:flNextAttack = get_pdata_float(id, 83, 5)
new bpammo = cs_get_user_bpammo(id, CSW_SPAS12)
new iClip = get_pdata_int(ent, 51, 4)
new fInReload = get_pdata_int(ent, 55, 4)
if(fInReload && flNextAttack <= 0.0)
{
set_pdata_int(ent, 51, iClip + 1, 4)
cs_set_user_bpammo(id, CSW_SPAS12, bpammo - 1)
fInReload = 0
g_spas12_reload[id] = 0
set_weapon_anim(id, ANIM_AFTER_RELOAD)
}
return HAM_IGNORED
}
I feel as if I don't get how postframe works with special/shotgun reload
I should probably send the file instead bleh
10 days? Jeez, the only thing I've been able to do is narrow down the cause to postframe.