GetPlayerMagicState: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Automatyczna aktualizacja dokumentacji funkcji
 
Automatyczna aktualizacja dokumentacji funkcji
 
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)

Latest revision as of 12:53, 4 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.