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

Scripting click and buy shop.

Cotizado

Member
Joined
May 12, 2008
Messages
320
Reaction score
7
Well I've been using such shops long time ago. But theres is a problem.

I added bp of runes so player can buy them clicking at the shop. The problem is that if they fast click on it and they're without cash, server will get freeze for some seconds.

Heres one of the code
Code:
    if item.actionid == 8490 then  --bp blank ID
        if doPlayerRemoveMoney(cid, 1500) == 1 then
            bp = doPlayerAddItem(cid, 2003, 1) --container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doAddContainerItem(bp, 2260, 1) --inside container
            doSendMagicEffect(topos,12)
        else
            doPlayerSendCancel(cid, "You dont have enough money.")
            local damage = math.random(150, 500)
            doCreatureAddHealth(cid, -damage)
            doSendAnimatedText(getCreaturePosition(cid), damage, TEXTCOLOR_RED)
What I am trying to add is an exausted to those codes so player wont be able to buy bp as fast as they can click. HALP thanks! xD
 
Last edited by a moderator:
Dunno, but instead of 20 lines you can make it shorter:
Code:
for i = 1, 20 do
    doAddContainerItem(bp, 2260, 1)
end
 
Back
Top