Created
May 12, 2021 13:00
-
-
Save Elmuti/15535cbd2e12df72c26cad8cf56c72b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--nigger | |
local PLAYER_EVENT_ON_DUEL_END = 11 | |
local PLAYER_EVENT_ON_COMMAND = 42 | |
local POWER_MANA = 0 | |
local function OnDuelEnd(event, winner, loser, type) | |
winner:SetHealth(winner:GetMaxHealth()) | |
if winner:GetPowerType() == POWER_MANA then | |
winner:SetPower(POWER_MANA, winner:GetMaxPower(POWER_MANA)) | |
end | |
if winner:GetData("reset_cd_on_duel") then | |
winner:ResetAllCooldowns() | |
end | |
loser:SetHealth(loser:GetMaxHealth()) | |
if loser:GetPowerType() == POWER_MANA then | |
loser:SetPower(POWER_MANA, loser:GetMaxPower(POWER_MANA)) | |
end | |
if loser:GetData("reset_cd_on_duel") then | |
loser:ResetAllCooldowns() | |
end | |
end | |
local function OnCommand(event, player, command) | |
if command == "togglecdreset" then | |
local current = player:GetData("reset_cd_on_duel") or false | |
local newValue = not current | |
player:SetData("reset_cd_on_duel", newValue) | |
player:SendBroadcastMessage(string.format("Reset cooldowns after duel: %s", newValue and "on" or "off")) | |
return false | |
end | |
return false | |
end | |
RegisterPlayerEvent(PLAYER_EVENT_ON_DUEL_END, OnDuelEnd) | |
RegisterPlayerEvent(PLAYER_EVENT_ON_COMMAND, OnCommand) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment