• 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 lever selling system.

EstebanGod

New Member
Joined
Jun 18, 2014
Messages
83
Reaction score
3
Ok, Im using a script I found around the web to sell runes and potions using a lever.
It works, But not completly, it gives the character the runes or potions but it wont take the money from them. Help would be really aprreciated. Heres my script.

Code:
local config = {cantidad = 100}

local aid = { --actionid, itemid, cost}
   [5600] = {2260, 1000},
   [5601] = {2268, 9500},
   [5602] = {7618, 4500},
   [5603] = {7588, 10000},
   [5604] = {7591, 19000},
   [5605] = {8473, 31000},
   [5606] = {2273, 7500},
   [5607] = {2274, 9000},
   [5608] = {2271, 6500},
   [5609] = {8472, 19000},
   [5610] = {2278, 20000},
   [5611] = {2293, 35000},
   [5612] = {2313, 25000},
   [5613] = {7620, 5000},
   [5614] = {7589, 8000},
   [5615] = {7590, 12000},}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   local aids = aid[item.actionid]
   if item.itemid == 1945 then
      if aids then
         if doPlayerAddItem(cid, aids[1], config.cantidad, false) == RETURNVALUE_NOERROR then
            if doPlayerRemoveMoney(cid, aids[3]) then
               doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, 'You've got x'..cantidad.config..' '..getItemNameById(aids[1])..'.')
            else
               doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, 'You need '..aids[2]..' gold to buy this.')
            end
         else
            doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, 'No Cap.')
         end
      end
   return true
end
end
 
Last edited by a moderator:
Change aids[3] to aids[2].
Btw, better let it remove the money first then give the items, incase people don't have enough money.
 
I dont get any errors, Im using a 8.6 ot its called "Real server" but im not sure if thats the server name (or version)

Im goin crazy someone help me
 
Last edited by a moderator:
Try this:
Code:
local potions = { -- [actionid] = {itemid, cost}
    [5600] = {2260, 1000},
    [5601] = {2268, 9500},
    [5602] = {7618, 4500},
    [5603] = {7588, 10000},
    [5604] = {7591, 19000},
    [5605] = {8473, 31000},
    [5606] = {2273, 7500},
    [5607] = {2274, 9000},
    [5608] = {2271, 6500},
    [5609] = {8472, 19000},
    [5610] = {2278, 20000},
    [5611] = {2293, 35000},
    [5612] = {2313, 25000},
    [5613] = {7620, 5000},
    [5614] = {7589, 8000},
    [5615] = {7590, 12000},
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 1945) then
        local potion = potions[item.actionid]
        if(potion) then
            if(doPlayerRemoveMoney(cid, potion[2])) then
                if(doPlayerAddItem(cid, potion[1], 100, false) == RETURNVALUE_NOERROR) then
                    doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "You've got 100 " .. getItemNameById(potion[1]) .. ".")
                else
                    doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "No Cap.")
                end
            else
                doPlayerSendTextMessage(cid, TALKTYPE_ORANGE_1, "You need " .. potion[2] .. " gold to buy this.")
            end
        end
    end
return true
end
 
Back
Top