• 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 0.3.6] [08.6] How to block this action in protected zones

soulessonee

New Member
Joined
May 5, 2013
Messages
5
Reaction score
0
Hi all thanks for reading, I have a script here from CandleJack's knock out and robbery system (https://otland.net/threads/knock-out-robbery-system-0-3-6.231662/), its a very fun feature so thank you to him for that.

I have altered it to give the player a white skull but they can still perfom this action on another player in a protection zone such as the depot.

Can anyone help me modify it so that it triggers battleswords and wont work in the PZs.

Many Thanks,
Alex
-- Code is below --
 
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)
        doCreatureSetSkullType(cid, SKULL_WHITE)
     
     
    end
 
    return true
end
 
Hi, I am using the forgotten server 0.3.6. Here is the dialog details

[12/07/2015 23:15:32] The Forgotten Server - Edited By Cyko V8, version 0.3.6 - Edited By Cyko V8 (Crying Damson - Edited By Cyko V8)
[12/07/2015 23:15:32] Compiled with GNU C++ version 3.4.5 (mingw special) at Apr 6 2013, 11:07:44.
[12/07/2015 23:15:32] A server developed by Elf, slawkens, Talaturen, KaczooH, Lithium, Kiper, Kornholijo.
 
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 getTileInfo(getThingPos(cid)).protection or getTileInfo(getThingPos(itemEx.uid)).protection then
     doPlayerSendCancel(cid, "You Cant Rob Other Players In Pz")
     return true
   end
  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)
  doCreatureSetSkullType(cid, SKULL_WHITE)
   
   
  end
  return true
end
 
Back
Top