ricardo231
New Member
- Joined
- Apr 8, 2011
- Messages
- 42
- Reaction score
- 0
Hello friend I have a problem with spells , its function is to capture a monster and make it my slave as a summons.
Use OTX 2.0
Use OTX 2.0
Code:
function onCastSpell(cid)
local waittime = 90 -- Tempo de exhaustion
local storage = 115818
if exhaustion.check(cid, storage) == TRUE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "your mind is tired, wait " .. exhaustion.get(cid, storage) .. " to control again.")
return FALSE
end
local target = getCreatureTarget(cid)
if not isCreature(target) then
return not doPlayerSendCancel(cid, "You don't have any target.")
end
if not isMonster(target) or getCreatureMaster(target) ~= target then
return not doPlayerSendCancel(cid, "You can't control that creature.")
end
if #getCreatureSummons(cid) >= 1 then
return not doPlayerSendCancel(cid, "You can't have more summons.")
end
if not isInArray({"Cyborg", "Vampire","Skeleton","Juuhi Member","Hidden Shinobi","Hoshi Member","Hoshi Jounnin","Fat Ninja","Shadow Hunter","Ninja","Wolf","Weak Wolf","Desert Jumper","Shaman","Shinobazu","Assassin","Commander","Elder Bandit","Elite Bandit","Insect","Kusa Shinobi","Mountain Bandit","Nerwous wolf","Ninja","Onbu","Rain Soldier","Sand Creeper","Savager","Snake","Sound Shinobi","Sound Spy","Weakling","White Ninja","White Skeleton","Winter Wolf"}, getCreatureName(target)) then
return not doPlayerSendCancel(cid, "You can't control that creature.")
end
doConvinceCreature(cid, target)
doSendMagicEffect(getCreaturePosition(cid), 187)
doPlayerAddSkillTry(cid, 6, 1)
exhaustion.set(cid, storage, waittime)
return true
end