GetWeaponName

From SA-MP Wiki

Jump to: navigation, search

GetWeaponName


Get the name of a weapon.


Parameters:
(weaponid, const weapon[], len)
weaponidThe Weapon ID you want to know the name of.
const name[]The string to save the weapon name to.
lenThe 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.

Personal tools