GivePlayerSpell: Difference between revisions
Jump to navigation
Jump to search
Automatyczna aktualizacja dokumentacji funkcji |
Document 0.1a Lua API, identities, moderation and synchronized spells |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
= givePlayerSpell = | = givePlayerSpell = | ||
Grants or clears a player's authoritative spell ownership state. | Grants or clears a player's authoritative spell ownership state. | ||
| Line 23: | Line 22: | ||
== Examples == | == Examples == | ||
Grant Fire | Grant Fire Bolt to a player: | ||
<syntaxhighlight lang="lua" line> | <syntaxhighlight lang="lua" line> | ||
givePlayerSpell(playerId, SPELL. | givePlayerSpell(playerId, SPELL.fire_bolt) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 31: | Line 30: | ||
* Available only in server-side resource scripts. | * Available only in server-side resource scripts. | ||
* This is an alias of <code>setPlayerSpellGranted</code>. | * This is an alias of <code>setPlayerSpellGranted</code>. | ||
* Grant state and cast support are separate. See [[Synchronized spell catalog]] and check <code>getSpellDefinition(spell).implemented</code> before exposing a spell to players. | |||
[[Category:Lua Functions]] | |||
[[Category:Server Functions]] | [[Category:Server Functions]] | ||
[[Category:Magic Functions]] | [[Category:Magic Functions]] | ||
[[Category:Progression Functions]] | [[Category:Progression Functions]] | ||
Latest revision as of 11:36, 27 August 2026
givePlayerSpell
Grants or clears a player's authoritative spell ownership state.
Syntax
bool givePlayerSpell(int playerId, int|string spell [, bool enabled = true])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
spell |
string | yes | A spell id, a stable spell key, or a value from the global SPELL table. |
enabled |
bool |
no | True to grant the spell or false to revoke it; defaults to true. |
Returns
Returns true when the spell grant state is accepted; otherwise returns false.
Examples
Grant Fire Bolt to a player:
givePlayerSpell(playerId, SPELL.fire_bolt)
Notes
- Available only in server-side resource scripts.
- This is an alias of
setPlayerSpellGranted. - Grant state and cast support are separate. See Synchronized spell catalog and check
getSpellDefinition(spell).implementedbefore exposing a spell to players.