MaXwEllDeN

Untitled

Apr 19th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.86 KB | None | 0 0
  1. local config = {
  2.     level = 100,
  3.     vocations = {1, 2, 3, 4},
  4. }
  5.  
  6. function onUse(cid, item, fromPosition, itemEx, toPosition)
  7.     if not isInArray(config.vocatios, getPlayerVocation(cid)) then
  8.         return doPlayerSendCancel(cid, "Sorry, your vocation can't use this.")
  9.     end
  10.    
  11.     if getPlayerLevel(cid) < config.level then
  12.         return doPlayerSendCancel(cid, "Sorry, you don't have level.")
  13.     end
  14.    
  15.     if toPosition.x == CONTAINER_POSITION then
  16.         return doPlayerSendCancel(cid, "Sorry, not possible")
  17.     end
  18.    
  19.     if itemEx.itemid > 0 and isWalkable(toPosition, true, true, true) then
  20.         if isSightClear(getThingPos(cid), toPosition, true) then
  21.             doTeleportThing(cid, toPosition)
  22.             doSendDistanceShoot(getThingPos(cid), toPosition, 28)
  23.         else
  24.             doPlayerSendCancel(cid, "Sorry, not possible.")
  25.         end
  26.     else
  27.         doPlayerSendCancel(cid, "Sorry, not possible.")
  28.     end
  29.  
  30.     return true
  31. end
Advertisement
Add Comment
Please, Sign In to add comment