View Single Post
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 02-23-2009 , 08:28   Re: Refill ammo on kill (for CSDM)
Reply With Quote #5

PHP Code:
new const g_max_clip[] =
{
    
1310730,
    
30302025,
    
30353525,
    
12201030,
    
10083030,
    
207303050

Poor and inconsistent form; consider separating them each to be on a different line or revise the other variables to be in a similar format to this. Also, inconsistent use of semicolons.

PHP Code:
    for (new 0sizeof (g_other_weapons); a++)
        if (
wpnindex == g_other_weapons[a])
            return;

    if (!
csdm_get_ffa() && TK)
        return; 
Reorder these so that the second condition is first. The first loop is more expensive so it should be executed after the second.

PHP Code:
            new ammo get_weapon_maxclip(wpnindex);

            if (!
ammo)
                return;

            
client_cmd(killer"spk ^"items/9mmclip1.wav^"");
            
cs_set_weapon_ammo(weaponammo);
            return; 
This can be reordered to something like this:

PHP Code:
            new ammo get_weapon_maxclip(wpnindex);

            if (
ammo)
            {
                
client_cmd(killer"spk ^"items/9mmclip1.wav^"");
                
cs_set_weapon_ammo(weaponammo);
            }

            return; 
PHP Code:
get_weaponname(wpnidnamesizeof (name) - 1); 
I suggest using charsize.

PHP Code:
stock get_weapon_maxclip(wpnid 0)
// ...
stock fm_get_weapon_ent(idwpnid 0)
// ...
stock fm_find_ent_by_owner(id, const classname[], ownerjghgtype 0
Take the "stock" tag off, it's unnecessary.

For the most part, these are minor, but this is a small script.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552