Ugrás a fő tartalomhoz

GetWeaponSlot

Description

Gets the slot of one weapon.

NameDescription
WEAPON:weaponidThe ID of the weapon to get the slot of.

Returns

The number of the weapon slot (0 - 12)

Examples

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/weaponslot", true) == 0)
{
new WEAPON:weaponid = GetPlayerWeapon(playerid); // will store the id of the weapon the player is currently holding
new WEAPON_SLOT:slot = GetWeaponSlot(weaponid); // will store the id of the weapon slot
SendClientMessage(playerid, -1, "Your weapon is occupying the slot %d.", slot); // sends a formatted message to the player
return 1;
}
return 0;
}