• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TUTORIAL! COMO INTALAR LA ITEMS SHOP! EN GESIOR AAC 0.3.6 / 0.4

merecura

New Member
Joined
Oct 22, 2014
Messages
16
Reaction score
0
Buenas amigos, les traigo esta guia para los que no saben mucho ingles y como intalar el items shop en gesior aac.

Al comprar el item se les añadira algo asi, el jugador que lo haya comprado.
10689752_10205321070968891_4082356153658349797_n.jpg


Comencemos.
1. En caso de que no tenga la pestaña de Shop activada asi como esta
10689858_10205321085809262_3504868465867585349_n.jpg


vaya a la carpeta htdocs y luego vaya a la carpeta config y abra el archivo config.php
2. busca esta linea.

Code:
# PAGE: shopsystem.php
$config['site']['shop_system'] = false;

3. y donde esta = false; cámbielo por = true;. Para asi activarlo.

4. ahora vaya a la carpeta data de su ot.

5. y abra el archivo globalevents.xml, que esta en la carpeta globalevents y añada estas dos lineas.
para 0.3.6

Code:
<globalevent name="website_shop_item_delivery" interval="30" event="script" value="shop.lua"/>

para 0.4

Code:
<globalevent name="website_shop_item_delivery" interval="30000" event="script" value="shop.lua"/>

6. crea un archivo .lua en globalevents\scripts llamado shop
y pegue esto

Code:
-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "data/lib/000-constants.CODE=LUA")
SHOP_MSG_TYPE = MESSAGE_STATUS_CONSOLE_BLUE
-- time (in seconds) between queries to MySQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
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)
doItemSetAttribute(new_container, "description", 'Bought by ' .. getCreatureName(cid) .. ' [ID:' .. id .. '].')
doItemSetAttribute(new_container, "tid", id)
local iter = 0
while iter ~= container_count do
local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
doItemSetAttribute(new_item, "description", 'Bought by ' .. getCreatureName(cid) .. ' [ID:' .. id .. '].')
doItemSetAttribute(new_item, "tid", id)
doAddContainerItemEx(new_container, new_item)
iter = iter + 1
end
received_item = doPlayerAddItemEx(cid, new_container)
else
local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
doItemSetAttribute(new_item, "description", 'Bought by ' .. getCreatureName(cid) .. ' [ID:' .. id .. '].')
doItemSetAttribute(new_item, "tid", id)
received_item = doPlayerAddItemEx(cid, new_item)
end
if received_item == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You received >> '.. add_item_name ..' << from OTS shop.')
doPlayerSave(cid)
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

aqui tienes ya listo el .lua
shop


7. y ahora de nuevo en la carpeta data de tu ot abra talkactions.xml en la carpeta talkactions

8. y añada esta linea

Code:
<talkaction log="yes" words="/addshop" access="5" event="script" value="add_shop_talkaction.lua"/>


9. y ahora en data/talkactions/scripts crea un archivo .lua llamado add_shop_talkaction
y pegue esto dentro de el

Code:
function onSay(cid, words, param, channel)
local toPos = getCreatureLookPosition(cid) -- this function may not exists in old TFSes :/
toPos.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
local params = string.explode(param, ",")
local price = params[1]
table.remove(params, 1)
local desc = table.concat(params,",")
local name = ''
local item1 = getThingFromPos(toPos)
local itemid1 = item1.itemid
local count1 = item1.type
local itemid2 = 0
local count2 = 0

if(itemid1 == 0 or isCreature(item1.uid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "There is no moveable item in front of you or there is creature.")
return true
end
if(not price) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must set price.")
return true
end
price = tonumber(price)
local itemInfo = getItemInfo(itemid1)
local offer_type = 'item'
if(isContainer(item1.uid)) then
local item2 = getContainerItem(item1.uid, 0)
if(item2.itemid > 0) then
count1 = getContainerCap(item1.uid)
itemid2 = item2.itemid
count2 = item2.type
offer_type = 'container'
itemInfo = getItemInfo(itemid2)
end
end
local count1_desc = (count1 > 0) and count1 or 1
local count2_desc = (count2 > 0) and count2 or 1
if(itemid2 == 0) then
name = count1_desc .. 'x ' .. itemInfo.name
else
name = count1_desc .. 'x ' .. count2_desc .. 'x ' .. itemInfo.name
end
db.executeQuery('INSERT INTO `z_shop_offer` (`id` ,`points` ,`itemid1` ,`count1` ,`itemid2` ,`count2` ,`offer_type` ,`offer_description` ,`offer_name`) VALUES (NULL , ' .. price .. ', ' .. itemid1 .. ', ' .. count1 .. ', ' .. itemid2 .. ', ' .. count2 .. ', \'' .. offer_type .. '\', ' .. db.escapeString(desc) .. ', ' .. db.escapeString(name) .. ');')
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item >> " .. name .. " << added to SMS shop. Price is " .. price .. " premium points.")
return true
end

aqui tienes ya listo el .lua
add_shop_talkaction

Y ahora para poder añadir items a su shop haga lo siguiente

Primero lanza el objeto que quieres añadir al piso.
Segundo apuntalo con tu GOD
10653879_10205321215412502_783206867513710838_n.jpg

Tercero ejecuta este comando: /addshop precio o /addshop precio, descripción
Ejemplo introduce el comando

1507719_10205321231332900_5248652978558337945_n.jpg


y luego le das enter y saldra que fue añadido(para novatos, no le hagan caso a lo que dice de SMS Shop igual lo enviara a la shop, que no es sms shop xd)

1233342_10205321234372976_2483704536531594271_n.jpg


y aparecera en la pagina asi

522043_10205321229852863_1457163305066325801_n.jpg


y listo esto fue todo






 
Last edited:
Back
Top