GetWeaponName

From SA-MP Wiki

Jump to: navigation, search


Get the name of a weapon.


Parameters:
(weaponid, const weapon[], len)
weaponidThe ID of the weapon to get the name of.
const name[]An array to store the weapon's name in, passed by reference.
lenThe length of the weapon name.


ReturnsThis function doesn't return a specific value


Image:32px-Circle-style-warning.png Important Note: Returns null for ids: 18, 44 and 45.


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.

Personal tools