Ir para conteúdo
  • 0

Door Por Resets


KennyConrad

Pergunta

Queria um script de porta por resets assim vejam a SS

 

219nx4g.png

 

o meu sistema de resets não tem storage, uso o advanced reset sistem 2.0 do marcelo

 

e tem uma coisa tipo as portas de level iriam checar os resets exemplo 1 porta de lvl 300 se o player ja tiver 1 reset ele poderá passar mesmo sendo lvl 8

 

e acho que pra tentar fazer isso poderiam tentar usar essa função aki ou algo parecido.

 


function getResets(cid)
local check = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..getPlayerGUID(cid))
return check:getDataInt("reset") <= 0 and 0 or check:getDataInt("reset") end

 

espero que possam me ajudar valendo 3 REPs +

Link para o comentário
Compartilhar em outros sites

Posts Recomendados

  • 0

function getResets(cid)
local check = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..getPlayerGUID(cid))
return check:getDataInt("reset") <= 0 and 0 or check:getDataInt("reset") end
function onUse(cid, item, fromPosition)
local reset_need = 5
if getResets(cid) < reset_need then
return  doPlayerSendCancel(cid,"You dont have " .. reset_need .. " resets.")
end
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, topos, true)
doSendMagicEffect(getPlayerPosition(cid), 10)
return true
end

 

<action actionid="7055" script="NOME DO SEU SCRIPT.lua" />

Editado por Vodkartzin
Link para o comentário
Compartilhar em outros sites

  • 0

@ vodkartizin

 

mano testei aki e quando o player clica varias vezes na porta a porta vai se transformando em outras portas lol ?

e tambem quando o player da lok na porta não aparece os resets como mostrei la na imagem é quando o player dar lok na porta aparecer aquela mensagem

 

deu esse erro aki no distro

 


[11/11/2012 14:03:48] [Error - Action Interface] 
[11/11/2012 14:03:48] data/actions/scripts/portareset.lua:onUse
[11/11/2012 14:03:48] Description: 
[11/11/2012 14:03:48] attempt to index a nil value
[11/11/2012 14:03:48] stack traceback:
[11/11/2012 14:03:48]  [C]: in function 'doTeleportThing'
[11/11/2012 14:03:48]  data/actions/scripts/portareset.lua:10: in function <data/actions/scripts/portareset.lua:4>

 

e creio que dessa forma ai as portas de level não vao deixar os caras passarem mesmo tendo resets acho que o correto seria editar no action/scripts/other/doors


local function checkStackpos(item, position)
position.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
local thing = getThingfromPos(position)
position.stackpos = STACKPOS_TOP_FIELD
local field = getThingfromPos(position)
if(item.uid ~= thing.uid and thing.itemid >= 100 or field.itemid ~= 0) then
return FALSE
end

return TRUE
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
local nuevas = {
{closed=10269, open=10270},
{closed=10272, open=10273},
{closed=10274, open=10275},
{closed=10276, open=10277},
{closed=10278, open=10279},
{closed=10280, open=10281},
{closed=10282, open=10283},
{closed=10284, open=10285},
{closed=10469, open=10470},
{closed=10471, open=10472},
{closed=10473, open=10474},
{closed=10475, open=10476},
{closed=10478, open=10479},
{closed=10480, open=10481},
{closed=10482, open=10483},
{closed=10484, open=10485},
}
for ia = 1,#nuevas do
if (item.itemid == nuevas[ia].closed) then
doTransformItem(item.uid, nuevas[ia].open)
elseif (item.itemid == nuevas[ia].open) then
doTransformItem(item.uid, nuevas[ia].closed)
end
end

if(getItemLevelDoor(item.itemid) > 0) then
if(item.actionid > 0 and getPlayerLevel(cid) >= (item.actionid - getItemLevelDoor(item.itemid))) then
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, toPosition, TRUE)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Only the worthy may pass.")
end

return TRUE
end

if(isInArray(specialDoors, item.itemid) == TRUE) then
if(item.actionid ~= 0 and getPlayerStorageValue(cid, item.actionid) ~= -1) then
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, toPosition, TRUE)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door seems to be sealed against unwanted intruders.")
end

return TRUE
end

if(isInArray(keys, item.itemid) == TRUE) then
if(itemEx.actionid > 0) then
if(item.actionid == itemEx.actionid) then
if doors[itemEx.itemid] ~= nil then
doTransformItem(itemEx.uid, doors[itemEx.itemid])
return TRUE
end
end

doPlayerSendCancel(cid, "The key does not match.")
return TRUE
end

return FALSE
end

