Área incorreta. Tópico movido para Pedidos e Dúvidas - Scripting.
Aqui está a correção do seu script:
local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0) local condition = createConditionObject(CONDITION_OUTFIT) setConditionParam(condition, CONDITION_PARAM_TICKS, 86400000) addOutfitCondition(condition, 0, 71, 0, 0, 0, 0) setCombatCondition(combat, condition) ext = 1000 function onCastSpell(cid, var) -- Transformar if getPlayerVocation(cid) == 398 then if getPlayerLevel(cid) >= 50 then doPlayerSetVocation(cid,399) doSetOutfit(cid,"495") addEvent(tran,ext,cid) doSendMagicEffect(getPlayerPosition(cid), 8) else doPlayerSendCancel(cid, "You need level 50 to the next transform.") doSendMagicEffect(getPlayerPosition(cid), 2) end elseif getPlayerVocation(cid) == 399 then if getPlayerLevel(cid) >= 100 then doPlayerSetVocation(cid,400) doSetOutfit(cid,"496") addEvent(tran,ext,cid) doSendMagicEffect(getPlayerPosition(cid), 32) else doPlayerSendCancel(cid, "You need level 100 to the next transform.") doSendMagicEffect(getPlayerPosition(cid), 2) end elseif getPlayerVocation(cid) == 400 then if getPlayerLevel(cid) >= 150 then doPlayerSetVocation(cid,401) doSetOutfit(cid,"497") addEvent(tran,ext,cid) doSendMagicEffect(getPlayerPosition(cid), 32) else doPlayerSendCancel(cid, "You need level 150 to the next transform.") doSendMagicEffect(getPlayerPosition(cid), 2) end elseif getPlayerVocation(cid) == 401 then if getPlayerLevel(cid) >= 200 then doPlayerSetVocation(cid,402) doSetOutfit(cid,"498") addEvent(tran,ext,cid) doSendMagicEffect(getPlayerPosition(cid), 32) else doPlayerSendCancel(cid, "You need level 200 to the next transform.") doSendMagicEffect(getPlayerPosition(cid), 2) end end return true end
Quanto a sua dúvida:
Entendendo "if" como "se" e "elseif" como "se não, mas" facilita tudo. O if vc vai usar para uma primeira condição e o elseif pode vir dentro do if, exemplo de um script traduzido:
se pegarLevelDoPlayer(cid) == 20 então
teleporteOPlayer(cid, pos)
se não mas pegarLevelDoPlayer(cid) == 30 então
teleporteOPlayer(cid, pos2)
end
O mesmo script em LUA:
if getPlayerLevel(cid) == 20 then
doTeleportThing(cid, pos)
elseif getPlayerLevel(cid) == 30 then
doTeleportThing(cid, pos2)
end
Espero que dê pra entender.






info
Grupo: Cavaleiro
Registrado: 18/12/12
Posts: 158
Reputação: +14
Gênero: Masculino
Char no Tibia: Lestat
Bom Tenho um spell de transform Porém da o erro
Eu Sempre tive essa duvida Onde Colocar If e onde colocar Elseif.
Script:
Editado Fevereiro 14 por narutomaniacos