Guest User

..

a guest
Nov 10th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.61 KB | None | 0 0
  1. local playerCheckpoints = {}
  2. function savePlayerCheckpoint( player )
  3. local veh = getPedOccupiedVehicle( player )
  4.     if veh then
  5.         if not playerCheckpoints[player] then
  6.         playerCheckpoints[player] = {}
  7.         end
  8.         -- POS
  9.         local posX, posY, posZ = getElementPosition( veh )
  10.         playerCheckpoints[player].m_PosX = posX
  11.         playerCheckpoints[player].m_PosY = posY
  12.         playerCheckpoints[player].m_PosZ = posZ
  13.         -- ROT
  14.         local rotX, rotY, rotZ = getElementRotation( veh )
  15.         playerCheckpoints[player].m_RotX = rotX
  16.         playerCheckpoints[player].m_RotY = rotY
  17.         playerCheckpoints[player].m_RotZ = rotZ
  18.         -- VEL
  19.         local velX, velY, velZ = getElementVelocity( veh )
  20.         playerCheckpoints[player].m_VelX = velX
  21.         playerCheckpoints[player].m_VelY = velY
  22.         playerCheckpoints[player].m_VelZ = velZ
  23.         -- MODEL
  24.         local model = getElementModel( veh )
  25.         playerCheckpoints[player].m_Model = model
  26.         outputChatBox('saved')
  27.     end
  28. end
  29.  
  30. function loadPlayerCheckpoint( player )
  31.     if playerCheckpoints[player] then
  32.     -- LOAD
  33.     local posX, posY, posZ = playerCheckpoints[player].m_PosX, playerCheckpoints[player].m_PosY, playerCheckpoints[player].m_PosZ
  34.     local rotX, rotY, rotZ = playerCheckpoints[player].m_RotX, playerCheckpoints[player].m_RotY, playerCheckpoints[player].m_RotZ
  35.     local velX, velY, velZ = playerCheckpoints[player].m_VelX, playerCheckpoints[player].m_VelY, playerCheckpoints[player].m_VelZ
  36.     local model = playerCheckpoints[player].m_Model
  37.     -- CREATE CAR
  38.     local veh = createVehicle( model, posX, posY, posZ, rotX, rotY, rotZ )
  39.     warpPedIntoVehicle( player, veh )
  40.     setElementVelocity( veh, velX, velY, velZ )
  41.     outputChatBox('load')
  42.     end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment