• 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 can you release a tutorial for old tfs 0.2? as it doesnt have globalevents, thanks
 
@Gesior.pl
Hi,
I have just installed the acc maker and enabled the module on "?subtopic=shopsystem" I'm getting following:


Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 84
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 86
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 98
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 98
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 107
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 127
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 147
Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 147

Have I missed something? It shouldn't just error out like that should it?
 
@Lyky
You should disable errors and warnings in PHP.
You can try to change index.php:
Code:
error_reporting(E_ALL ^ E_STRICT ^ E_NOTICE);
To:
Code:
error_reporting(0);
Then it won't show any errors on website.

Acc. maker has a lot of 'small bugs'. Not related to security/functionality, just code isn't clean.
 
Suppressing all errors is never a great idea, especially when you're not checking logs regularly.
It's actually a PHP > 7.2 behavior, you can prevent this by applying the following fixes:

Replace shopsystem.php > line 84:

PHP:
if( is_array($offer_list['item']) && count($offer_list['item']) > 0)

Replace shopsystem.php > line 86:

PHP:
elseif( is_array($offer_list['container']) && count($offer_list['container']) > 0)

Replace shopsystem.php > line 98:

PHP:
if( (is_array($offer_list['item'] && is_array($offer_list['container'])) && (count($offer_list['item']) > 0) or (count($offer_list['container']) > 0))

Replace shopsystem.php > line 107:

PHP:
if( is_array($offer_list['item']) && (count($offer_list['item']) > 0) and ($action == 'item'))

Replace shopsystem.php > line 127:

PHP:
if( is_array($offer_list['container']) && (count($offer_list['container']) > 0) and ($action == 'container'))

Replace shopsystem.php > line 147:

PHP:
if( (is_array($offer_list['item']) && is_array($offer_list['container'])) && (count($offer_list['item']) > 0) or (count($offer_list['container']) > 0))


I have not tested this, since I am not running any AAC. It's a pretty straight forward fix, and you can compare the current line to the new line to see what's happening if you're really wondering.

> PHP: Backward incompatible changes - Manual
> PHP: count - Manual
 
Last edited:
Hello, I have ots rl map tibia 10.00 with the forgotten server engine on my server vps on ovh.

How to create a store so that you can buy points and for points to buy in the store items or in the game for mounts, outfits, xb boost, etc.

Where in what file and what should I set, what script? I am asking for a specific guide.

In the picture I'm sending like shop for me after uploading ots.

I configured it as the tutorial shows:


But I do not fully understand the last part.

And I do not know if I copied those scripts well.

1. config.php looks like this when it comes to the store:

// ---- Config Shop ----
$ outfits_list = array ();
$ loyalty_title = array (50 => 'Scout', 100 => 'Sentinel', 200 => 'Steward', 400 => 'Warden', 1000 => 'Squire', 2000 => 'Warrior', 3000 => 'Keeper', 4000 => 'Guardian', 5000 => 'Sage');
$ config ['shop'] ['newitemdays'] = 1; #days to item be new in shop


and here I added:

"$ config ['site'] ['shop_system'] = true; // show server shop only 'LUA scripts of shop'

2. where to copy:

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

I copied under "<! - Others ->" in globalevents.xml

Do you need a completely different guide?
 

Attachments

Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 171

Warning
: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 172

Warning
: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 173

Warning
: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 175

Warning
: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 201

Warning
: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 221

Warning
: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 242

Warning
: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\pages\shopsystem.php on line 262


i have tfs system, help me fix these errors please
 
It's tutorial for Gesior 2012 account maker, not old one.

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 ^_^

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.


The link's (paste.ot..) to talkaction don't work, i need for finish my project... :( Help me
 
The link's (paste.ot..) to talkaction don't work, i need for finish my project... :( Help me
1. Try some online website proxy like: hide.me VPN (https://hide.me/en/proxy)
paste.ots.me server works, but it's hosted on OVH webserver and I know that some users cannot connect to it - there is no route from their IP to OVH IP somehow (I get reports from yeeears).
2. http://paste.ots.me/560784/text is:
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
http://paste.ots.me/560783/text is:
Code:
function onSay(cid, words, param, channel)
    local params = string.explode(param, ",")
    local price = params[1]
    table.remove(params, 1)
    local desc = table.concat(params,",")
    local name = ''
    local item1 = getPlayerSlotItem(cid, CONST_SLOT_RIGHT)
    local itemid1 = item1.itemid
    local count1 = item1.type
    local itemid2 = 0
    local count2 = 0

    if(itemid1 == 0) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Put item in right hand.")
        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
 
It's tutorial for Gesior 2012 account maker, not old one.

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 ^_^

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.
Zrobiłem jak należy, mam tfsa 1.2 powinno działać skoro mam acc maker 2012? mam rozumiec że potem wchodze na goda i wpisuje /addshop 50 < i to znaczy że dodaje itema którego mam w prawej ręce do shopa za 50 ptk?
 
@Lyky
You should disable errors and warnings in PHP.
You can try to change index.php:
Code:
error_reporting(E_ALL ^ E_STRICT ^ E_NOTICE);
To:
Code:
error_reporting(0);
Then it won't show any errors on website.

Acc. maker has a lot of 'small bugs'. Not related to security/functionality, just code isn't clean.



love you
 
I did everything as you describe the errors "C: \ xampp \ htdocs \ pages \ Shopsystem.php". I managed to remove it by changing the index. But still when I try to add some items nothing happens. There is no mistake but it does not add to the shop

1602348110614.png
 
Last edited:
Using 0.4 getting error.

[06:46:16.889] [Error - TalkAction Interface]
[06:46:16.890] data/talkactions/scripts/add_shop_talkaction.lua:eek:nSay
[06:46:16.890] Description:
[06:46:16.891] data/talkactions/scripts/add_shop_talkaction.lua:26: attempt to call global 'isContainer' (a nil value)
[06:46:16.891] stack traceback:
[06:46:16.891] data/talkactions/scripts/add_shop_talkaction.lua:26: in function <data/talkactions/scripts/add_shop_talkaction.lua:1>
Post automatically merged:

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/ ?
i have this error an you explain to me?
 
Last edited:
im using OTX let me see if i can find a tut on how to add iscontainer i looks like its missing thanks so much
 
Gesior.pl thank you so much for the help i have one last issue and its that the item just keeps coming and doesn't stop. keeps giving items for ever. no console error

Lua:
local SHOP_MSG_TYPE = MESSAGE_EVENT_ORANGE
local SQL_interval = 30
--- ### Outfits List ###
local femaleOutfits = {
    ["citizen"]={136},
    ["hunter"]={137},
    ["mage"]={138},
    ["knight"]={139},
    ["noblewoman"]={140},
    ["summoner"]={141},
    ["warrior"]={142},
    ["barbarian"]={147},
    ["druid"]={148},
    ["wizard"]={149},
    ["oriental"]={150},
    ["pirate"]={155},
    ["assassin"]={156},
    ["beggar"]={157},
    ["shaman"]={158},
    ["norsewoman"]={252},
    ["nightmare"]={269},
    ["jester"]={270},
    ["brotherhood"]={279},
    ["demonhunter"]={288},
    ["yalaharian"]={324},
    ["warmaster"]={336},
    ["wayfarer"]={366},
    ["afflicted"]={431},
    ["elementalist"]={433},
    ["deepling"]={464},
    ["insectoid"]={466},
    ["red baron"]={471},
    ["crystal warlord"]={513},
    ["soil guardian"]={514},
    ["demon"]={542}
}
local maleOutfits = {
    ["citizen"]={128},
    ["hunter"]={129},
    ["mage"]={130},
    ["knight"]={131},
    ["noblewoman"]={132},
    ["summoner"]={133},
    ["warrior"]={134},
    ["barbarian"]={143},
    ["druid"]={144},
    ["wizard"]={145},
    ["oriental"]={146},
    ["pirate"]={151},
    ["assassin"]={152},
    ["beggar"]={153},
    ["shaman"]={154},
    ["norsewoman"]={251},
    ["nightmare"]={268},
    ["jester"]={273},
    ["brotherhood"]={278},
    ["demonhunter"]={289},
    ["yalaharian"]={325},
    ["warmaster"]={335},
    ["wayfarer"]={367},
    ["afflicted"]={430},
    ["elementalist"]={432},
    ["deepling"]={463},
    ["insectoid"]={465},
    ["red baron"]={472},
    ["crystal warlord"]={512},
    ["soil guardian"]={516},
    ["demon"]={541}
}

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, 'You received >> '.. add_item_name ..' << RELOGUE PARA SALVAR URGENTE.')
                            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(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.executeQuery("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, "You received the outfit " .. add_item_name .. " of our Shop Online.")
                        else
                            doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, "You already have this outfit. Your points were returned, thank you.")
                            db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
                            db.executeQuery("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
 
Back
Top