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

Is there any function in Lua that can cast spells for players? #484

Closed
xengine-qyt opened this issue Jun 12, 2024 · 0 comments
Closed

Is there any function in Lua that can cast spells for players? #484

xengine-qyt opened this issue Jun 12, 2024 · 0 comments

Comments

@xengine-qyt
Copy link

xengine-qyt commented Jun 12, 2024

there is my script:

local function BuffCommand(event, player, command)
    local nTimeBuff = 60 * 60 * 1000 * 3
    if command == "buff" then
        local buffs = {23766, 23767, 23768, 23769,
                       49284, 49281,                      
                       47440, 47436                         
                       }                               
        for i, buffId in ipairs(buffs) do
            local aura = player:AddAura(buffId, player)
            -- local aura = player:CastSpell(player, buffId, true)
            if aura then
                aura:SetDuration(nTimeBuff) 
            end
        end
        player:SendBroadcastMessage("add buffs!")
        return false
    end
end

RegisterPlayerEvent(42, BuffCommand)

This buff command should perform certain checks, such as only allowing one type of Knight's Blessing or Warrior's Roar to be cast at a time. However, according to the game rules, multiple Knight's Blessings can be cast on a player as long as they are different types of blessings. What method should I use to implement this?
I tried CastSpell, but the effect is always the same, and I can't set the buff duration. Can Lua implement the functionality I mentioned?

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

No branches or pull requests

1 participant