SetPlayerMagicLevel

From Gothic 2 Online: Wiki
Jump to navigation Jump to search

This function sets new magic level for player.

Syntax

void setPlayerMagicLevel(int pid, int value[1-6])

Parameters

  • pid: The ID of player.
  • value: New magic level.

Example

Client

local function onCommandHandler(cmd, params)
{
    if (cmd == "mlvl")
    {
        local args = sscanf("d", params);
        if (!args) {
            sendMessageToPlayer(pid, 255, 0, 0, "Wrong parameters!");
            return;
        }

        setPlayerMagicLevel(heroId, args[0]);
    }
}

addEventHandler("onCommand", onCommandHandler);

Server

local function onPlayerCommandHandler(pid, cmd, params)
{
    if (cmd == "mlvl")
    {
        local args = sscanf("d", params);
        if (!args) {
            sendMessageToPlayer(pid, 255, 0, 0, "Wrong parameters!");
            return;
        }

        setPlayerMagicLevel(args[0], args[1]);
    }
}

addEventHandler("onPlayerCommand", onPlayerCommandHandler);

Related functions

Server

Shared