SAMP Gitlab CI Test
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
4.1 KiB

5 years ago
  1. // SA-MP Vehicle States Helper Functions
  2. // (c) 2012 SA-MP Team
  3. // All rights reserved.
  4. // VehicleParamsEx toggle helpers
  5. stock ToggleVehicleEngine(vid)
  6. {
  7. new engine,lights,alarm,doors,bonnet,boot,objective;
  8. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  9. if(engine == VEHICLE_PARAMS_UNSET || engine == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
  10. else SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
  11. }
  12. stock ToggleVehicleLights(vid)
  13. {
  14. new engine,lights,alarm,doors,bonnet,boot,objective;
  15. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  16. if(lights == VEHICLE_PARAMS_UNSET || lights == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
  17. else SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
  18. }
  19. stock ToggleVehicleDoorsLocked(vid)
  20. {
  21. new engine,lights,alarm,doors,bonnet,boot,objective;
  22. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  23. if(doors == VEHICLE_PARAMS_UNSET || doors == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
  24. else SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
  25. }
  26. stock ToggleVehicleHood(vid)
  27. {
  28. new engine,lights,alarm,doors,bonnet,boot,objective;
  29. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  30. if(bonnet == VEHICLE_PARAMS_UNSET || bonnet == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
  31. else SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
  32. }
  33. stock ToggleVehicleTrunk(vid)
  34. {
  35. new engine,lights,alarm,doors,bonnet,boot,objective;
  36. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  37. if(boot == VEHICLE_PARAMS_UNSET || boot == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
  38. else SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
  39. }
  40. // VehicleParamsEx state setter helpers
  41. stock SetVehicleEngineState(vid, setstate)
  42. {
  43. new engine,lights,alarm,doors,bonnet,boot,objective;
  44. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  45. if(setstate) SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
  46. else SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
  47. }
  48. stock SetVehicleLightsState(vid, setstate)
  49. {
  50. new engine,lights,alarm,doors,bonnet,boot,objective;
  51. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  52. if(setstate) SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
  53. else SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
  54. }
  55. stock SetVehicleDoorsLockedState(vid, setstate)
  56. {
  57. new engine,lights,alarm,doors,bonnet,boot,objective;
  58. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  59. if(setstate) SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
  60. else SetVehicleParamsEx(vid,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
  61. }
  62. stock SetVehicleHoodState(vid, setstate)
  63. {
  64. new engine,lights,alarm,doors,bonnet,boot,objective;
  65. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  66. if(setstate) SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
  67. else SetVehicleParamsEx(vid,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
  68. }
  69. stock SetVehicleTrunkState(vid, setstate)
  70. {
  71. new engine,lights,alarm,doors,bonnet,boot,objective;
  72. GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
  73. if(setstate) SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
  74. else SetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
  75. }