• 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!

[GESIOR2012] Items Shop Installation/Administration

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,965
Solutions
99
Reaction score
3,375
Location
Poland
GitHub
gesior
It's tutorial for Gesior 2012 account maker, not old one.

UPDATE:
Scripts for TFS 1.4+ available in threads:


1. What will you need?
  • installed account maker
  • working ots based on TFS 0.3.6/0.4

Tutorial:
1. INSTALLATION OF SHOP [to make it deliver items]
Shop show images of items. It will not work, if you don't install item images! [there is tutorial how to do it]
It adds in description of all items (also in containers) name of player that bought item and unique ID of shop system transaction ^_^
example said:
22:13 You see an earthborn titan armor (Arm:15, axe fighting +2, protection physical +5%, earth +3%).
It can only be wielded properly by knights of level 90 or higher.
It weighs 120.00 oz.
Bought by GOD Gesior [ID:334].
1. Open account maker folder and go to folder config and edit file config.php
2. Find in it line:
PHP:
$config['site']['shop_system'] = false; // show server shop page? use only if you installed LUA scripts of shop
and change it value to true
3. Now open folder data of your ots
4. Open file globalevents.xml in folder globalevents
5.
Add there line (don't break XML structure, ask someone to help you if you got no idea about XML files format):
XML:
<globalevent name="website_shop_item_delivery" interval="30" event="script" value="shop.lua"/>
or:
XML:
<globalevent name="website_shop_item_delivery" interval="30000" event="script" value="shop.lua"/>
(if in that file is event 'save' with interval 3600/7200 then add 30 [it's time in seconds], if interval is very high like 3600000/7200000 then add line with interval 30000 [it's time in miliseconds - ms])
6. Create file shop.lua in folder globalevents/scripts and paste in it:
Lua:
-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "data/lib/000-constants.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
That script should work on 0.3.6 and 0.4 without problems (made for my 0.3.6pl1 OTS and tests on 0.4 client 9.6).
Script only for OTSes that use MySQL database!


2. INSTALLATION OF 'ADD SHOP ITEMS' TALKACTION
1. Now open folder data of your ots
2. Open file talkactions.xml in folder talkactions
3.
Add there line (don't break XML structure, ask someone to help you if you got no idea about XML files format):
[this line is from TFS 0.4 client 9.6, it may look a bit different on old distributions, make it like other talkactions for GOD]
XML:
<talkaction log="yes" words="/addshop" access="5" event="script" value="add_shop_talkaction.lua"/>
4. Create file add_shop_talkaction.lua in folder talkactions/scripts and paste in it [tested on TFS 0.4 client 9.6, should works good with all 0.4]:
http://paste.ots.me/560784/text

If script above doesn't work for you (error in console) try SECOND script:
http://paste.ots.me/560783/text

3. SHOP ADMINISTRATION
1. Add offer
1.1
Add with first LUA 'add shop' script [first script works good on 0.4 client 9.6, but I'm not sure if it works on 0.3.6]
Login on GOD character and put item/backpack [it will add full backpack of first item in backpack when player buy] that you want add IN FRONT OF YOU:
shop1.png


Say /addshop price or /addshop price, D e( ee'e') sc,ri p, tio n:
shop2o.png


Then in SMS shop it shows:
shop3g.png


1.2 Add with second LUA 'add shop' script [works on all TFSes 0.3.6/0.4, BUT on 9.6 you can't put all items in right hand!]
Login on GOD character and put item/backpack [it will add full backpack of first item in backpack when player buy] that you want add in your right hand:
86418518.jpg


Say /addshop price or /addshop price, D e( ee'e') sc,ri p, tio n:
consl.jpg


Then in SMS shop it shows [old shop images, not it shows images]:
shopwy.jpg


2. Remove offer
You can remove offers in 'phpmyadmin' [database]. Remove rows from table z_shop_offer.

3. Edit offer
You can edit offers in 'phpmyadmin' [database]. Edit rows in table z_shop_offer, but it's not easy to understand, so better remove and add again.
 
Last edited:
noobs gonna be real happy now ^^
1. Download server here.
2. Download acc manager here.
3. Follow tutorial here.
4. Profit!



good job anyway on your new aac ^^
 
Jaki był błąd w starym sms systemie? :D
Nie bylo bledu w starym SMS systemie, tylko bylo ich wiele na forum, wiec zrobilem temat z tym ktory napewno dziala z SMS shop z GESIOR 2012.
What was wrong with old sms system? :D
Nothing. There were many systems on forum, I made thread with scripts that work with GESIOR 2012.
 
The command won't work with space. Why? When i write /addshop 50 it just goes into the general chat without function. Why is this?
* I think it's the space that's the problem.
 
How to change the account that the donation should be send to by paypal?
 
not possible. Of course #HTML hackers# can, but for normal users it's not possible. As some people got problems with people that chargeback money on paypal it's good to let them donate only by their account. So you won't ban someone who didn't donate for chargeback. Lame way to block noobs, but I don't know any better. In my unfinished acc. Maker 'OTSME AAC' there is like on tibia.com, when someone donate, person that receive points must accept donation on www, but I think it's too much work for ots players :p
 
[14/01/2013 22:14:07] [Error - TalkAction Interface]
[14/01/2013 22:14:07] data/talkactions/scripts/add_shop_talkaction.lua:eek:nSay
[14/01/2013 22:14:07] Description:
[14/01/2013 22:14:07] data/talkactions/scripts/add_shop_talkaction.lua:41: attempt to call field 'executeQuery' (a nil value)
[14/01/2013 22:14:07] stack traceback:
[14/01/2013 22:14:07] data/talkactions/scripts/add_shop_talkaction.lua:41: in function <data/talkactions/scripts/add_shop_talkaction.lua:1>



PLEASE HALPPPPPPP! :/
 
[14/01/2013 22:14:07] [Error - TalkAction Interface]
[14/01/2013 22:14:07] data/talkactions/scripts/add_shop_talkaction.lua:eek:nSay
[14/01/2013 22:14:07] Description:
[14/01/2013 22:14:07] data/talkactions/scripts/add_shop_talkaction.lua:41: attempt to call field 'executeQuery' (a nil value)
[14/01/2013 22:14:07] stack traceback:
[14/01/2013 22:14:07] data/talkactions/scripts/add_shop_talkaction.lua:41: in function <data/talkactions/scripts/add_shop_talkaction.lua:1>



PLEASE HALPPPPPPP! :/

what TFS do you use?
 
what TFS do you use?

0.3.6 ;/ im getting crazy with it i even try to create offer manually on my db but didnt work
somehow website dont show my offers

- - - Updated - - -

can u help me out with this ? been trying for 15 hours x.x
 
This error means that your TFS is not compatible with LUA script that you installed and it's weird as in TFS 0.3.6 and 0.3.6pl1 function:
db.executeQuery(query)
is definied in engine.
Did you modify anything in folder /data/lib/ ?
 
yes as u say lib i forget to change it when i switched thanks u alot<3
 
Last edited:
Use phpmyadmin to edit table 'accounts' in database. There in column 'premium_points'.
 
Heey Gesior.pl.
I did everything as u said.
Adding items to shop works perfectly.

I use Gesior 2012.
I use Uniform server.
I use Windows
I use 0.3.6 Distro, (Hell Core)

When i try to buy it.
I get this error in console:
Code:
[Error - GlobalEvent Interface]
data/globalevents/scripts/shop.lua;onthink
Description:
data/globalevents/scripts/shop.lua:41: attempt to compare nil with number
stack traceback:
	data/globalevents/scripts/shop.lua:41: in function <data/globalevents/scripts/shop.lua:7>
[Error - GlobalEvents::think] Couldn't execute event: website_shop_item_delivery

I use the shop.lua u told me to use. This one:
Lua:
-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "data/lib/000-constants.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

I hope this can be fixed.

Thanks in advance,

Dylanaw

- - - Updated - - -

Hmm, i looked into Lua_Functions.
And it's 0.3.5, while the server is 0.3.6.
I have no idea what to do now.

Fixed, i'm using other distro 0.4
 
Last edited:
Back
Top