Advertisement
slc_world

ASMOD Example Snippet

Nov 13th, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.29 KB | None | 0 0
  1. // Get a vehicle model to obtain information about that vehicle
  2. as::vehicle_model my_model(VEHICLE_ID::SABRETURBO);
  3. as::vehicle_model my_model(206);
  4. as::vehicle_model my_model("Sabre Turbo");
  5.  
  6. // You can also extract the vehicle model from another vehicle
  7. as::vehicle_model my_model(my_veh);
  8.  
  9. // Use that vehicle module as a blueprint to create one or more vehicles with the same model
  10. vc::vehicle@ my_veh = my_model.vehicle(my_player.world, my_player.position + as::vector3(-10, 0, 0), 0, as::rgb(), as::rgb());
  11.  
  12. // Create a vehicle using any of the overloaded constructors
  13.  
  14. // Using the vehicle model we created above
  15. vc::vehicle@ my_veh(my_model, my_player.world, my_player.position + as::vector3(-10, 0, 0), 0, as::rgb(), as::rgb());
  16.  
  17. // Pass the vehicle model ID directly
  18. vc::vehicle@ my_veh(VEHICLE_ID::SABRETURBO, my_player.world, my_player.position + as::vector3(-10, 0, 0), 0, as::rgb(), as::rgb());
  19. vc::vehicle@ my_veh(206, my_player.world, my_player.position + as::vector3(-10, 0, 0), 0, as::rgb(), as::rgb());
  20.  
  21. // Pass the vehicle model name directly
  22. vc::vehicle@ my_veh("Sabre Turbo", my_player.world, my_player.position + as::vector3(-10, 0, 0), 0, as::rgb(), as::rgb());
  23.  
  24. // Using another vehicle to extract the model, world, color etc. except the position
  25. vc::vehicle@ my_veh(another_veh, my_player.world, my_player.position + as::vector3(-10, 0, 0), 0, as::rgb(), as::rgb());
  26.  
  27. // ALL OF THE ABOVE CODE ACHIEVE THE SAME THING
  28.  
  29. // When the arrows point from the player instance to the vehicle instance
  30. // then the player embarks in that vehicle
  31.  
  32. // Get in the vehicle
  33. my_veh << my_player;
  34. // Get in the vehicle
  35. my_player >> my_veh;
  36.  
  37. // When the arrows point from the vehicle instance to the player instance
  38. // then the player disembarks from that vehicle
  39.  
  40. // Get out the vehicle
  41. my_veh >> my_player;
  42. // Get out the vehicle
  43. my_player << my_veh;
  44.  
  45. // Direct functions are also available also on both player and vehicle
  46.  
  47. my_veh.embark(my_player);
  48.  
  49. my_player.embark(my_veh);
  50.  
  51. // They all have multiple overloads to allow you to customize the result
  52.  
  53. // Extra arguments are: int slot, bool make_room, bool warp
  54. my_veh.embark(my_player, 0, true, true);
  55. // Extra arguments are: int slot, bool make_room, bool warp
  56. my_player.embark(my_veh, 0, true, true);
  57.  
  58. my_player.disembark();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement