GetWeaponName
From SA-MP Wiki
Get the name of a weapon.
(weaponid, const weapon[], len)
| weaponid | The ID of the weapon to get the name of. |
| const name[] | An array to store the weapon's name in, passed by reference. |
| len | The length of the weapon name. |
| Returns | This function doesn't 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 may be useful, as they are 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.
