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

Help with my script to stop cloner VIP Items.

Mangous

New Member
Joined
Jan 24, 2010
Messages
3
Reaction score
0
The script would be a Global Events.
Version: 8.6 TFS 0.4_DEV
Experience Level: High

If you can make based on Shop.lua I'll put down there, it's what I use and do not have that problem
infinite number of times to send the same item.

Request:

Just as the arena adds the description of his name in trofel,
each item purchased at the site could have a description, for example:

When someone buys a sword in the site, when you look at this sword would appear "you see the sword vip
shopcode 001 "something, the next item would have purchased the description shopcode 002 and so on.

1 - item bought in the shop would be the end of the description: [001]
2 - the second item in the shop would have bought at the end of the description: [002]
3 - the third item in the shop would have bought at the end of the description: [003]

I do not really know script but shop.lua'd have to add in the function "doItemSetAttribute"
and a description would be based on a query string in the db. We also have to create a table and a field in the db to record the numbers that have been used,
so that each item had a unique number. And when the item is received by the players would run a query that would add +1 to the number
is registered in the db.
So every item purchased at the store would have a unique code in ascending order.

That way we could find two items with the same code in database, and it would be obvious that were cloned,
delete a well of them and nobody would have cloned items on the server.

If you can add a script in which show two items with the same id ex: 2 items with [001], both were deleted.
If everyone knows that cloning will lose the item, no one try and if some one try, he would lose the item
as punishment for trying to cheat.

If possible also add the id of the player who's in the db or his name too.

At the end getting such as:

With The Player Id
Code:
17:48 You see boots of haste (speed +20).
It weighs 7:50 oz. Item Shop [001] Purchased For [127]

Where [001] was the id of purchase on the site and the [127] the id of the player you purchased.

And With The Player Name
Code:
17:48 You see boots of haste (speed +20).
It weighs 7:50 oz. Item Shop [001] Purchased by [ADM ot]

Where [001] was the id of purchase on the site and the [ADM ot] the name of the player you purchased.

I wonder if the programers here can try this script to not only help me, but also
to all who experience problems with cloned VIP items.

MY shop.lua
Code:
- # # # # # # CONFIG
- Message send to player by script "type" (types Can you 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 # # #
onThink function (interval, lastExecution)
Local result_plr db.getResult = ("SELECT * FROM z_ots_comunication WHERE` type `= 'login'; ')
if (result_plr: getID () ~ = -1) then
while (true) the
id = tonumber (result_plr: getDataInt ("id"))
action = tostring (result_plr: getDataString ("action"))
delete = tonumber (result_plr: getDataInt ("delete_item"))
cid = getCreatureByName (tostring (result_plr: getDataString ("name")))
isPlayer if (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 the
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 doPlayerAddItemEx = (cid, NEW_ITEM)
end
then if received_item == RETURNVALUE_NOERROR
doPlayerSendTextMessage (cid, SHOP_MSG_TYPE, 'You received>>' add_item_name .. .. '<<from OTS shop.')
db.query ("DELETE FROM` z_ots_comunication `WHERE` id `=" .. id .. ";")
db.query ("UPDATE` z_shop_history_item trans_state `SET` `= '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
UPS
end
end
result_plr: free ()
end
return TRUE
end


Woe To the vlws expected.
 
Try to use this shop.lua script
Code:
  -- ### 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 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 .. '].')
                        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 .. '].')
							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 .. '].')
                        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
 
Back
Top