Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(LuaEngine/PlayerHooks): Add Skill base player hooks #238

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

iThorgrim
Copy link

@iThorgrim iThorgrim commented Jan 25, 2025

📝 Description

This pull request introduces a new Hook in mod-eluna for player:

  • PLAYER_EVENT_ON_CAN_RESURRECT

🚨 Prerequisites

Warning

Requires the following dependency:

Note

Implemented based on feature request:

🆕 New Hooks Overview

Example

local function OnPlayerCanUpdateSkill(event, player, skill_id)
    print("OnPlayerCanUpdateSkill", event, player, skill_id)
    return true
end
RegisterPlayerEvent(59, OnPlayerCanUpdateSkill)

local function OnBeforePlayerUpdateSkill(event, player, skill_id, value, max, step)
    print("OnBeforePlayerUpdateSkill", event, player, skill_id, value, max, step)
    return value + (step * 2)
end
RegisterPlayerEvent(60, OnBeforePlayerUpdateSkill)

local function OnPlayerUpdateSkill(event, player, skill_id, value, max, step)
    print("OnPlayerUpdateSkill", event, player, skill_id, value, max, step)
end
RegisterPlayerEvent(61, OnPlayerUpdateSkill)

🧪 Test Case

Test Script

local function OnPlayerCanUpdateSkill(event, player, skill_id)
    print("OnPlayerCanUpdateSkill", event, player, skill_id)
    return true
end
RegisterPlayerEvent(59, OnPlayerCanUpdateSkill)

local function OnBeforePlayerUpdateSkill(event, player, skill_id, value, max, step)
    print("OnBeforePlayerUpdateSkill", event, player, skill_id, value, max, step)
    return value + (step * 2)
end
RegisterPlayerEvent(60, OnBeforePlayerUpdateSkill)

local function OnPlayerUpdateSkill(event, player, skill_id, value, max, step)
    print("OnPlayerUpdateSkill", event, player, skill_id, value, max, step)
end
RegisterPlayerEvent(61, OnPlayerUpdateSkill)

📸 Test Results

Desktop.2025-01-25.14-56-52.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant