Advertisement
Guest User

code

a guest
Dec 28th, 2013
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.89 KB | None | 0 0
  1. local marker = {
  2.     toout = {X=28.451171875,Y=-2649.3642578125,Z=40.477230072021},
  3.     toin =  {X=15.1142578125,Y=-2655.5927734375,Z=40.322879791261}
  4. }
  5. local stationblips = {}
  6. stationblips[0] = createBlip(1437.7900390625,2632.25,12.125619888306,61)
  7. stationblips[1] = createBlip(2864.75,1304.134765625,12.125619888306,61)
  8. stationblips[2] = createBlip(1741.080078125,-1953.7666015625,14.875619888306,61)
  9. stationblips[3] = createBlip(817.5712890625,-1347.6533203125,13.526706695557,61)
  10. stationblips[4] = createBlip(-1944.310546875,121.2353515625,27.000619888306,61)
  11.  
  12. MAINTRAIN = createVehicle ( 538, -1978.4736328125,-865.193359375,27.000619888306, 180)
  13. setTimer(function()
  14.     createBlipAttachedTo(MAINTRAIN,52)
  15.     setElementData(MAINTRAIN,"bremst",false)
  16.     setTrainDerailable(MAINTRAIN,false)
  17.     setTrainSpeed(MAINTRAIN,0.61)
  18.     setElementData(MAINTRAIN,"fahren",true)
  19.     setTimer(function()
  20.         if getElementData(MAINTRAIN,"fahren") == true then
  21.             setTrainSpeed(MAINTRAIN,1.8)
  22.         end
  23.     end,1*1000,0)
  24. end,5000,1)
  25. local stations = {}
  26. stations[0] = {
  27.     Name = "San Fierro",
  28.     x = -1952.7197265625,
  29.     y= 71.970703125,
  30.     w = 17,
  31.     h = 120
  32. }
  33. addCommandHandler("cm",function(p)
  34.     setCameraTarget(p,p)
  35. end)
  36. addCommandHandler("ctr",function(p)
  37. warpPedIntoVehicle(p,MAINTRAIN,1)
  38. end)
  39.  
  40. function triggerTrain(dingsbums)
  41.     if dingsbums and dingsbums == MAINTRAIN then
  42.         if getElementType(dingsbums) == "vehicle" and not getElementData(dingsbums,"bremst") then
  43.             setElementData(MAINTRAIN,"fahren",false)
  44.             setElementData(dingsbums,"bremst",true)
  45.             setTimer(function()
  46.                 setTimer(function()
  47.                     setTrainSpeed(MAINTRAIN,getTrainSpeed(MAINTRAIN)/2)
  48.                     setTimer(function()
  49.                         setTrainSpeed(MAINTRAIN,getTrainSpeed(MAINTRAIN)/2)
  50.                         setTimer(function()
  51.                             setTrainSpeed(MAINTRAIN,getTrainSpeed(MAINTRAIN)/2)
  52.                             setTimer(function()
  53.                                 setTrainSpeed(MAINTRAIN,0)
  54.                             end,250,1)
  55.                         end,250,1)
  56.                     end,250,1)
  57.                 end,250,1)
  58.             end,50,20)
  59.             setTimer(function()
  60.                 setElementFrozen(dingsbums,true)
  61.                 setTrainSpeed(dingsbums,0)
  62.                 setTimer(function()
  63.                     setElementFrozen(dingsbums,false)
  64.                     setTrainSpeed(MAINTRAIN,0.1)
  65.                     setTimer(function()
  66.                         setTrainSpeed(MAINTRAIN,0.2)
  67.                         setTimer(function()
  68.                             setTrainSpeed(MAINTRAIN,0.4)
  69.                             setTimer(function()
  70.                                 setTrainSpeed(MAINTRAIN,0.6)
  71.                                 setTimer(function()
  72.                                     setTrainSpeed(MAINTRAIN,0.8)
  73.                                     setTimer(function()
  74.                                         setTrainSpeed(MAINTRAIN,1.6)
  75.                                         setElementData(dingsbums,"bremst",false)
  76.                                         setElementData(dingsbums,"fahren",true)
  77.                                     end,650,1)
  78.                                 end,650,1)
  79.                             end,650,1)
  80.                         end,650,1)
  81.                     end,650,1)
  82.                     setTimer(function()
  83.                         setElementFrozen(dingsbums,false)
  84.                         setElementData(dingsbums,"fahren",false)
  85.                         setElementData(dingsbums,"bremst",true)
  86.                     end,180*200,1)
  87.                 end,7000,1)
  88.             end,1000,1)
  89.         end
  90.     end
  91. end
  92. for i,k in pairs(stations) do
  93.     local x,y,w,h = k.x,k.y,k.w,k.h
  94.     local kubus = createColRectangle(x,y,w,h)
  95.     addEventHandler ( "onColShapeHit", kubus,triggerTrain)
  96.     outputDebugString("created station "..k.Name)
  97. end
  98. function GoIN(hitElement, matchingDimension)
  99.     if hitElement then
  100.         if getElementType(hitElement) == "player" then
  101.             setElementInterior(hitElement,1)
  102.             setElementPosition(hitElement,2.384830,33.103397,1199.849976)
  103.         end
  104.     end
  105. end
  106. function GoOUT(hitElement, matchingDimension)
  107.     outputChatBox("GOOUT")
  108.     if hitElement then
  109.         if getElementType(hitElement) == "player" then
  110.             setElementInterior(hitElement,1)
  111.             setElementPosition(hitElement,2.384830,33.103397,1199.849976)
  112.         end
  113.     end
  114. end
  115. --[[
  116. local m2 = createMarker(3.5126953125,23.1826171875,1198.6011962891, "cylinder", 1.0, 255,0,0)
  117. addEventHandler( "onMarkerHit", m2, GoOUT )
  118. local m1 = createMarker(-1945.810546875,123.2353515625,25.000619888306, "cylinder", 1.0, 255,0,0)
  119. setElementParent(m1,MAINTRAIN)
  120. addEventHandler( "onMarkerHit", m1, GoIN )
  121. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement