Advertisement
Guest User

Untitled

a guest
May 29th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.10 KB | None | 0 0
  1.   local outfit =  {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}
  2.  
  3. local BORDERS = {
  4.         [7943] = {x = 0, y = -2, back = SOUTH},
  5.         [7944] = {x = -2, y = 0, back = EAST},
  6.         [7945] = {x = 0, y = 2, back = NORTH},
  7.         [7946] = {x = 2, y = 0, back = WEST},
  8.         [7947] = {x = 2, y = 1, back = WEST},
  9.         [7948] = {x = -2, y = 1, back = NORTH},
  10.         [7949] = {x = 2, y = -1, back = WEST},
  11.         [7950] = {x = -2, y = -1, back = WEST},
  12.         [7951] = {x = 2, y = 2, back = WEST},
  13.         [7952] = {x = -2, y = 2, back = NORTH},
  14.         [7953] = {x = 2, y = -2, back = WEST},
  15.         [7954] = {x = -2, y = -2, back = SOUTH}
  16. }
  17.  
  18. BORDERS[4828] = BORDERS[7943]
  19. BORDERS[4829] = BORDERS[7946]
  20. BORDERS[4830] = BORDERS[7945]
  21. BORDERS[4831] = BORDERS[7944]
  22.  
  23. function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
  24.         if(not isPlayer(cid)) then
  25.                 return true
  26.         end
  27.  
  28.         local border = BORDERS[item.itemid]
  29.         if(not border) then
  30.                 return false
  31.         end
  32.         if hasCondition(cid, CONDITION_INFIGHT) then
  33.                 return doPlayerSendCancel(cid, "You are in a fight.") and doTeleportThing(cid, fromPosition)
  34.         end
  35.  
  36.         local pos, newPos = getCreaturePosition(cid), {}
  37.         newPos = pos
  38.         newPos.x = pos.x + border.x
  39.         newPos.y = pos.y + border.y
  40.  
  41.         if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
  42.                 doMoveCreature(cid, border.back)
  43.                 doRemoveCondition(cid, CONDITION_OUTFIT)
  44.         else
  45.                 if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
  46.                         return false
  47.                 end
  48.  
  49.                 doRemoveConditions(cid, true)
  50.  
  51.                 doSendMagicEffect(pos, CONST_ME_POFF)
  52.                 doTeleportThing(cid, newPos)
  53.                 doSendMagicEffect(pos, CONST_ME_WATERSPLASH)
  54.  
  55.                 doSetCreatureOutfit(cid, outfit, -1)
  56.         end
  57.  
  58.         return true
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement