Ir para conteúdo
  • Cadastre-se

shop.lua que entrega items ao depot


Posts Recomendados

tive uma ideia e queria muito esse script até recompenso quem fizer pra mim, o player compra item no shop e chega no depot, dentro de uma parcel ou só o item mesmo

 

alguem me ajuda ?


up


up

Link para o post
Compartilhar em outros sites

Verei pra você, pois achei interessante, já edito aqui.

 

Vamos ver se daremos sorte.

 

 

#EDIT:

Com o script do Shop original funcionando, apenas substitua o interior do mesmo, ou seja, delete tudo dentro do "shop.lua" e coloque este dentro:

 

-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 19
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)

local worldname = "NOME DO MUNDO"  ----- CONFIGURE AQUI

local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
if(result_plr:getID() ~= -1) then
while(true) do
id = tonumber(result_plr:getDataInt("id"))
action = tostring(result_plr:getDataString("action"))
delete = tonumber(result_plr:getDataInt("delete_it"))
cid = getCreatureByName(tostring(result_plr:getDataString("name")))
if isPlayer(cid) == TRUE then
local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
local container_id = tonumber(result_plr:getDataInt("param3"))
local container_count = tonumber(result_plr:getDataInt("param4"))
local add_item_type = tostring(result_plr:getDataString("param5"))
local add_item_name = tostring(result_plr:getDataString("param6"))
local received_item = 0
local full_weight = 0
if add_item_type == 'container' then
container_weight = getItemWeightById(container_id, 1)
if isItemRune(itemtogive_id) == TRUE then
items_weight = container_count * getItemWeightById(itemtogive_id, 1)
else
items_weight = container_count * getItemWeightById(itemtogive_id, itemtogive_count)
end
full_weight = items_weight + container_weight
else
full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
if isItemRune(itemtogive_id) == TRUE then
full_weight = getItemWeightById(itemtogive_id, 1)
else
full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
end
end
local free_cap = getPlayerFreeCap(cid)
if full_weight <= free_cap then
if add_item_type == 'container' then
local new_container = doCreateItemEx(container_id, 1)
local iter = 0
while iter ~= container_count do
doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
iter = iter + 1
end
received_item = doPlayerAddItemEx(cid, new_container)
else
local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
received_item = doPlayerSendMailByName(getCreatureName(cid), new_item, getPlayerTown(cid), worldname)
end
if received_item == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from Childs Play Shopping.')
db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
end
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
end
end
if not(result_plr:next()) then
break
end
end
result_plr:free()
end
return TRUE
end

Você só precisa configurar esta parte.

local worldname = "NOME DO MUNDO"  ----- CONFIGURE AQUI

Colocando o nome do mundo que está registrado no config.lua do seu OTServ.

 

Teste e poste o resultado.

Boa sorte.

Editado por Adriano SwaTT (veja o histórico de edições)

Gosta do meu trabalho?

Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs.

 

Atenciosamente,
Adriano Swatt'

 

Para ver meus tutoriais acesse meu perfil.

 

cbCyOSZ.png

Link para o post
Compartilhar em outros sites

então eu uso a tfs 1.0 para windows xp, dei reload e nao funfou e nem deu erro mais nao aparece nada, vou esperar o server save e te aviso

Link para o post
Compartilhar em outros sites
  • 1 month later...

Faça assim, poste seu script já editado aqui pra eu ver como configurou.

Gosta do meu trabalho?

Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs.

 

Atenciosamente,
Adriano Swatt'

 

Para ver meus tutoriais acesse meu perfil.

 

cbCyOSZ.png

Link para o post
Compartilhar em outros sites
-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 19
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
 
local worldname = "Thera"  ----- CONFIGURE AQUI
 
