piratadoidao 1 Posted December 17, 2012 Report Share Posted December 17, 2012 Olá Galera, tudo bem ? Então eu gostaria que alguém concertasse esse Script para mim... É um sisteminha de "Shopping" por baú, onde é colocado uma moeda, itens e a quantidade a ser paga... Funcionava perfeitamente no meu antigo Server.. Porém, agora ele esta com o Seguinte problema: - Mesmo que o player não possua a "moeda", ele realiza a compra! - Se o player possuir a quantidade de moedas, o script remove normal e entrega o item normal... Ai é que esta... de qualquer jeito.. ele esta recebendo o item ;s Gostaria que arrumassem para que isso não fosse possível... Ps: Quando é realizada uma compra, o Baú se transforma, se possível, retirar isso também... Obrigado. Aqui está o Script: local coin = 6527 local lever = { [6001] = {5,7453}, [6002] = {5,7390}, [6003] = {5,8929}, [6004] = {5,7429}, [6005] = {5,7366}, [6006] = {4,2533}, [6007] = {7,7457}, [6008] = {6,2122}, [6009] = {6,10309}, [6010] = {4,10310}, [6011] = {3,9735}, [6012] = {3,10016}, [6013] = {2,2346}, [6014] = {2,8301}, [6015] = {4,8302}, [6016] = {4,7896}, [6017] = {4,7897}, [6018] = {4,7902}, [6019] = {4,12642}, [6020] = {5,5741}, [6021] = {4,12643}, [6022] = {3,12656}, [6023] = {3,2662}, [6024] = {4,7459}, [6025] = {4,7403}, [6026] = {4,3983}, [6027] = {4,12645}, [6028] = {4,12644} } function onUse(cid,item,fromPosition,itemEx,toPosition) if doPlayerRemoveItem(cid,coin,lever[item.actionid][1]) == FALSE then return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Você precisa de "..lever[item.actionid][1].." " ..getItemNameById(coin)) end doPlayerAddItem(cid,lever[item.actionid][2]) doPlayerSendTextMessage(cid,22,"você comprou um " .. getItemNameById(lever[item.actionid][2])) doSendMagicEffect(getCreaturePosition(cid), math.random(28,30)) doTransformItem(item.uid, item.itemid == 1748 and 1748 or 1748) return true end Obs: Server TFS 0.4.0 / 8.60 Link to comment https://xtibia.com/forum/topic/201636-shopping-ba%C3%BA/ Share on other sites More sharing options...
0 Yan Oliveira 214 Posted December 17, 2012 Report Share Posted December 17, 2012 Não testei... local coin = 6527 local level = { [6001] = {5,7453}, [6002] = {5,7390}, [6003] = {5,8929}, [6004] = {5,7429}, [6005] = {5,7366}, [6006] = {4,2533}, [6007] = {7,7457}, [6008] = {6,2122}, [6009] = {6,10309}, [6010] = {4,10310}, [6011] = {3,9735}, [6012] = {3,10016}, [6013] = {2,2346}, [6014] = {2,8301}, [6015] = {4,8302}, [6016] = {4,7896}, [6017] = {4,7897}, [6018] = {4,7902}, [6019] = {4,12642}, [6020] = {5,5741}, [6021] = {4,12643}, [6022] = {3,12656}, [6023] = {3,2662}, [6024] = {4,7459}, [6025] = {4,7403}, [6026] = {4,3983}, [6027] = {4,12645}, [6028] = {4,12644} } function onUse(cid,item,fromPosition,itemEx,toPosition) if doPlayerRemoveItem(cid,coin,lever[item.actionid][1]) == true then return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Você precisa de "..lever[item.actionid][1].." " ..getItemNameById(coin)) end doPlayerAddItem(cid,level[item.actionid][2]) doPlayerSendTextMessage(cid,22,"você comprou um " .. getItemNameById(lever[item.actionid][2])) doSendMagicEffect(getCreaturePosition(cid), math.random(28,30)) doTransformItem(item.uid, item.itemid == 1748 and 1748) return true end Link to comment https://xtibia.com/forum/topic/201636-shopping-ba%C3%BA/#findComment-1415015 Share on other sites More sharing options...
0 Roksas 846 Posted December 17, 2012 Report Share Posted December 17, 2012 @Yan18 Também pensei em fazer isso, mas no caso ele iria retirar o item mesmo se aparecesse a mensagem "ELSE" não? Link to comment https://xtibia.com/forum/topic/201636-shopping-ba%C3%BA/#findComment-1415031 Share on other sites More sharing options...
0 Yan Oliveira 214 Posted December 17, 2012 Report Share Posted December 17, 2012 Não pois, no script dele tava o item 1748 retornando 1748. Link to comment https://xtibia.com/forum/topic/201636-shopping-ba%C3%BA/#findComment-1415040 Share on other sites More sharing options...
0 piratadoidao 1 Posted December 17, 2012 Author Report Share Posted December 17, 2012 Aew.. Então... Testei aqui.. aconteceu o seguinte... Quando clico sem ter a quantidade necessaria de moeda... Ele apareceu: " 4:10 You have found 6001 of dead orc. " Apareceu um Orc morto no chão! (kkkkkkkkkk) No Distro aparece: " venda.lua: 34: attemp to index global 'lever' <a nil value> " Link to comment https://xtibia.com/forum/topic/201636-shopping-ba%C3%BA/#findComment-1415064 Share on other sites More sharing options...
0 Yan Oliveira 214 Posted December 17, 2012 Report Share Posted December 17, 2012 (edited) local coin = 6527 local level = { [6001] = {5,7453}, [6002] = {5,7390}, [6003] = {5,8929}, [6004] = {5,7429}, [6005] = {5,7366}, [6006] = {4,2533}, [6007] = {7,7457}, [6008] = {6,2122}, [6009] = {6,10309}, [6010] = {4,10310}, [6011] = {3,9735}, [6012] = {3,10016}, [6013] = {2,2346}, [6014] = {2,8301}, [6015] = {4,8302}, [6016] = {4,7896}, [6017] = {4,7897}, [6018] = {4,7902}, [6019] = {4,12642}, [6020] = {5,5741}, [6021] = {4,12643}, [6022] = {3,12656}, [6023] = {3,2662}, [6024] = {4,7459}, [6025] = {4,7403}, [6026] = {4,3983}, [6027] = {4,12645}, [6028] = {4,12644} } function onUse(cid,item,fromPosition,itemEx,toPosition) if doPlayerRemoveItem(cid,coin,lever[item.actionid][1]) == true then return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Você precisa de "..lever[item.actionid][1].." " ..getItemNameById(coin)) end doPlayerAddItem(cid,level[item.actionid][2]) doPlayerSendTextMessage(cid,22,"você comprou um " .. getItemNameById(lever[item.actionid][2])) doSendMagicEffect(getCreaturePosition(cid), math.random(28,30)) doTransformItem(item.uid, item.itemid == 1748) return true end Poste o script do venda.lua Edited December 17, 2012 by Yan18 Link to comment https://xtibia.com/forum/topic/201636-shopping-ba%C3%BA/#findComment-1415144 Share on other sites More sharing options...
0 piratadoidao 1 Posted December 17, 2012 Author Report Share Posted December 17, 2012 Então.. o script Venda.lua , é esse ai que você postou mesmo... O baú quando clico agora, esta dando: "It is empty." No distro aparece: " [Error action - Action Interface] data/actions/scripts/vendas/venda.lua : OnUse [Description] data/actions/scripts/vendas/venda.lua :34: attemp to index global 'lever' <a nil value > stack traceback: data/actions/scripts/vendas/venda.lua :34: in function <data/actions/scripts/vendas/venda.lua :33:> " Link to comment https://xtibia.com/forum/topic/201636-shopping-ba%C3%BA/#findComment-1415169 Share on other sites More sharing options...
0 Yan Oliveira 214 Posted December 17, 2012 Report Share Posted December 17, 2012 level estava escrito lever, testa ae: local coin = 6527 local level = { [6001] = {5,7453}, [6002] = {5,7390}, [6003] = {5,8929}, [6004] = {5,7429}, [6005] = {5,7366}, [6006] = {4,2533}, [6007] = {7,7457}, [6008] = {6,2122}, [6009] = {6,10309}, [6010] = {4,10310}, [6011] = {3,9735}, [6012] = {3,10016}, [6013] = {2,2346}, [6014] = {2,8301}, [6015] = {4,8302}, [6016] = {4,7896}, [6017] = {4,7897}, [6018] = {4,7902}, [6019] = {4,12642}, [6020] = {5,5741}, [6021] = {4,12643}, [6022] = {3,12656}, [6023] = {3,2662}, [6024] = {4,7459}, [6025] = {4,7403}, [6026] = {4,3983}, [6027] = {4,12645}, [6028] = {4,12644} } function onUse(cid,item,fromPosition,itemEx,toPosition) if doPlayerRemoveItem(cid,coin,level[item.actionid][1]) == true then return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Você precisa de "..lever[item.actionid][1].." " ..getItemNameById(coin)) end doPlayerAddItem(cid,level[item.actionid][2]) doPlayerSendTextMessage(cid,22,"você comprou um " .. getItemNameById(lever[item.actionid][2])) doSendMagicEffect(getCreaturePosition(cid), math.random(28,30)) doTransformItem(item.uid, item.itemid == 1748 and 1748) return true end Link to comment https://xtibia.com/forum/topic/201636-shopping-ba%C3%BA/#findComment-1415174 Share on other sites More sharing options...
0 piratadoidao 1 Posted December 18, 2012 Author Report Share Posted December 18, 2012 (edited) Opa Testei aqui... agora funcionou... Mas ta com o mesmo problema do inicio... Mesmo que eu não tenha a moeda ele da o item do mesmo jeito! ;s kk' @EDIT Ps: Consegui arrumar aqui o Script! Agora esta funcionando perfeitamente! Obrigado ai pela ajuda... REP+. Podem fechar o topico Edited December 18, 2012 by piratadoidao Link to comment https://xtibia.com/forum/topic/201636-shopping-ba%C3%BA/#findComment-1415565 Share on other sites More sharing options...
0 Roksas 846 Posted December 18, 2012 Report Share Posted December 18, 2012 Dúvida sanada, reportado! Link to comment https://xtibia.com/forum/topic/201636-shopping-ba%C3%BA/#findComment-1415866 Share on other sites More sharing options...
0 Piabeta Kun 359 Posted December 18, 2012 Report Share Posted December 18, 2012 movido! Link to comment https://xtibia.com/forum/topic/201636-shopping-ba%C3%BA/#findComment-1415872 Share on other sites More sharing options...
Question
piratadoidao 1
Olá Galera, tudo bem ?
Então eu gostaria que alguém concertasse esse Script para mim...
É um sisteminha de "Shopping" por baú, onde é colocado uma moeda, itens e a quantidade a ser paga...
Funcionava perfeitamente no meu antigo Server.. Porém, agora ele esta com o Seguinte problema:
- Mesmo que o player não possua a "moeda", ele realiza a compra!
- Se o player possuir a quantidade de moedas, o script remove normal e entrega o item normal...
Ai é que esta... de qualquer jeito.. ele esta recebendo o item ;s
Gostaria que arrumassem para que isso não fosse possível...
Ps: Quando é realizada uma compra, o Baú se transforma, se possível, retirar isso também...
Obrigado.
Aqui está o Script:
local coin = 6527
local lever = {
[6001] = {5,7453},
[6002] = {5,7390},
[6003] = {5,8929},
[6004] = {5,7429},
[6005] = {5,7366},
[6006] = {4,2533},
[6007] = {7,7457},
[6008] = {6,2122},
[6009] = {6,10309},
[6010] = {4,10310},
[6011] = {3,9735},
[6012] = {3,10016},
[6013] = {2,2346},
[6014] = {2,8301},
[6015] = {4,8302},
[6016] = {4,7896},
[6017] = {4,7897},
[6018] = {4,7902},
[6019] = {4,12642},
[6020] = {5,5741},
[6021] = {4,12643},
[6022] = {3,12656},
[6023] = {3,2662},
[6024] = {4,7459},
[6025] = {4,7403},
[6026] = {4,3983},
[6027] = {4,12645},
[6028] = {4,12644}
}
function onUse(cid,item,fromPosition,itemEx,toPosition)
if doPlayerRemoveItem(cid,coin,lever[item.actionid][1]) == FALSE then
return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Você precisa de "..lever[item.actionid][1].." " ..getItemNameById(coin))
end
doPlayerAddItem(cid,lever[item.actionid][2])
doPlayerSendTextMessage(cid,22,"você comprou um " .. getItemNameById(lever[item.actionid][2]))
doSendMagicEffect(getCreaturePosition(cid), math.random(28,30))
doTransformItem(item.uid, item.itemid == 1748 and 1748 or 1748)
return true
end
Obs: Server TFS 0.4.0 / 8.60
Link to comment
https://xtibia.com/forum/topic/201636-shopping-ba%C3%BA/Share on other sites
10 answers to this question
Recommended Posts