GetWeaponName
From SA-MP Wiki
GetWeaponName
Get the name of a weapon.
(weaponid, const weapon[], len)
| weaponid | The Weapon ID you want to know the name of. |
| const name[] | The string to save the weapon name to. |
| len | The length of the weapon name. |
This function does not return a specific value.
public OnPlayerDeath(playerid,killerid,reason) { new gunname[32], string[64], fName[MAX_PLAYER_NAME], sName[MAX_PLAYER_NAME]; GetWeaponName(reason,gunname,sizeof(gunname)); GetPlayerName(playerid,fName,MAX_PLAYER_NAME); GetPlayerName(killerid,sName,MAX_PLAYER_NAME); format(string,sizeof(string),"%s has wasted %s using a %s.",sName,fName,gunname); SendClientMessageToAll(0xFFFFFFAA,string); return 1; }
Related Functions
The following functions might be useful as well, as they're related to this function in one way or another.
- GetPlayerWeapon: Check what weapon a player is currently holding.
- AllowInteriorWeapons: Determine if weapons can be used in interiors.
- GivePlayerWeapon: Give a player a weapon.
