Postado Julho 17, 2018 6 anos The Forgotten Server 0.4 8.60 Exemplo o player loga no SITE, vai na loja ... compra o outfit é recebe no jogo Como faço pra por storage nos outfits ? GlobalEvets/scripts -- Shop.lua local SHOP_MSG_TYPE = MESSAGE_EVENT_ORANGE local SQL_interval = 30 --- ### Outfits List ### local femaleOutfits = { ["RetroCitizen"]={371}, } local maleOutfits = { ["RetroCitizen"]={370}, } function onThink(interval, lastExecution) local result_plr = db.getResult("SELECT * FROM z_ots_comunication") if(result_plr:getID() ~= -1) then while(true) do id = tonumber(result_plr:getDataInt("id")) local action = tostring(result_plr:getDataString("action")) local delete = tonumber(result_plr:getDataInt("delete_it")) local cid = getPlayerByName(tostring(result_plr:getDataString("name"))) if isPlayer(cid) then local itemtogive_id = tonumber(result_plr:getDataInt("param1")) local itemtogive_count = tonumber(result_plr:getDataInt("param2")) local outfit_name = string.lower(tostring(result_plr:getDataString("param3"))) local itemvip = tonumber(result_plr:getDataInt("param4")) local add_item_type = tostring(result_plr:getDataString("param5")) local add_item_name = tostring(result_plr:getDataString("param6")) local points = tonumber(result_plr:getDataInt("param7")) local received_item = 0 local full_weight = 0 if(action == 'give_item') then 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 local free_cap = getPlayerFreeCap(cid) local new_item = doCreateItemEx(itemtogive_id, itemtogive_count) if full_weight <= free_cap then received_item = doPlayerAddItemEx(cid, new_item) if received_item == RETURNVALUE_NOERROR then doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'Voce Recebeu >> '.. add_item_name ..' << Da Nossa Loja, Relogue Para Salvar A Compra.') db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";") db.query("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(action == 'give_outfit') then if outfit_name ~= "" and maleOutfits[outfit_name] and femaleOutfits[outfit_name] then local add_outfit = getPlayerSex(cid) == 0 and femaleOutfits[outfit_name][1] or maleOutfits[outfit_name][1] if not canPlayerWearOutfit(cid, add_outfit, 3) then db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS) doPlayerAddOutfit(cid, add_outfit, 3) doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, "Voca Recebeu A Roupa " .. add_item_name .. " Da Nossa Loja.") else doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, "Voce Ja Tem Essa Roupa. Seus Pontos Foram Devolvidos, Obrigado.") db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";") db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";") end end end end if not(result_plr:next()) then break end end result_plr:free() end return true end outfits.xml Citar <outfit id="25" premium="yes"> <list gender="0" lookType="371" name="RetroCitizen"/> <list gender="1" lookType="370" name="RetroCitizen"/> </outfit> 758x426.bmp
Postado Julho 17, 2018 6 anos @ADM Mayk on BaiakME cara eu posso estar errado mais, eu acho que não precisa botar storage nenhuma... eu acho que só basta adicionar os addons no seu shop e colocar eles no script do shop.lua Spoiler local femaleOutfits = { ["Teste"]={123}, ["Teste Q"]={232}, ["Teste K"]={321} } local maleOutfits = { ["Teste"]={123}, ["Teste Q"]={213}, ["Teste K"]={321} } Sempre deixando o ultimo addon sem a virgula e também se certificar de que não haja nenhum item, quest o que for, que faça com que você ganhe esse addon que esta no shop...
Postado Julho 17, 2018 6 anos Autor 4 minutos atrás, Emanueldk disse: @ADM Mayk on BaiakME cara eu posso estar errado mais, eu acho que não precisa botar storage nenhuma... eu acho que só basta adicionar os addons no seu shop e colocar eles no script do shop.lua Ocultar conteúdo local femaleOutfits = { ["Teste"]={123}, ["Teste Q"]={232}, ["Teste K"]={321} } local maleOutfits = { ["Teste"]={123}, ["Teste Q"]={213}, ["Teste K"]={321} } Sempre deixando o ultimo addon sem a virgula e também se certificar de que não haja nenhum item, quest o que for, que faça com que você ganhe esse addon que esta no shop... é que tipo no outfits.xml exemplo se eu compra premium 30 dias quem for premium vai poder usar o outfit que esta no shop tendeu .... é eu queria tirar isso ... 758x426.bmp
Postado Julho 18, 2018 6 anos local SHOP_MSG_TYPE = MESSAGE_EVENT_ORANGE local SQL_interval = 30 --- ### Outfits List ### local outfits = { ["RetroCitizen"] = {storage = 789540, out = {[0] = 371,[1] = 370}} -- 0 é sexo female e 1 male } function onThink(interval, lastExecution) local result_plr = db.getResult("SELECT * FROM z_ots_comunication") if(result_plr:getID() ~= -1) then while(true) do id = tonumber(result_plr:getDataInt("id")) local action = tostring(result_plr:getDataString("action")) local delete = tonumber(result_plr:getDataInt("delete_it")) local cid = getPlayerByName(tostring(result_plr:getDataString("name"))) if isPlayer(cid) then local itemtogive_id = tonumber(result_plr:getDataInt("param1")) local itemtogive_count = tonumber(result_plr:getDataInt("param2")) local outfit_name = string.lower(tostring(result_plr:getDataString("param3"))) local itemvip = tonumber(result_plr:getDataInt("param4")) local add_item_type = tostring(result_plr:getDataString("param5")) local add_item_name = tostring(result_plr:getDataString("param6")) local points = tonumber(result_plr:getDataInt("param7")) local received_item = 0 local full_weight = 0 if(action == 'give_item') then 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 local free_cap = getPlayerFreeCap(cid) local new_item = doCreateItemEx(itemtogive_id, itemtogive_count) if full_weight <= free_cap then received_item = doPlayerAddItemEx(cid, new_item) if received_item == RETURNVALUE_NOERROR then doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'Voce Recebeu >> '.. add_item_name ..' << Da Nossa Loja, Relogue Para Salvar A Compra.') db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";") db.query("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(action == 'give_outfit') then if outfits[outfit_name] then local add_outfit = outfits[outfit_name].out[getplayerSex(cid)] if not canPlayerWearOutfit(cid, add_outfit, 3) then db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";") doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS) doPlayerAddOutfit(cid, add_outfit, 3) setPlayerStorageValue(cid, outfits[outfit_name].storage, 1) doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, "Voca Recebeu A Roupa " .. add_item_name .. " Da Nossa Loja.") else doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, "Voce Ja Tem Essa Roupa. Seus Pontos Foram Devolvidos, Obrigado.") db.query("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";") db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";") end end end end if not(result_plr:next()) then break end end result_plr:free() end return true end no out deixa assim: <outfit id="25" quest="789540"> <list gender="0" lookType="371" name="RetroCitizen"/> <list gender="1" lookType="370" name="RetroCitizen"/> </outfit> [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
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.