Here:Code: [Select]function onPlayerCommand ( pPlayer, szCommand, szParams ) { if ( szCommand == "wep" ) { if ( !szParams ) MessagePlayer ( "Unknown usage, type: /wep ( ID / NAME )", pPlayer, 255, 0, 0 ); else if ( IsNum ( szParams ) ) // Get a weapon by ID { local szName = GetWeaponName ( szParams.tointeger ( ) ); // This locals returns the name of the weapon by ID pPlayer.SetWeapon ( szParams.tointeger ( ), 500 ); // 500 it's the ammo MessagePlayer( "You've get a " + szName + ", ID " + szParams, pPlayer, 255, 255, 255 ); } else // Get a weapon by Name { local iID = GetWeaponIDFromName ( szParams ); // This local returns the ID of the weapon from its name local szName = GetWeaponName ( iID ); // This locals returns the name of the weapon by ID pPlayer.SetWeapon ( iID, 500 ); // 500 it's the ammo MessagePlayer( "You've get a " + szName + ", ID " + iID, pPlayer, 255, 255, 255 ); } } return 1;}Tested and works 100%. Have a nice day, aledark24.
function onPlayerCommand ( pPlayer, szCommand, szParams ) { if ( szCommand == "wep" ) { if ( !szParams ) MessagePlayer ( "Unknown usage, type: /wep ( ID / NAME )", pPlayer, 255, 0, 0 ); else if ( IsNum ( szParams ) ) // Get a weapon by ID { local szName = GetWeaponName ( szParams.tointeger ( ) ); // This locals returns the name of the weapon by ID pPlayer.SetWeapon ( szParams.tointeger ( ), 500 ); // 500 it's the ammo MessagePlayer( "You've get a " + szName + ", ID " + szParams, pPlayer, 255, 255, 255 ); } else // Get a weapon by Name { local iID = GetWeaponIDFromName ( szParams ); // This local returns the ID of the weapon from its name local szName = GetWeaponName ( iID ); // This locals returns the name of the weapon by ID pPlayer.SetWeapon ( iID, 500 ); // 500 it's the ammo MessagePlayer( "You've get a " + szName + ", ID " + iID, pPlayer, 255, 255, 255 ); } } return 1;}