GetPlayerMagicState: Difference between revisions
Jump to navigation
Jump to search
Automatyczna aktualizacja dokumentacji funkcji |
Complete Lua function catalog |
||
| (One intermediate revision by the same user not shown) | |||
| Line 22: | Line 22: | ||
<syntaxhighlight lang="lua" line> | <syntaxhighlight lang="lua" line> | ||
local magic = getPlayerMagicState(playerId) | local magic = getPlayerMagicState(playerId) | ||
if magic and magic.activeSpell then | if magic and magic.activeSpell ~= "none" then | ||
print("Cast phase:", magic.phase) | print("Cast phase:", magic.phase) | ||
print("Spell:", magic.activeSpell) | print("Spell:", magic.activeSpell) | ||
| Line 31: | Line 31: | ||
* Available only in server-side resource scripts. | * Available only in server-side resource scripts. | ||
[[Category:Lua Functions]] | |||
[[Category:Server Functions]] | [[Category:Server Functions]] | ||
[[Category:Magic Functions]] | [[Category:Magic Functions]] | ||
[[Category:Player Functions]] | [[Category:Player Functions]] | ||
Latest revision as of 09:53, 15 August 2026
getPlayerMagicState
Returns the server-authoritative spellcasting state of a connected player.
Syntax
table getPlayerMagicState(int playerId)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player to inspect. |
Returns
Returns a table containing circle, mana, equipped/active spell, cast phase, timing and granted-spell data, or false for an invalid player.
Examples
Check which spell a player is casting:
local magic = getPlayerMagicState(playerId)
if magic and magic.activeSpell ~= "none" then
print("Cast phase:", magic.phase)
print("Spell:", magic.activeSpell)
end
Notes
- Available only in server-side resource scripts.