GetPlayerMaxHealth Shared function

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

This function was added in version: Client: 0.0.4.1, Server: 0.0.0

This function returns player's Max health.

Syntax

int getPlayerMaxHealth(int id);

Parameters

  • id: The ID of player.

Returns

  • Return player's Max health.

Example

Client

local function onCommandHandler(cmd, params)
{
    if (cmd == "Maxhp")
    {
        local Maxhp = getPlayerMaxHealth(heroId);
        print("My Max health: " + Maxhp);
    }
}

addEventHandler("onCommand", onCommandHandler);

Server

local function onPlayerCommandHandler(pid, cmd, params)
{
    if (cmd == "Maxhp")
    {
        local Maxhp= getPlayerMaxHealth(pid);
        sendMessageToPlayer(pid, 255, 255, 255, "My Max health: " + Maxhp);
    }
}

addEventHandler("onPlayerCommand", onPlayerCommandHandler);

Related functions

Server

Shared