mirror of
https://github.com/brues-code/nampower.git
synced 2026-09-21 23:26:54 +00:00
add getammo function
This commit is contained in:
+30
@@ -16,6 +16,7 @@ For installation, configuration, and general usage information, see the main [RE
|
||||
- [GetEquippedItem](#getequippeditemunittoken-slot)
|
||||
- [GetBagItems](#getbagitemsbagindex)
|
||||
- [GetBagItem](#getbagitembagindex-slot)
|
||||
- [GetAmmo](#getammo)
|
||||
- [GetSpellRec](#getspellrecspellid-copy)
|
||||
- [GetSpellRecField](#getspellrecfieldspellid-fieldname-copy)
|
||||
- [GetSpellModifiers](#getspellmodifiersspellid-modifiertype)
|
||||
@@ -433,6 +434,35 @@ if bankItem then
|
||||
end
|
||||
```
|
||||
|
||||
#### GetAmmo()
|
||||
Returns the player's currently equipped ammo item ID and the total quantity remaining across all bags.
|
||||
|
||||
**Parameters:**
|
||||
- None
|
||||
|
||||
**Returns:**
|
||||
- If no ammo is equipped: returns `nil`
|
||||
- Otherwise returns two values:
|
||||
- 1st param (number): The ammo item ID
|
||||
- 2nd param (number): Total ammo count across backpack and bags 1-4
|
||||
|
||||
**Examples:**
|
||||
```lua
|
||||
-- Check current ammo
|
||||
local ammoId, count = GetAmmo()
|
||||
if ammoId then
|
||||
print("Ammo ID: " .. ammoId .. " Count: " .. count)
|
||||
else
|
||||
print("No ammo equipped")
|
||||
end
|
||||
|
||||
-- Low ammo warning
|
||||
local ammoId, count = GetAmmo()
|
||||
if ammoId and count < 200 then
|
||||
print("Low ammo! Only " .. count .. " remaining")
|
||||
end
|
||||
```
|
||||
|
||||
#### GetSpellRec(spellId, [copy])
|
||||
Returns a Lua table reference containing all fields for the spell's `SpellRec` record (including localized `name` and `rank`). Returns nil if the spell cannot be found.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user