Advertisement
Guest User

Vehicle Control System

a guest
Dec 8th, 2010
3,152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.45 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4.  
  5. public OnFilterScriptInit()
  6. {
  7. print("Advanced Vehicle Control System - Created by Shadow");
  8. print("Idea taken from ' Delux13 '");
  9. return 1;
  10. }
  11.  
  12. public OnFilterScriptExit()
  13. {
  14. return 1;
  15. }
  16.  
  17. public OnPlayerCommandText(playerid, cmdtext[])
  18. {
  19. if(strcmp(cmdtext,"/vcontrol",true)==0)
  20. {
  21. if(!IsPlayerInAnyVehicle(playerid))
  22. {
  23. SendClientMessage(playerid, 0xCC0000FF, "ERROR : You must be inside a vehicle to use this command.");
  24. }
  25. else
  26. {
  27. ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Control", "Lighting ( On/Off )\nBonnect ( Open/Close )\nBoot/Trunk ( Open/Close )\nDoors ( Open/Close )\nEngine ( On/Off )\nAlarm ( On/Off )", "Select", "Cancel");
  28. }
  29. return 1;
  30. }
  31. return 0;
  32. }
  33.  
  34.  
  35. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  36. {
  37. new veh = GetPlayerVehicleID(playerid);
  38. new engine,lights,alarm,doors,bonnet,boot,objective;
  39. if(dialogid == 1)
  40. {
  41. if(!response) return SendClientMessage(playerid, 0xCC0000FF, "INFORMATION : You clicked Cancel");
  42. switch(listitem)
  43. {
  44. case 0:
  45. {
  46. if(GetPVarInt(playerid, "Lights") == 0)
  47. {
  48. GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  49. SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
  50. SetPVarInt(playerid, "Lights", 1);
  51. }
  52. else if(GetPVarInt(playerid, "Lights") == 1)
  53. {
  54. GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  55. SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
  56. SetPVarInt(playerid, "Lights", 0);
  57. }
  58. }
  59. case 1:
  60. {
  61. if(GetPVarInt(playerid, "Bonnet") == 0)
  62. {
  63. GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  64. SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
  65. SetPVarInt(playerid, "Bonnet", 1);
  66. }
  67. else if(GetPVarInt(playerid, "Bonnet") == 1)
  68. {
  69. GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  70. SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
  71. SetPVarInt(playerid, "Bonnet", 0);
  72. }
  73. }
  74. case 2:
  75. {
  76. if(GetPVarInt(playerid, "Boot") == 0)
  77. {
  78. GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  79. SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
  80. SetPVarInt(playerid, "Boot", 1);
  81. }
  82. else if(GetPVarInt(playerid, "Boot") == 1)
  83. {
  84. GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  85. SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
  86. SetPVarInt(playerid, "Boot", 0);
  87. }
  88. }
  89. case 3:
  90. {
  91. if(GetPVarInt(playerid, "Doors") == 0)
  92. {
  93. GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  94. SetVehicleParamsEx(veh,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
  95. SetPVarInt(playerid, "Doors", 1);
  96. }
  97. else if(GetPVarInt(playerid, "Doors") == 1)
  98. {
  99. GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  100. SetVehicleParamsEx(veh,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
  101. SetPVarInt(playerid, "Doors", 0);
  102. }
  103. }
  104. case 4:
  105. {
  106. if(GetPVarInt(playerid, "Engine") == 0)
  107. {
  108. GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  109. SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
  110. SetPVarInt(playerid, "Engine", 1);
  111. }
  112. else if(GetPVarInt(playerid, "Engine") == 1)
  113. {
  114. GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  115. SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
  116. SetPVarInt(playerid, "Engine", 0);
  117. }
  118. }
  119. case 5:
  120. {
  121. if(GetPVarInt(playerid, "Alarm") == 0)
  122. {
  123. GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  124. SetVehicleParamsEx(veh,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
  125. SetPVarInt(playerid, "Alarm", 1);
  126. }
  127. else if(GetPVarInt(playerid, "Alarm") == 1)
  128. {
  129. GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  130. SetVehicleParamsEx(veh,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective);
  131. SetPVarInt(playerid, "Alarm", 0);
  132. }
  133. }
  134. }
  135. return 1;
  136. }
  137. return 0;
  138. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement