Guest User

Untitled

a guest
Jan 26th, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. --vehicle spawning
  2. vehicles = {}
  3. function spawnv ( id )
  4. if getElementDimension (source) == 10 then
  5. outputChatBox ( "You can't use vehicle here", source, 255, 0, 0 )
  6. else
  7. if vehicles[source] and isElement(vehicles[source]) then
  8. destroyElement(vehicles[source])
  9. end
  10. local x, y, z = getElementPosition ( source )
  11. local xr, yr, zr = getElementRotation ( source )
  12. vehicles[source] = createVehicle ( id, x, y, z + 0.5, xr, yr, zr )
  13. warpPedIntoVehicle(source, vehicles[source])
  14. end
  15. end
  16.  
  17.  
  18. addEvent ( "spawn", true )
  19. rootElement = getRootElement()
  20. addEventHandler ( "spawn", rootElement, spawnv )
  21.  
  22. function destroyveh ()
  23. if vehicles[source] and isElement(vehicles[source]) then
  24. destroyElement(vehicles[source])
  25. else
  26. outputChatBox( "There is no old car.", source )
  27. end
  28. end
  29.  
  30.  
  31. addEvent ( "destroy", true )
  32. addEventHandler ( "destroy", rootElement, destroyveh )
Advertisement
Add Comment
Please, Sign In to add comment