GetWeaponName
Description:
Function GetWeaponName get the name of a weapon.
Parameters:
(weaponid, weapon[], len)
int | weaponid | The ID of the weapon to get the name of. |
string | weapon | An array to store the weapon's name in, passed by reference. |
int | len | The maximum length of the weapon name to store. Should be sizeof(name). |
Return Values:
- 1: The function was executed successfully.
- 0: The function failed to execute. The weapon specified does not exist.
Examples:
public OnPlayerDeath(playerid, killerid, reason) { new gunname[32], string[64], playername[MAX_PLAYER_NAME + 1], killername[MAX_PLAYER_NAME + 1]; GetWeaponName(reason, gunname, sizeof(gunname)); GetPlayerName(playerid, playername, sizeof(playername)); GetPlayerName(killerid, killername, sizeof(killername)); format(string, sizeof(string), "%s has wasted %s using a %s.", killername, playername, 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.