if(isInArray(horizontalOpenDoors, item.itemid) == TRUE and checkStackpos(item, fromPosition) == TRUE) then
local newPosition = toPosition
newPosition.y = newPosition.y + 1
local doorPosition = fromPosition
doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
local doorCreature = getThingfromPos(doorPosition)
if(doorCreature.itemid ~= 0) then
if(getTilePzInfo(doorPosition) == TRUE and getTilePzInfo(newPosition) == FALSE and doorCreature.uid ~= cid) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
else
doTeleportThing(doorCreature.uid, newPosition, TRUE)
if(isInArray(closingDoors, item.itemid) ~= TRUE) then
doTransformItem(item.uid, item.itemid - 1)
end
end

return TRUE
end

doTransformItem(item.uid, item.itemid - 1)
return TRUE
end

if(isInArray(verticalOpenDoors, item.itemid) == TRUE and checkStackpos(item, fromPosition) == TRUE) then
local newPosition = toPosition
newPosition.x = newPosition.x + 1
local doorPosition = fromPosition
doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
local doorCreature = getThingfromPos(doorPosition)
if(doorCreature.itemid ~= 0) then
if(getTilePzInfo(doorPosition) == TRUE and getTilePzInfo(newPosition) == FALSE and doorCreature.uid ~= cid) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
else
doTeleportThing(doorCreature.uid, newPosition, TRUE)
if(isInArray(closingDoors, item.itemid) ~= TRUE) then
doTransformItem(item.uid, item.itemid - 1)
end
end

return TRUE
end

doTransformItem(item.uid, item.itemid - 1)
return TRUE
end

if(doors[item.itemid] ~= nil and checkStackpos(item, fromPosition) == TRUE) then
if(item.actionid == 0) then
doTransformItem(item.uid, doors[item.itemid])
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is locked.")
end

return TRUE
end

return FALSE
end

Link para o comentário
Compartilhar em outros sites

  • 0

@Kenny

Quanto ao erro no script troque por este:

function getResets(cid)

local check = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..getPlayerGUID(cid))

return check:getDataInt("reset") <= 0 and 0 or check:getDataInt("reset") end

function onUse(cid, item, fromPosition)

local reset_need = 5

if getResets(cid) < reset_need then

return doPlayerSendCancel(cid,"You dont have " .. reset_need .. " resets.")

end

doTransformItem(item.uid, item.itemid + 1)

doTeleportThing(cid, toPosition)

doSendMagicEffect(getPlayerPosition(cid), 10)

return true

end

Editado por Lummos
Link para o comentário
Compartilhar em outros sites

  • 0

@lummos o erro continua eu no momento estou usando servidor verção 8.60

 

ao cliclar na porta a porta vai se transformando em outras portas e vai aparecendo esses erros no distro

 

 

 

 

[11/11/2012 14:16:24] [Error - Action Interface]

[11/11/2012 14:16:24] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:24] Description:

[11/11/2012 14:16:24] attempt to index a nil value

[11/11/2012 14:16:24] stack traceback:

[11/11/2012 14:16:24] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:24] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:24] [Error - Action Interface]

[11/11/2012 14:16:24] data/actions/scripts/other/doors.lua:onUse

[11/11/2012 14:16:24] Description:

[11/11/2012 14:16:24] (luaDoTransformItem) Item not found

 

[11/11/2012 14:16:25] [Error - Action Interface]

[11/11/2012 14:16:25] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:25] Description:

[11/11/2012 14:16:25] attempt to index a nil value

[11/11/2012 14:16:25] stack traceback:

[11/11/2012 14:16:25] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:25] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:26] [Error - Action Interface]

[11/11/2012 14:16:26] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:26] Description:

[11/11/2012 14:16:26] attempt to index a nil value

[11/11/2012 14:16:26] stack traceback:

[11/11/2012 14:16:26] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:26] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:26] [Error - Action Interface]

[11/11/2012 14:16:26] data/actions/scripts/other/doors.lua:onUse

[11/11/2012 14:16:26] Description:

[11/11/2012 14:16:26] (luaDoTransformItem) Item not found

 

[11/11/2012 14:16:26] [Error - Action Interface]

[11/11/2012 14:16:26] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:26] Description:

[11/11/2012 14:16:26] attempt to index a nil value

[11/11/2012 14:16:26] stack traceback:

[11/11/2012 14:16:26] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:26] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:27] [Error - Action Interface]

[11/11/2012 14:16:27] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:27] Description:

[11/11/2012 14:16:27] attempt to index a nil value

[11/11/2012 14:16:27] stack traceback:

[11/11/2012 14:16:27] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:27] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:27] [Error - Action Interface]

