Advertisement
Guest User

Vocation Door

a guest
Jan 23rd, 2013
651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. function onUse(cid, item, fromPos, item2, toPos)
  2.     local vocs = { -- [actionid] = {vocs = {vocation_ids}, level = level_needed}
  3.         [1212] = {voc = {1, 5}, level = 10},
  4.         [1213] = {voc = {2, 6}, level = 10},
  5.         [1214] = {voc = {3, 7}, level = 10},
  6.         [1215] = {voc = {4, 8}, level = 10},
  7.         }
  8.        
  9.     local door = vocs[item.actionid]
  10.    
  11.     if not isInArray(door.voc, getPlayerVocation(cid)) then
  12.         doPlayerSendCancel(cid, "You cannot pass.") return true
  13.     elseif getPlayerLevel(cid) < door.level then
  14.         doPlayerSendCancel(cid, "Not enough level.") return true
  15.     end
  16.        
  17.         doTransformItem(item.uid, item.itemid+1)
  18.         doTeleportThing(cid, toPos)
  19.         addEvent(doTransformItem, 1000, item.uid, item.itemid-1)
  20. return true
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement