HasPlayerSpell: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Automatyczna aktualizacja dokumentacji funkcji
 
Complete Lua function catalog
Line 32: Line 32:
* This is an alias of <code>isPlayerSpellGranted</code>.
* This is an alias of <code>isPlayerSpellGranted</code>.


[[Category:Lua Functions]]
[[Category:Server Functions]]
[[Category:Server Functions]]
[[Category:Magic Functions]]
[[Category:Magic Functions]]
[[Category:Player Functions]]
[[Category:Player Functions]]

Revision as of 09:54, 15 August 2026

hasPlayerSpell

Checks whether a player has an authoritative spell grant.

Syntax

bool hasPlayerSpell(int playerId, int|string spell)

Parameters

Name Type Required Description
playerId int yes The connected player identifier.
spell string yes A spell id, stable spell key, or value from the global SPELL table.

Returns

Returns true when the spell is granted; otherwise returns false.

Examples

Grant a spell only when it is missing:

if not hasPlayerSpell(playerId, SPELL.FIRE_ARROW) then
    givePlayerSpell(playerId, SPELL.FIRE_ARROW)
end

Notes

  • Available only in server-side resource scripts.
  • This is an alias of isPlayerSpellGranted.