Ir para conteúdo

Featured Replies

Postado
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
  • Respostas 20
  • Visualizações 1.4k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • 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 =

Posted Images

Postado
  • 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 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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo