As you wish, my lord... This is the code that I managed to make with the aid and advices of Solokiller, of course every and each mistake here is mine, not him´s, I must left this crystal clear
In twohand.cpp
_____________[quote]void CTwohand::Reload( void )
{
//============================================================
// Inicio las pruebas del codigo para el modo RECARGA el 25 de Septiembre de 2016
//============================================================
// If playe/weapon has les than 100 bullets, let it reload.
if ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] || m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] <= 100)
{
CBaseEntity *pEntity = NULL;
while ((pEntity = UTIL_FindEntityInSphere( pEntity, m_pPlayer->pev->origin, 10000 )) != NULL)
{
if (FClassnameIs( pEntity->pev, "monstermaker"))
{
pEntity->Use( pEntity, pEntity, USE_ON, 0 );// Doubts here.
m_flNextReload = UTIL_WeaponTimeBase() + 60;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 0.5;
}
}
}
//If player have enough ammo don¥t let him reload.
if ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] || m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] >= 100)
return;
// Check to see if we're ready to reload!!Also, if player has 600 ammo play reload animation.
if ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] || m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] >= 600)
{
SendWeaponAnim( TWOHAND_RELOAD );
return;
}
}
[/quote]
In Weapons.cpp
____________[quote]
TYPEDESCRIPTION CTwohand::m_SaveData[] =
{
DEFINE_FIELD( CTwohand, m_flNextReload, FIELD_TIME ),
};
IMPLEMENT_SAVERESTORE( CTwohand, CBasePlayerWeapon );
[/quote]
In weapons.h
___________[quote]
#ifndef CLIENT_DLL
int Save( CSave &save );
int Restore( CRestore &restore );
static TYPEDESCRIPTION m_SaveData[];
#endif
float m_flNextReload;
[/quote]
Also, in my last tests I have added alerts in every part of the code that makes the monster and also in the main reload part, but, with no luck at all... In fact, I feel quite surprised that no messages appear in the console, I use the "ALERT ( at_console, "yourtexthere\n" );" thingy in every place where a "return;" appeared like gently Solokiller point me to do.
Most probably the code above is just a bunch of useless lines of bad and misplaced code, the one I have used , overall the code inside the
void CTwohand::Reload( void ) function, It was just taken from the satchel.cpp file. The last try I have made is this :
[quote]
edict_t *pPlayer = m_pPlayer->edict( );
CBaseEntity *pEntity = NULL;
while ((pEntity = UTIL_FindEntityInSphere( pEntityl, m_pPlayer->pev->origin, 10000 )) != NULL)
{
if (FClassnameIs( pEntity->pev, "monstermaker"))
{
pEntity->Use( m_pPlayer, pEntity, USE_ON, 0 );
}
}
[/quote]
This last part
pEntity->Use( m_pPlayer, pEntity, USE_ON, 0 ); I wrote it by memory, because I don´t have the code visible (the rest of the code above Is from a backup txt). Again, no luck and no visible effect at all. monstermakers, btw, worked as usual. The one I used to made the tests have its flag "targetname" with the name "sentinel" and also without any name, and with the flag "cyclic" activated and desactivated ( targetname on + cyclic on, targetname off +cyclic on, targetname off+cyclic off, targetname on+ cyclic off).
Qc file is Ok, and the model shows the reload animation in the model viewer, but, as it uses no clips, it is overriden by the reload code itself (no clips, no animation is displayed)..
The reload function (client and server) is the original, with no added parts.
Of course I made a full recompile of both client and serverl dlls.
I hope I satisfied your curiosity