Guest User

xdd

a guest
Nov 10th, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.12 KB | None | 0 0
  1. --[[
  2. *************************************************
  3. * DEVELOPER: Smoothy
  4. * TYPE: SERVER
  5. * INFORMATION: RESPAWN
  6. *************************************************
  7. --]]
  8.  
  9. local playerCheckpoints = {}
  10. function savePlayerCheckpoint( player )
  11. local veh = getPedOccupiedVehicle( player )
  12.     if veh then
  13.         if not playerCheckpoints[player] then
  14.             playerCheckpoints[player] = {}
  15.          end
  16.  
  17.         local posX, posY, posZ = getElementPosition( veh )
  18.         playerCheckpoints[player].m_PosX = posX
  19.         playerCheckpoints[player].m_PosY = posY
  20.         playerCheckpoints[player].m_PosZ = posZ
  21.        
  22.         local rotX, rotY, rotZ = getElementRotation( veh )
  23.         playerCheckpoints[player].m_RotX = rotX
  24.         playerCheckpoints[player].m_RotY = rotY
  25.         playerCheckpoints[player].m_RotZ = rotZ
  26.        
  27.         local velX, velY, velZ = getElementVelocity( veh )
  28.         playerCheckpoints[player].m_VelX = velX
  29.         playerCheckpoints[player].m_VelY = velY
  30.         playerCheckpoints[player].m_VelZ = velZ
  31.        
  32.         local model = getElementModel( veh )
  33.         playerCheckpoints[player].m_Model = model
  34.        
  35.         outputChatBox('saved')
  36.         end
  37. end
  38.  
  39. function loadPlayerCheckpoint( player )
  40.         if playerCheckpoints[player] then
  41.         -- LOAD
  42.         local posX, posY, posZ = playerCheckpoints[player].m_PosX, playerCheckpoints[player].m_PosY, playerCheckpoints[player].m_PosZ
  43.         local rotX, rotY, rotZ = playerCheckpoints[player].m_RotX, playerCheckpoints[player].m_RotY, playerCheckpoints[player].m_RotZ
  44.         local velX, velY, velZ = playerCheckpoints[player].m_VelX, playerCheckpoints[player].m_VelY, playerCheckpoints[player].m_VelZ
  45.         local model = playerCheckpoints[player].m_Model
  46.         -- CREATE CAR
  47.         local veh = createVehicle( model, posX, posY, posZ, rotX, rotY, rotZ )
  48.         spawnPlayer( player, posX, posY, posZ )
  49.         setCameraTarget( player, player )
  50.         warpPedIntoVehicle( player, veh )
  51.         setElementVelocity( veh, velX, velY, velZ )
  52.         outputChatBox('load')
  53.         end
  54. end
  55.  
  56. -- beta
  57.  
  58. addCommandHandler('sw', function(p)
  59. savePlayerCheckpoint(p)
  60. end)
  61.  
  62. addCommandHandler('lw', function(p)
  63. loadPlayerCheckpoint(p)
  64. end)
Advertisement
Add Comment
Please, Sign In to add comment