warning Not Translated
This page has not been translated into the language that your browser requested yet. The English content is being shown as a fallback.
If you want to contribute a translation for this page then please click here.
GetWeaponSlot
Description
Gets the slot of one weapon.
Name | Description |
---|---|
WEAPON:weaponid | The 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;
}
Related Functions
- GetPlayerWeapon: Gets the ID of the weapon a player is currently holding.
- GetPlayerWeaponData: Get the weapon and ammo in a specific player's weapon slot (e.g. the weapon in the 'SMG' slot).
- GetPlayerAmmo: Gets the amount of ammo in a player's current weapon.
- SetPlayerArmedWeapon: Sets which weapon (that a player already has) the player is holding.
- ResetPlayerWeapon: Removes all weapons from a player.
- RemovePlayerWeapon: Remove a specified weapon from a player.