[11/11/2012 14:16:27] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:27] Description:

[11/11/2012 14:16:27] attempt to index a nil value

[11/11/2012 14:16:27] stack traceback:

[11/11/2012 14:16:27] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:27] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:27] [Error - Action Interface]

[11/11/2012 14:16:27] data/actions/scripts/other/doors.lua:onUse

[11/11/2012 14:16:27] Description:

[11/11/2012 14:16:27] (luaDoTransformItem) Item not found

 

[11/11/2012 14:16:27] [Error - Action Interface]

[11/11/2012 14:16:27] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:27] Description:

[11/11/2012 14:16:27] attempt to index a nil value

[11/11/2012 14:16:27] stack traceback:

[11/11/2012 14:16:27] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:27] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:28] [Error - Action Interface]

[11/11/2012 14:16:28] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:28] Description:

[11/11/2012 14:16:28] attempt to index a nil value

[11/11/2012 14:16:28] stack traceback:

[11/11/2012 14:16:28] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:28] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:28] [Error - Action Interface]

[11/11/2012 14:16:28] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:28] Description:

[11/11/2012 14:16:28] attempt to index a nil value

[11/11/2012 14:16:28] stack traceback:

[11/11/2012 14:16:28] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:28] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:28] [Error - Action Interface]

[11/11/2012 14:16:28] data/actions/scripts/other/doors.lua:onUse

[11/11/2012 14:16:28] Description:

[11/11/2012 14:16:28] (luaDoTransformItem) Item not found

 

[11/11/2012 14:16:28] [Error - Action Interface]

[11/11/2012 14:16:28] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:28] Description:

[11/11/2012 14:16:28] attempt to index a nil value

[11/11/2012 14:16:28] stack traceback:

[11/11/2012 14:16:28] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:28] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:29] [Error - Action Interface]

[11/11/2012 14:16:29] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:29] Description:

[11/11/2012 14:16:29] attempt to index a nil value

[11/11/2012 14:16:29] stack traceback:

[11/11/2012 14:16:29] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:29] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:29] [Error - Action Interface]

[11/11/2012 14:16:29] data/actions/scripts/other/doors.lua:onUse

[11/11/2012 14:16:29] Description:

[11/11/2012 14:16:29] (luaDoTransformItem) Item not found

 

[11/11/2012 14:16:29] [Error - Action Interface]

[11/11/2012 14:16:29] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:29] Description:

[11/11/2012 14:16:29] attempt to index a nil value

[11/11/2012 14:16:29] stack traceback:

[11/11/2012 14:16:29] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:29] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:29] [Error - Action Interface]

[11/11/2012 14:16:29] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:29] Description:

[11/11/2012 14:16:29] attempt to index a nil value

[11/11/2012 14:16:29] stack traceback:

[11/11/2012 14:16:29] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:29] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:29] [Error - Action Interface]

[11/11/2012 14:16:29] data/actions/scripts/other/doors.lua:onUse

[11/11/2012 14:16:29] Description:

[11/11/2012 14:16:29] (luaDoTransformItem) Item not found

 

[11/11/2012 14:16:30] [Error - Action Interface]

[11/11/2012 14:16:30] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:30] Description:

[11/11/2012 14:16:30] attempt to index a nil value

[11/11/2012 14:16:30] stack traceback:

[11/11/2012 14:16:30] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:30] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:30] [Error - Action Interface]

[11/11/2012 14:16:30] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:30] Description:

[11/11/2012 14:16:30] attempt to index a nil value

[11/11/2012 14:16:30] stack traceback:

[11/11/2012 14:16:30] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:30] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:30] [Error - Action Interface]

[11/11/2012 14:16:30] data/actions/scripts/other/doors.lua:onUse

[11/11/2012 14:16:30] Description:

[11/11/2012 14:16:30] (luaDoTransformItem) Item not found

 

[11/11/2012 14:16:30] [Error - Action Interface]

[11/11/2012 14:16:30] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:30] Description:

[11/11/2012 14:16:30] attempt to index a nil value

[11/11/2012 14:16:30] stack traceback:

[11/11/2012 14:16:30] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:30] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:30] [Error - Action Interface]

[11/11/2012 14:16:30] data/actions/scripts/portareset.lua:onUse

[11/11/2012 14:16:30] Description:

[11/11/2012 14:16:31] attempt to index a nil value

[11/11/2012 14:16:31] stack traceback:

[11/11/2012 14:16:31] [C]: in function 'doTeleportThing'

[11/11/2012 14:16:31] data/actions/scripts/portareset.lua:1: in function <data/actions/scripts/portareset.lua:1>

 