local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
if(result_plr:getID() ~= -1) then
while(true) do
id = tonumber(result_plr:getDataInt("id"))
action = tostring(result_plr:getDataString("action"))
delete = tonumber(result_plr:getDataInt("delete_it"))
cid = getCreatureByName(tostring(result_plr:getDataString("name")))
if isPlayer(cid) == TRUE then
local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
local container_id = tonumber(result_plr:getDataInt("param3"))
local container_count = tonumber(result_plr:getDataInt("param4"))
local add_item_type = tostring(result_plr:getDataString("param5"))
local add_item_name = tostring(result_plr:getDataString("param6"))
local received_item = 0
local full_weight = 0
if add_item_type == 'container' then
container_weight = getItemWeightById(container_id, 1)
if isItemRune(itemtogive_id) == TRUE then
items_weight = container_count * getItemWeightById(itemtogive_id, 1)
else
items_weight = container_count * getItemWeightById(itemtogive_id, itemtogive_count)
end
full_weight = items_weight + container_weight
else
full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
if isItemRune(itemtogive_id) == TRUE then
full_weight = getItemWeightById(itemtogive_id, 1)
else
full_weight = getItemWeightById(itemtogive_id, itemtogive_count)
end
end
local free_cap = getPlayerFreeCap(cid)
if full_weight <= free_cap then
if add_item_type == 'container' then
local new_container = doCreateItemEx(container_id, 1)
local iter = 0
while iter ~= container_count do
doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
iter = iter + 1
end
received_item = doPlayerAddItemEx(cid, new_container)
else
local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
received_item = doPlayerSendMailByName(getCreatureName(cid), new_item, getPlayerTown(cid), worldname)
end
if received_item == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received '.. add_item_name ..' from Childs Play Shopping.')
db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. Please make place for this item in your backpack/hands and wait about '.. SQL_interval ..' seconds to get it.')
end
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> '.. add_item_name ..' << from OTS shop is waiting for you. It weight is '.. full_weight ..' oz., you have only '.. free_cap ..' oz. free capacity. Put some items in depot and wait about '.. SQL_interval ..' seconds to get it.')
end
end
if not(result_plr:next()) then
break
end
end
result_plr:free()
end
return TRUE
end
Link para o post
Compartilhar em outros sites

O nome do mundo é só "Thera"?

Quando loga na account aparece o nome do personagem e na frente (Thera)?

Gosta do meu trabalho?

Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs.

 

Atenciosamente,
Adriano Swatt'

 

Para ver meus tutoriais acesse meu perfil.

 

cbCyOSZ.png

Link para o post
Compartilhar em outros sites
  • 3 years later...

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por batataa
      Bom galera, o meu problema é o seguinte, joguei um ots 10.41 muito bom baiak, mas ele loga alguns players do nada, enfim, o ots é bom o mapa é bom mas não encontro para download em nenhum lugar.
         Também queria saber assim, eu não entendo como o TFS funciona, antigamente eu baixava os ots e vinha tudo dentro de uma pasta, mas hoje em dia não, estão vindo em pastas diferentes e não sei como juntar ou, queria saber os passos para agrupar tudo em uma pasta para clickar no TFS e funcionar, sobre o ip e liberar a port eu sei, esse de agrupar o ots é meu maior problema mesmo. agradeço desde já !
    • Por costantino2
      Server Specs
      - Server version: 10.41.
      -TFS: 1.0


      Main features
      - Protection Zone in Towns. (Only Idea...)
      - If you dont eat your player can die! (Only Idea...)
      - Capacity Effects player speed, quick revive (In progress...)
      - Upgrade your items with specials objects. (In progress...)
      -blacksmith System (Completed)
      - Special potions, Antidotes, Speed Flask, support Potions... (In progress...)
      - Tame your favorite pet to help us in your adventure. (In progress...)
      - Extract pearls, gems, iron pieces and other valuable with minery. (In progress...)
      - Market system, Specialized npc's, and renting mounts. (Only Idea...)
      - Sell Faster-regeneration foods with your high-cook skills. (Only Idea...)
      - Random global missions (Bosses, young bosses, Raids, Strange npcs...) (Only Idea...)
      - Edited sprites for Dungeons, Quests, Bosses, Items, outfits (In progress...)
      - Y.A.D. System - If you die after your player dissapear! (Only Idea...)
      - Client edited for LegendOfAincrad with music and other features! (In progress...)
      -Spells of swords to attack with the speed of lightning (Only Idea...)
      -teleportation system so that when killing a boss unlocks the next floor (Completed)
      -Not being able to disconnect unless you fall asleep (In progress...)
      -Global daily missions, more variety in missions, whether it's killing characters from other animes, etc (In progress...)
      -Unique Skills so that your character is not equal to others (In progress...)
      -A single vocation, with several sub classes. Do you want to finish all the dungeons? go to the front. Do you want to be a blacksmith? Train your blacksmith skill and become a master with the hammer, your character will automatically get the subclass once you use a certain amount of points (Only Idea...)
      -Hotels and taverns where to rent a room to sleep, get some mission through npc or simply drink a drink (Only Idea...)
      -Did you commit a crime? You must go to prison and pay your sentence or bribe your guard (Only Idea...)
      Totally original economy system (Only Idea...)
      - PvP Mode (players can not attack in the city unless they have a duel, the duel is divided into several forms; -50% hp; the player who loses his life to less than 50% first loses.) (Only Idea...)
      Original record when creating a character and counts on the page using real and fictitious data (In progress...)
      -Group of maximum 6 members to do missions (Party) (Completed)
      - Random Raids - Easter Eggs - Achievements (Only Idea...)
       
      Contact:
      Twitter Facebook Otland
       

       

       

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo