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

Action Knock out & Robbery System ~ 0.3.6

Candlejack

Don't hug me I'm scared
Joined
Jun 20, 2012
Messages
87
Reaction score
38
Location
nowhere
Basically you can use a dagger to walk up to a player and knock them out. They're knocked out for about 6 seconds. You can then stand next to them for 3 seconds after you knock them out and rob all their gold. If you move after knocking them out the robbery will be aborted. :) This works for TFS 0.3.6. It will not work on v1.x

Enjoy.

Video Demonstration:

Put this script in actions.xml
Code:
<action itemid="2411" event="script" value="tools/rob.lua"/>

Put this script in Actions/Tools. Name is rob.lua.
Code:
local money = {}
local player = {}
local position = {}
local config = {
    corpseId = 3058, -- Item Id
    timee = 6000 -- Seconds
}
local function allowMovement(cid)
    if not isPlayer(cid) then
        return
    end
 
    doCreatureSetNoMove(cid, false)
end

local function stealMoney(cid)
    position = getDistanceBetween(getPlayerPosition(player), getPlayerPosition(cid))
    if position < 2 then
        doPlayerRemoveMoney(cid, money)
        doPlayerAddMoney(player, money)
        doPlayerSendTextMessage(player,MESSAGE_INFO_DESCR,"You stole "..money.." gold!")
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'You were robbed!')
    else
        doPlayerSendTextMessage(player,MESSAGE_INFO_DESCR,"Robbery Aborted.")
    end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)

    if isPlayer(itemEx.uid) then
      
        doSetItemOutfit(itemEx.uid, config.corpseId, config.timee)
        doCreatureSetNoMove(itemEx.uid, true)
        addEvent(allowMovement, config.timee, itemEx.uid)
        money = getPlayerMoney(itemEx.uid)
        player = cid
      
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,'Robbing...')
        doPlayerSendTextMessage(itemEx.uid,MESSAGE_INFO_DESCR,'You were knocked out!')
        addEvent(stealMoney, config.timee-3000, itemEx.uid)
      
      
    end
  
    return true
end
 
Back
Top