Scripting/Squirrel/Functions/Misc/GetWeaponName
From VC-MP Wiki
This function returns the weapon/death reason name from the ID.
Syntax
string GetWeaponName( int weaponID )
Arguments
- weaponID This is the ID of the weapon
Example
This command gives player the weapon they request when they type '/c wep minigun'.
function onPlayerCommand( player, cmd, text ) { if ( cmd == "wep" ) { local wepid = GetWeaponID( text ); player.SetWeapon( wepid, 1000 ); MessagePlayer( "You have been given a " + GetWeaponName( wepid ) + " with 1000 ammo.", player ); } }
Notes
The functions MessagePlayer, player.SetWeapon, GetWeaponID and call onPlayerCommand were used in in this example. More info about them in corresponding pages.
Related Functions
- Message
- MessagePlayer
- MessageAllExcept
- PrivMessage
- PrivMessageAll
- ClientMessage
- ClientMessageToAll
- Announce
- AnnounceAll
- SendPlayerMessage
- KickPlayer
- BanPlayer
- BanIP
- UnbanIP
- GetWeaponName
- GetWeaponID
- GetDistrictName
- GetSkinName
- GetTickCount
- GetTime
- GetFullTime
- IsNum
- BindKey
- UnbindKey
- CallFunc
- InPoly
- DistanceFromPoint
- ReloadScripts
