Jump to content

Check if cast spell


ToShuk Marusenko

Recommended Posts

Posted

i try to  check if player cast spell, and i have this message if i cast of any spells

function Oncast(event, player, spell, skipCheck)
if(player:IsCasting(10912) == true) then
print "IS CASTING"
end

end

RegisterPlayerEvent(5, Oncast)

why ? i need that message is print if a cast 10912 spell id

Posted

If I understood right, you are trying to check if the spell being cast is 10912.
It seems the example code you have posted tries to use player:IsCasting(10912) to check if the player is casting the spell entry.
However as you can see from the documentation it takes no arguments and cannot check if a specific spell entry is being casted. http://www.elunaengine.com/Unit/IsCasting.html

What we suggest you do is to check if the entry of the spell parameter is what you want. You can use http://www.elunaengine.com/Spell/GetEntry.html
Here is an example:
 

function Oncast(event, player, spell, skipCheck)
    if spell:GetEntry() == 10912 then
        print "IS CASTING 10912"
    end
end
RegisterPlayerEvent(5, Oncast)

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use