GetPlayerMagicLevel

From Gothic 2 Online: Wiki
Revision as of 13:40, 15 February 2021 by Arkhan (talk | contribs) (Created page with "'''This function returns player's magic level'''. == Syntax == <syntaxhighlight lang="cpp"> int getPlayerMagicLevel(int pid); </syntaxhighlight> == Parameters == * '''pid''...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function returns player's magic level.

Syntax

int getPlayerMagicLevel(int pid);

Parameters

  • pid: The ID of player.

Example

Client

local function onCommandHandler(cmd, params)
{
    if (cmd == "mlvl")
    {
        local mlvl = getPlayerMagicLevel(heroId);
        print("My magic level : " + mlvl);
    }
}
addEventHandler("onCommand", onCommandHandler);

Server

local function onPlayerCommandHandler(pid, cmd, params)
{
    if (cmd == "mlvl")
    {
        local mlvl = getPlayerMagicLevel(pid);
        sendMessageToPlayer(pid, 255, 255, 255, "My magic level : " + mlvl);
    }
}

addEventHandler("onPlayerCommand", onPlayerCommandHandler);

Related functions

Server

Shared