முதன்மை உள்ளடக்கத்துக்குச் செல்லவும்

GetWeaponSlot

எச்சரிக்கை

செயல்பாடு என்பது omp v1.1.0.2612 பதிப்பில் சேர்க்கப்பட்டது. இது முந்தைய பதிப்புகளில் இயங்காது!

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;
}