function getwepname

Started by KAKAN, Aug 27, 2015, 05:26 PM

Previous topic - Next topic

KAKAN

So guys, I made a system named GetWepName(reason)
Which is used in onPlayerKill, and it works all good, but sometimes it shows unknown, what's the problem, which wep am i missing?
Here's the code:-
[spoiler="Function GetWepName(reason)"]function GetWepName( reason )
{
      switch(reason.tointeger())
      {
   case 0: return "Fists";
   case 1: return "Brass Knuckle";
   case 2: return "Screw Driver";
   case 3: return "Golf Club";
   case 4: return "Night Stick";
   case 5: return "Knife";
   case 6: return "Baseball Bat";
   case 7: return "Hammer";
   case 8: return "Cleaver";
   case 9: return "Machete";
   case 10: return "Katana";
   case 11: return "Chainsaw";
   case 12: return "Grenade";
   case 13: return "Remote Grenade";
   case 14: return "Tear Gas";
   case 15: return "Molotov";
   case 16: return "Missile";
   case 17: return "Colt. 45";
   case 18: return "Python";
   case 19: return "Shotgun";
   case 20: return "Spaz";
   case 21: return "Stubby";
   case 22: return "Tec9";
   case 23: return "Uzi";
   case 24: return "Ingrams";
   case 25: return "MP5";
   case 26: return "M4";
   case 27: return "Ruger";
   case 28: return "Sniper Rifle";
   case 29: return "Laser Scope";
   case 30: return "Rocket Launcher";
   case 31: return "Flame Thrower";
   case 32: return "M60";
   case 33: return "Machine Gun";
   case 34: return "Bomb";
   case 35: return "Heli-Cannon";
   case 36: return "Camera";
   case 39: return "Vehicle";
   case 40: return "Heli-Blades";
   case 42: return "Drive-By";
   case 43: return "Drown";
   case 44: return "Fall";
   case 60: return "Heli-Blades";
   case 70: return "Suicide";
   case 100: return "Custom Wep 1";
   case 101: return "Custom Wep 2";
   case 102: return "Custom Wep 3";
   default: return "Unknown";
      }
}[/spoiler]
oh no

Thijn

Why make your own function when there's the inbuild GetWeaponName( weaponId ) function?
You can always add your custom weapons using function already posted numerous times.

In order to debug your problem, why not add default: return "Unknown: " + reason;

KAKAN

Quote from: Thijn on Aug 27, 2015, 06:31 PMYou can always add your custom weapons using function already posted numerous times.

Can u tell me how to?
Quote from: Thijn on Aug 27, 2015, 06:31 PMIn order to debug your problem, why not add default: return "Unknown: " + reason;

Okay will try.
oh no