[11/11/2012 14:16:31] [Error - Action Interface]

[11/11/2012 14:16:31] data/actions/scripts/other/doors.lua:onUse

[11/11/2012 14:16:31] Description:

[11/11/2012 14:16:31] (luaDoTransformItem) Item not found

 

 

Editado por KennyxD
Link para o comentário
Compartilhar em outros sites

  • 0

ERRO MEU, ESQUECI A VARIÁVEL

 

function getResets(cid)
local check = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..getPlayerGUID(cid))
return check:getDataInt("reset") <= 0 and 0 or check:getDataInt("reset") end
function onUse(cid, item, frompos, item2, topos)
local reset_need = 5
if getResets(cid) < reset_need then
return doPlayerSendCancel(cid,"You dont have " .. reset_need .. " resets.")
end
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, topos, TRUE)
return true
end

Link para o comentário
Compartilhar em outros sites

  • 0

@ vodkartzin

 

@ edit

 

fiz um pequeno ajuste no script acho que ficou melhor assim

 


function getResets(cid)
local check = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..getPlayerGUID(cid))
return check:getDataInt("reset") <= 0 and 0 or check:getDataInt("reset") end
function onUse(cid, item, frompos, item2, topos)
local reset_need = 30
if getResets(cid) < reset_need then
return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Voce não tem mais de "..reset_need.." reset")
end
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, topos, TRUE)
return true
end

 

desse geito a mensagem aparece na tela do player na cor verde.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

mais aki mano não teria como colocar pra ao player dar lok na porta aparecer igual na print abaixo e pra as portas de level ignorar quem tiver resets ou seja uma porta de lvl 300 se o player tiver 1 reset + ele pode passar por ela sem problemas.

 

219nx4g.png

Editado por KennyxD
Link para o comentário
Compartilhar em outros sites

  • 0

Vodkart

TIpo, tem uma porta de level 100 para passar ai Jão tem 1 reset e level 12 só que jão pode passar na porta de level 100 porque jão tem 1 reset. Entendeu?

 

Kenny

Aceite meu convite no MSN.

Link para o comentário
Compartilhar em outros sites

  • 0

@vodkartin não foi não porque se fosse assim ele duplicou as portas ? porque quando da lok na porta de level aparece

15:55 You see a gate of expertise for level 100.

 

e fora que se fosse nos items como que a cada porta de level e resets diferentes muda a mensagem ?

 

@ edit no meu items ta assim

 


<item id="1245" article="a" name="gate of expertise">
<attribute key="type" value="door" />
<attribute key="levelDoor" value="1000" />
<attribute key="blockprojectile" value="1" />

 

ai eu coloca-se assim

 


<item id="1245" article="a" name="gate of expertise">
<attribute key="type" value="door" />
<attribute key="levelDoor" value="1000" />
<attribute key="resetDoor" value="3000" />
<attribute key="blockprojectile" value="1" />

 

ficaria igual ? a imagem acima ?

Editado por KennyxD
Link para o comentário
Compartilhar em outros sites

  • 0

Vodkart

TIpo, tem uma porta de level 100 para passar ai Jão tem 1 reset e level 12 só que jão pode passar na porta de level 100 porque jão tem 1 reset. Entendeu?

 

Kenny

Aceite meu convite no MSN.

 

ai vc tem que editar no script

 

if level >= 100 or reset >= 1 then

...

Link para o comentário
Compartilhar em outros sites

  • 0

mano mais ai vo ter que modificar todas as portas do meu servidor lol eu quero que todas as portas de level os players que tiver resets pode passar nelas sem precisar do level

 

 

@ Edit

 

Urgente Ajuda ae percebi agora ta com um bug no script o player clica na porta ai ele abre ela ai quando ele clica denovo o certo era a porta fechar mais a porta esta transformando em outras portas

 


function getResets(cid)
local check = db.getResult("SELECT `reset` FROM `players` WHERE `id`= "..getPlayerGUID(cid))
return check:getDataInt("reset") <= 0 and 0 or check:getDataInt("reset") end
function onUse(cid, item, frompos, item2, topos)
local reset_need = 30
if getResets(cid) < reset_need then
return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Voce não tem mais de "..reset_need.." reset")
end
doTransformItem(item.uid, item.itemid + 1)
doTeleportThing(cid, topos, TRUE)
return true
end

 

e vodkartzin estou sem REP no momento so amanha que vo ter ai te dou mais arruma o bug ai por favor.

 

alguem ajuda ae por favor ta foda esse bug ja tentei arruma não consegui =(

 

@ edit

 

topico reportado para moverem

Editado por KennyxD
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...