Well, I am putting so much confidence on the Bot's habilities, what I'll try is to think it from the point of view of a tool maker, putting the task of deciding this process on the weapon's part. I will tell you later what happen.
Edit: well, all is fixed now. Of course there are things still undone, as the fact that one of the weapons is not still used by the Bots, but I know now exactly what to do. The approach was wrong from the beggining, and one of the causes of this bad approach was to take too much seriously the Bot, as I said before. This Bot (Bot #10) is very simple, please, don´t get me wrong, working 10 hours a day for 30 years could not make me do something similar, but the bot is simple in therms of features. It is oriented to be used as a standalone comrade in classic Half-Life deathmatch. It can pick weapons and navigate maps that are not very complex, even it can use health rechargers and jump and crouch, but my mistake was to try to make them more than that.
What I should do first is to think on the way the things work in real life, that is, what´s overheating, cooling itself, and is able to be reloaded?, the weapon, right?, so I decided to put all the conditions on the weapon. Can the weapon overheat?, well, let´s put conditions for the REAL player and for the FAKE player, can it reload?, ok, put some if statements and make them so the FAKE PLAYER receive this or that thing that, combined with the Bot code make things happen as I wanted.
Finally I hace added this two lines of code (forgive me if the code sucks, is dirty, makes your eyes bleed, etc. PLEASE

):
`void CShoryuken::Reload( void )
{
Cooldown(); // Shepard : Cool down our weapon (if we can)
//========================================================================================================
// New RELOAD call. It will activates the monstermakers from distance.
//--------------------------------------------------------------------------------------------------------
// Concept code first version (c) Angel Ramos (Not Implemented) Based on satchel.cpp code
// Code second version advices(c) Shepard62700FR (Not implemented)
// Concept code third version (c) Solokiller (implemented)
// First code based on Solokiller´s advices (implemented, not working)
// Non working RELOAD key Fix (c) Shepard62700FR
// Last version (c) Solokiller Working!!
// Last fixes (c) Angel Ramos ( Limited number of reloads, added Triggerreleased part so button only works
// on "semi", because, before, all "ammo" was depleted when the button "R"
// was pressed because the call was continuous)
//=========================================================================================================
if ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] >= 100 || m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] <= 0 || !TriggerReleased || m_iCall >= 1 )
return;
else if ( ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] >= 500) )
{
m_iCall -=1;
}
edict_t *pPlayer = m_pPlayer->edict( );
CBaseEntity *pEntity = NULL;
//Pass pEntity as the start entity to search through all entities properly. - Solokiller
while ((pEntity = UTIL_FindEntityInSphere( pEntity, m_pPlayer->pev->origin, 500000.0f)) !=NULL)
{
//Check if the targetname matches the owning player's team to filter monstermakers. - Solokiller
if ( FClassnameIs( pEntity->pev, "monstermaker" ) && FStrEq( STRING( pEntity->pev->targetname ), m_pPlayer->TeamID() ) )
{
pEntity->Use( m_pPlayer, m_pPlayer, USE_ON, 0.0f );
}
}
ALERT( at_console, "RELOAD!!\n" );
m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] -= 1;
TriggerReleased = FALSE;
EMIT_SOUND(ENT(pev), CHAN_ITEM, "weapons/reload.wav", 1, ATTN_NORM);//Aqui va lo del sonido
m_iCall +=1;//Nuevo
if (FBitSet(m_pPlayer->pev->flags, FL_FAKECLIENT) && ( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )) { m_iCall += 0;
m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] -= 0; m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] += 20; }
if (FBitSet(m_pPlayer->pev->flags, FL_FAKECLIENT) && ( m_iCall =1 )) { m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= 600; }
}`
It's so coarse that I'm ashamed to put it here, but, well, I'm not able to do it better, and, hey, it works ...
Now the Bot, when it uses a projectile weapon and can Reload (m_iCall = 0) but its ammo is depleted(m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0), and because sometimes it is like if they cannot decide to use the reload function I decided to give them a bit of ammo (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] += 20) to let them still try to reload. If all goes right, they´ll use the reload button, and that´s when they receive +1 m_iCall and their ammo was depleted instantly (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] -= 600) so they must use the URAKEN weapon. When the Bot is reloaded, m_iCall is set to zero again, they can reload, and have new fresh ammo to fight.
Thanks for reading!!

BTW: I´m again working on ZWC.