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

TFS 1.X+ Script lever shop

robert100

Member
Joined
May 2, 2011
Messages
33
Solutions
1
Reaction score
5
Hello guys
why does he take double the amount of gold when buying


If I have a certain amount of gold, it will take well if I have more than 3000 gold coins in my backpack. I have 6,000 takes the whole thing
 
Try this one
Lua:
local lever_id = 1945 -- id of lever before pulled
local pulled_id = 1946 -- id of lever after pulled
local shop = {
    [2051] = {id = 2494, cost = 10000, count = 1},
    [2052] = {id = 2495, cost = 1000, count = 1},
    [2053] = {id = 2496, cost = 1000, count = 1},
    [2054] = {id = 2497, cost = 10000, count = 1},
    [2055] = {id = 2498, cost = 10000, count = 1},
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
   
    local ShopItem = shop[item.uid]
    local itemType = ItemType(ShopItem.id)
    if item.itemid ~= pulled_id then
           if ShopItem then
            if(not player:removeMoney(ShopItem.cost)) then
                player:sendTextMessage(MESSAGE_INFO_DESCR, 'You need '..ShopItem.cost..' to buy '.. itemType:getName() .. '.')
                return false
            end    
            if player:removeMoney(ShopItem.cost) then
            item:transform(pulled_id)
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You bought a '.. itemType:getName() .. '.')
            player:getPosition():sendMagicEffect(13)  
        end
end
    else
        item:transform(lever_id)
        return true
    end
end
 
Back
Top