Postado Agosto 6, 2020 4 anos 8 minutos atrás, Kevin Araujo disse: Tá falando que só posso usar em players, sendo que o target que eu tô é em um player. @Onepiece Troca essa parte da script: if (isPlayer(target)) then doPlayerSendCancel(cid, "This spell can only be used in Player.") return false end por esta: ifnot (isPlayer(target)) then doPlayerSendCancel(cid, "This spell can only be used in Player.") return false end
Postado Agosto 6, 2020 4 anos Autor Não levou o target, e o player foi sozinho pra dimensão e não voltou... Ficou lá. E não deu erro na distro. @Onepiece
Postado Agosto 7, 2020 4 anos Solução local c = { cooldown = 25, -- tempo em segundos para usar novamente effect = 200, -- efeito que vai sair quando for utilizado a spell storage = 32598, -- storage do cooldown pos_user = { x = 1509, y = 1261, z = 7}, pos_target = { x = 1509, y = 1255, z = 7}, time_back = 15, -- tempo em segundos para retornar points = 70, -- pontos de skills que o usuario terar a mais spell_room = {from = {x = 1, y = 1, z = 1}, to = {x = 1, y = 1, z = 1}}, restricted_zones = { [1] = {from = {x = 1483, y = 1110, z = 7}, to = {x = 1648, y = 1275, z = 7}}, [2] = {from = {x = 1054, y = 910, z = 7}, to = {x = 1069, y = 925, z = 7}} } } local function teleportPlayer(cid, pos, time) addEvent(doTeleportThing, time, cid, getCreaturePosition(cid)) doTeleportThing(cid, pos) end local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, c.time_back*1000) setConditionParam(condition, CONDITION_PARAM_STAT_MAGICLEVEL, c.points) setConditionParam(condition, CONDITION_PARAM_SKILL_FIST, c.points) setConditionParam(condition, CONDITION_PARAM_SKILL_SWORD, c.points) setConditionParam(condition, CONDITION_PARAM_SKILL_AXE, c.points) setConditionParam(condition, CONDITION_PARAM_SKILL_CLUB, c.points) setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCE, c.points) setConditionParam(condition, CONDITION_PARAM_SKILL_SHIELD, c.points) function onCastSpell(cid, var) local spellRoom = c.spell_room local restrictZones = c.restricted_zones local target = getCreatureTarget(cid) if (isInRange(getCreaturePosition(cid), spellRoom.from, spellRoom.to)) then doPlayerSendCancel(cid, "You are already within the dimension of this spell.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return false end for _, zone in ipairs(restrictZones) do if (isInRange(getCreaturePosition(cid), zone.from, zone.to)) then doPlayerSendCancel(cid, "It is impossible to use this spell here.") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF) return false end end if (isPlayer(cid)) and (exhaustion.check(cid, c.storage)) then doPlayerSendCancel(cid, "Wait ".. exhaustion.get(cid, c.storage) .. " seconds.") return false end if (not isPlayer(target)) then doPlayerSendCancel(cid, "This spell can only be used in Player.") return false end teleportPlayer(target, c.pos_target, c.time_back*1000) teleportPlayer(cid, c.pos_user, c.time_back*1000) exhaustion.set(cid, c.storage, c.cooldown) doSendMagicEffect(getCreaturePosition(target), c.effect) return TRUE end testa Editado Agosto 12, 2020 4 anos por Onepiece (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.