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

RevScripts [1.3] Add deley

Scrollia

Banned User
Joined
Apr 26, 2021
Messages
100
Reaction score
15
Lua:
local bp = TalkAction("!bp")
function bp.onSay(cid, words, param)
if doPlayerRemoveMoney(cid, 100) then
doPlayerAddItem(cid,1988,1)
doSendMagicEffect(getPlayerPosition(cid),12)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You've bought an backpack!")
else
doPlayerSendCancel(cid,"You don't have enough money.")
doSendMagicEffect(getPlayerPosition(cid),2)
end
return true
end
bp:register()


how to add deleye, and stop spaming !bp? Like use , and exhause for 3sec.
 
Solution
here bit better version made by Xikini

Lua:
local bp = TalkAction("!bp")
local player_exhaust = {} 
local exhaust_time = 5 -- seconds

local backpackprice = 100

function bp.onSay(player, words, param)

    local time, cid = os.time(), player:getId()

    if player_exhaust[cid] then 
        if time < player_exhaust[cid] then 
            player:sendCancelMessage("You are exhausted.")
            return true
        end
    end
    player_exhaust[cid] = time + exhaust_time 

    if player:removeMoney(backpackprice) then
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        player:addItem(1988, 1)
    else
        if player:withdrawMoney(backpackprice) then
            if player:removeMoney(backpackprice) then...
here bit better version made by Xikini

Lua:
local bp = TalkAction("!bp")
local player_exhaust = {} 
local exhaust_time = 5 -- seconds

local backpackprice = 100

function bp.onSay(player, words, param)

    local time, cid = os.time(), player:getId()

    if player_exhaust[cid] then 
        if time < player_exhaust[cid] then 
            player:sendCancelMessage("You are exhausted.")
            return true
        end
    end
    player_exhaust[cid] = time + exhaust_time 

    if player:removeMoney(backpackprice) then
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
        player:addItem(1988, 1)
    else
        if player:withdrawMoney(backpackprice) then
            if player:removeMoney(backpackprice) then
                player:getPosition():sendMagicEffect(CONST_ME_MAGIC_RED)
                player:addItem(1988, 1)
            end
        else
            player:getPosition():sendMagicEffect(CONST_ME_POFF)
            player:sendCancelMessage("You don't have enought money. Not even in your bank!")
        end
    end

    return true
end
bp:register()
 
Solution
Lua:
local bp = TalkAction("!bp")
function bp.onSay(cid, words, param)
if doPlayerRemoveMoney(cid, 100) then
doPlayerAddItem(cid,1988,1)
doSendMagicEffect(getPlayerPosition(cid),12)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You've bought an backpack!")
else
doPlayerSendCancel(cid,"You don't have enough money.")
doSendMagicEffect(getPlayerPosition(cid),2)
end
return true
end
bp:register()


how to add deleye, and stop spaming !bp? Like use , and exhause for 3sec.
Try this.
Lua:
local delayTable = {}

local bp = TalkAction("!bp")
function bp.onSay(cid, words, param)
    local playerId = cid:getId()
    local currentTime = os.time()
    if delayTable[playerId] and delayTable[playerId] > currentTime then
        doPlayerSendCancel(cid, "Please wait a few moments.")
        return false
    end
    delayTable[playerId] = currentTime + 3
   
    if doPlayerRemoveMoney(cid, 100) then
        doPlayerAddItem(cid,1988,1)
        doSendMagicEffect(getPlayerPosition(cid),12)
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You've bought an backpack!")
    else
        doPlayerSendCancel(cid,"You don't have enough money.")
        doSendMagicEffect(getPlayerPosition(cid),2)
    end
    return true
end
bp:register()
 
Try this.
Lua:
local delayTable = {}

local bp = TalkAction("!bp")
function bp.onSay(cid, words, param)
    local playerId = cid:getId()
    local currentTime = os.time()
    if delayTable[playerId] and delayTable[playerId] > currentTime then
        doPlayerSendCancel(cid, "Please wait a few moments.")
        return false
    end
    delayTable[playerId] = currentTime + 3
   
    if doPlayerRemoveMoney(cid, 100) then
        doPlayerAddItem(cid,1988,1)
        doSendMagicEffect(getPlayerPosition(cid),12)
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You've bought an backpack!")
    else
        doPlayerSendCancel(cid,"You don't have enough money.")
        doSendMagicEffect(getPlayerPosition(cid),2)
    end
    return true
end
bp:register()

just took your other script haha
thought would be enough + its better :D
 
Well look at this good stuff haha, if there a way to hide ingame text "!bp" so it does not show that bought a bp? like hide the msg it self?
 
Back
Top