Heli-blades showing Unknown?

Started by Gulk, May 07, 2015, 12:54 PM

Previous topic - Next topic

Gulk

function onPlayerDeath(player,reason)
{
 print("[DEATH] "+player.Name+" died. (" + GetWeaponName( reason ) + ")" );
 if (reason == WEP_DROWNED) Message("[#CACA02]"+player.Name+" drowned.");
 else Message("[#CACA02]"+player.Name+" died. (" + GetWeaponName( reason ) + ")" );
 return 1;
}

function onPlayerKill( killer, player, reason, bodypart )
{
 print("[KILL] "+killer.Name+" killed "+player.Name+". (" + GetWeaponName( reason ) + ")" );
 Message( "[#CACA02]" + killer.Name + " killed " + player.Name + ". (" + GetWeaponName( reason ) + ")" );
 killer.Score++;
}


How can I get Helicopter Blades to show up on death message? I see no constant for it on the wiki

.

Use a wrapper around that function and allow it to return your custom names and then default to the actual function if there isn't a custom name set for the specified ID. Replace the random numbers and strings with the actual IDs and their respective names:
function GetWepName(id)
{
    switch (id)
    {
        case 233: return "Weapon at ID 233";
        case 535: return "Weapon at ID 535";
        case 343: return "Weapon at ID 343";
        default: return GetWeaponName(id);
    }
}

print(GetWepName(343)); // Prints: Weapon at ID 535
print(GetWepName(212)); // Prints: whatever GetWeaponName() returns

.