Postado Novembro 8, 2015 9 anos Estou com uma Action que coloco nas doors do servidor para "teleportar" o player. Gostaria que adicionassem no script uma opção de adicionar um level determinado para conseguir clicar na porta e se teleportar. Desde já, obrigado! function onUse(cid, item, frompos, item2, topos) -- Beginning of editable Variabels aidNor = 4211 -- Action id for door where training room is north of door aidSou = 4212 -- Action id for door where training room is south of door aidWes = 4213 -- Action id for door where training room is west of door aidEas = 4214 -- Action id for door where training room is east of door -- End of editable Variabels emptyRoom = true charPos = getPlayerPosition(cid) if (item.actionid == aidNor) then if (charPos.y < frompos.y) then othersidePos = {x=frompos.x, y=frompos.y+1, z=frompos.z} else othersidePos = {x=frompos.x, y=frompos.y-1, z=frompos.z, stackpos=253} things = getThingfromPos(othersidePos) if (things.itemid == 1) then if (getPlayerLevel(things.uid) > 0) then emptyRoom = false end end end elseif (item.actionid == aidSou) then if (charPos.y > frompos.y) then othersidePos = {x=frompos.x, y=frompos.y-1, z=frompos.z} else othersidePos = {x=frompos.x, y=frompos.y+1, z=frompos.z, stackpos=253} things = getThingfromPos(othersidePos) if (things.itemid == 1) then if (getPlayerLevel(things.uid) > 0) then emptyRoom = false end end end elseif (item.actionid == aidEas) then if (charPos.x > frompos.x) then othersidePos = {x=frompos.x-1, y=frompos.y, z=frompos.z} else othersidePos = {x=frompos.x+1, y=frompos.y, z=frompos.z, stackpos=253} things = getThingfromPos(othersidePos) if (things.itemid == 1) then if (getPlayerLevel(things.uid) > 0) then emptyRoom = false end end end elseif (item.actionid == aidWes) then if (charPos.x < frompos.x) then othersidePos = {x=frompos.x+1, y=frompos.y, z=frompos.z} else othersidePos = {x=frompos.x-1, y=frompos.y, z=frompos.z, stackpos=253} things = getThingfromPos(othersidePos) if (things.itemid == 1) then if (getPlayerLevel(things.uid) > 0) then emptyRoom = false end end end end if (emptyRoom == true) then doTeleportThing(cid, othersidePos) doSendMagicEffect(charPos, 2) doSendMagicEffect(frompos, 12) doSendMagicEffect(othersidePos, 10) else doPlayerSendTextMessage(cid, 22, "Esta sala ja esta ocupada.") end return 1 end Editado Novembro 8, 2015 9 anos por DiegoRulez (veja o histórico de edições)
Postado Novembro 8, 2015 9 anos Diretor Solução 1 hora atrás, DiegoRulez disse: Estou com uma Action que coloco nas doors do servidor para "teleportar" o player. Gostaria que adicionassem no script uma opção de adicionar um level determinado para conseguir clicar na porta e se teleportar. Desde já, obrigado! function onUse(cid, item, frompos, item2, topos) -- Beginning of editable Variabels aidNor = 4211 -- Action id for door where training room is north of door aidSou = 4212 -- Action id for door where training room is south of door aidWes = 4213 -- Action id for door where training room is west of door aidEas = 4214 -- Action id for door where training room is east of door -- End of editable Variabels emptyRoom = true charPos = getPlayerPosition(cid) if (item.actionid == aidNor) then if (charPos.y < frompos.y) then othersidePos = {x=frompos.x, y=frompos.y+1, z=frompos.z} else othersidePos = {x=frompos.x, y=frompos.y-1, z=frompos.z, stackpos=253} things = getThingfromPos(othersidePos) if (things.itemid == 1) then if (getPlayerLevel(things.uid) > 0) then emptyRoom = false end end end elseif (item.actionid == aidSou) then if (charPos.y > frompos.y) then othersidePos = {x=frompos.x, y=frompos.y-1, z=frompos.z} else othersidePos = {x=frompos.x, y=frompos.y+1, z=frompos.z, stackpos=253} things = getThingfromPos(othersidePos) if (things.itemid == 1) then if (getPlayerLevel(things.uid) > 0) then emptyRoom = false end end end elseif (item.actionid == aidEas) then if (charPos.x > frompos.x) then othersidePos = {x=frompos.x-1, y=frompos.y, z=frompos.z} else othersidePos = {x=frompos.x+1, y=frompos.y, z=frompos.z, stackpos=253} things = getThingfromPos(othersidePos) if (things.itemid == 1) then if (getPlayerLevel(things.uid) > 0) then emptyRoom = false end end end elseif (item.actionid == aidWes) then if (charPos.x < frompos.x) then othersidePos = {x=frompos.x+1, y=frompos.y, z=frompos.z} else othersidePos = {x=frompos.x-1, y=frompos.y, z=frompos.z, stackpos=253} things = getThingfromPos(othersidePos) if (things.itemid == 1) then if (getPlayerLevel(things.uid) > 0) then emptyRoom = false end end end end if (emptyRoom == true) then doTeleportThing(cid, othersidePos) doSendMagicEffect(charPos, 2) doSendMagicEffect(frompos, 12) doSendMagicEffect(othersidePos, 10) else doPlayerSendTextMessage(cid, 22, "Esta sala ja esta ocupada.") end return 1 end tenta function onUse(cid, item, frompos, item2, topos) -- Beginning of editable Variabels aidNor = 4211 -- Action id for door where training room is north of door aidSou = 4212 -- Action id for door where training room is south of door aidWes = 4213 -- Action id for door where training room is west of door aidEas = 4214 -- Action id for door where training room is east of door -- End of editable Variabels emptyRoom = true charPos = getPlayerPosition(cid) if getPlayerLevel(cid) >= 25 then --25 é o level--- if (item.actionid == aidNor) then if (charPos.y < frompos.y) then othersidePos = {x=frompos.x, y=frompos.y+1, z=frompos.z} else othersidePos = {x=frompos.x, y=frompos.y-1, z=frompos.z, stackpos=253} things = getThingfromPos(othersidePos) if (things.itemid == 1) then if (getPlayerLevel(things.uid) > 0) then emptyRoom = false end end end elseif (item.actionid == aidSou) then if (charPos.y > frompos.y) then othersidePos = {x=frompos.x, y=frompos.y-1, z=frompos.z} else othersidePos = {x=frompos.x, y=frompos.y+1, z=frompos.z, stackpos=253} things = getThingfromPos(othersidePos) if (things.itemid == 1) then if (getPlayerLevel(things.uid) > 0) then emptyRoom = false end end end elseif (item.actionid == aidEas) then if (charPos.x > frompos.x) then othersidePos = {x=frompos.x-1, y=frompos.y, z=frompos.z} else othersidePos = {x=frompos.x+1, y=frompos.y, z=frompos.z, stackpos=253} things = getThingfromPos(othersidePos) if (things.itemid == 1) then if (getPlayerLevel(things.uid) > 0) then emptyRoom = false end end end elseif (item.actionid == aidWes) then if (charPos.x < frompos.x) then othersidePos = {x=frompos.x+1, y=frompos.y, z=frompos.z} else othersidePos = {x=frompos.x-1, y=frompos.y, z=frompos.z, stackpos=253} things = getThingfromPos(othersidePos) if (things.itemid == 1) then if (getPlayerLevel(things.uid) > 0) then emptyRoom = false end end end end if (emptyRoom == true) then doTeleportThing(cid, othersidePos) doSendMagicEffect(charPos, 2) doSendMagicEffect(frompos, 12) doSendMagicEffect(othersidePos, 10) else doPlayerSendTextMessage(cid, 22, "Esta sala ja esta ocupada.") end else doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Você precisa ser level 25+ para completar essa quest.") end return 1 end Eu sou um entusiasta da programação apaixonado por ajudar a comunidade open source a crescer. Sempre em busca de novos desafios e oportunidades para contribuir com meu código. #OpenSource #Programação #Contribuição
Postado Novembro 8, 2015 9 anos @Alexy Brocanello Bom trabalho, só tente usar o Spoiler para postar códigos grandes, para seu post ficar mais organizado xD Te ajudei? Clique em Gostei ! ²²²d¬¬b²²² "She's got a smile that it seems to me...." ♪♪
Postado Novembro 8, 2015 9 anos Autor @Alexy Brocanello, funcionou aqui. Uso a versão OTX, provavelmente funcione em TFS também. Obrigado! REP+ Podem fechar o tópico. Editado Novembro 8, 2015 9 anos por DiegoRulez (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.