GetPlayerSkillWeapon 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 weapon skill.

Syntax

int getPlayerSkillWeapon(int pid, int skill)

Parameters

  • id: The ID of player.
  • 'skill: The ID of skill (Constants).

Returns

  • Return player's weapon skill.

Example

Client

local function onCommandHandler(cmd, params)
{
    if (cmd == "skill")
    {
        local args = sscanf("d",params);
        switch (args[0]) {
            case 0:
                 print("Your one-handed weapon skill is " + getPlayerSkillWeapon(heroId,0));
                 break;
            case 1:
                 print("Your two-handed weapon skill is " + getPlayerSkillWeapon(heroId,1));
                 break;
            case 2:
                 print("Your bow skill is " + getPlayerSkillWeapon(heroId,2));
                 break;
            case 3:
                 print("Your crossbow skill is " + getPlayerSkillWeapon(heroId,3));
                 break;
        }
    }
}

addEventHandler("onCommand", onCommandHandler);

Server

local function onCommandHandler(cmd, params)
{
    if (cmd == "skill")
    {
        local args = sscanf("dd",params);
        local name = getPlayerName(args[0]);
        switch (args[1]) {
            case 0:
                 print(name + "'s one-handed weapon skill is " + getPlayerSkillWeapon(args[0],0));
                 break;
            case 1:
                 print(name + "'s two-handed weapon skill is " + getPlayerSkillWeapon(args[0],1));
                 break;
            case 2:
                 print(name + "'s bow skill is " + getPlayerSkillWeapon(args[0],2));
                 break;
            case 3:
                 print(name + "'s crossbow skill is " + getPlayerSkillWeapon(args[0],3));
                 break;
        }
    }
}

addEventHandler("onPlayerCommand", onPlayerCommandHandler);

Related functions

Server

Shared