Guest User

Tilecar

a guest
Feb 23rd, 2012
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.20 KB | None | 0 0
  1. -----------------------------------
  2. -------<<< TileCar-Script >>>------
  3. -----<<< created by Zyntax >>>-----
  4. -----------------------------------
  5. -------<<< @ OTFans.net >>>--------
  6. -----------------------------------
  7.  
  8. --Edit the STARTing Position--
  9. local start = {x=389, y=314, z=8}
  10.  
  11. --- 0 = create tile NORTH
  12. --- 1 = create tile WEST
  13. -- -1 = create tile EAST
  14. --- 2 = create tile SOUTH
  15. local d = {0,0,0,1,1,1,0,0,0,0,-1,-1,-1,-1,2,2,2,-1,-1,0,0,0,0,0,1,1,1,0}
  16. local speed = 500 --Every 0.5 seconds a tile will be created.
  17.  
  18. --EXPLAINING:
  19. --local d = {up,up,up,left,left,left,up,up,up,up,right,right,right,right,down,down,down,right,right,up,up,up,up,up,left,left,left,up}
  20.  
  21. -----!!!DO NOT EDIT THE LINES BELOW!!!----
  22. local count = 1
  23. local U = 0
  24. local S = 0
  25. local position = {}
  26.  
  27. function onUse(cid, item, fromPosition, itemEx, toPosition)
  28.     if item.itemid == 1946 then
  29.         doPlayerSendCancel(cid, 'Sorry you have to wait for the reset.')
  30.     else
  31.         doTransformItem(item.uid, 1946)
  32.         addEvent(go, speed, count, start, cid, U, S)
  33.     end
  34. return true
  35. end
  36.  
  37. function go(count, start, cid, U, S)
  38.     if d[count] == 0 then
  39.         U = U-1
  40.     elseif d[count] == 1 then
  41.         S = S-1
  42.     elseif d[count] == -1 then
  43.         S = S+1
  44.     elseif d[count] == 2 then
  45.         U = U+1
  46.     elseif count == (#d+3) then
  47.         doTransformItem(getThingFromPos({x=388, y=314, z=8, stackpos=1}).uid, 1945)
  48.         return true
  49.     end
  50.     table.insert (position, {x=start.x+S, y=start.y+U, z=start.z})
  51.     if count <= 2 then
  52.         doCreateItem(9146, position[count])
  53.     elseif count > 2 and count <= (#d) then
  54.         doCreateItem(9146, position[count])
  55.         doCreateItem(100, position[count-2])
  56.         doSendMagicEffect(position[count-2], 2)
  57.         teleport(cid, start, count)
  58.     elseif count > (#d) and count <= (#d+2) then
  59.         doCreateItem(100, position[count-2])
  60.         doSendMagicEffect(position[count-2], 2)
  61.         teleport(cid, start, count)
  62.     end
  63.     addEvent(go, speed, count+1, start, cid, U, S)
  64. end
  65.  
  66. function teleport(cid, start, count)
  67. local pos = {x=position[count-2].x, y=position[count-2].y, z=position[count-2].z, stackpos=255}
  68.     if isPlayer(getThingFromPos(pos).uid) == TRUE then
  69.         doTeleportThing(cid, start)
  70.         doSendMagicEffect(start, 10)
  71.         doPlayerSay(cid, 'Damn! I\'m too slow!', 19)
  72.     end
  73. end
Advertisement
Add Comment
Please, Sign In to add comment