Guest User

Untitled

a guest
Nov 28th, 2010
1,710
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. new EngineStatus[MAX_PLAYERS], LightsStatus[MAX_PLAYERS], AlarmStatus[MAX_PLAYERS], DoorsStatus[MAX_PLAYERS], BonnetStatus[MAX_PLAYERS], BootStatus[MAX_PLAYERS], ObjectiveStatus[MAX_PLAYERS];
  5.  
  6. public OnFilterScriptInit()
  7. {
  8.     print("\n--------------------------------------");
  9.     print(" Vehicle Control System Loaded");
  10.     print(" Coded by Auxxx");
  11.     print("--------------------------------------\n");
  12.     return 1;
  13. }
  14.  
  15. public OnFilterScriptExit()
  16. {
  17.     print("\n--------------------------------------");
  18.     print(" Vehicle Control System Un-Loaded");
  19.     print(" Coded by Auxxx");
  20.     print("--------------------------------------\n");
  21.     return 1;
  22. }
  23.  
  24. public OnGameModeInit()
  25. {
  26.     ManualVehicleEngineAndLights();
  27.     AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
  28.     return 1;
  29. }
  30.  
  31. CMD:veh(playerid, params[])
  32. {
  33.     new engine,lights,alarm,doors,bonnet,boot,objective;
  34.     new veh = GetPlayerVehicleID(playerid);
  35.     if(strcmp(params, "Engine", true) == 0)
  36.     {
  37.         if(IsPlayerInAnyVehicle(playerid))
  38.         {
  39.             if(veh != INVALID_VEHICLE_ID)
  40.             {
  41.                 if(EngineStatus[playerid] == 0)
  42.                 {
  43.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  44.                     SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
  45.                     EngineStatus[playerid] = 1;
  46.                     SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's engine {2F991A}on!");
  47.                 }
  48.                 else if(EngineStatus[playerid] == 1)
  49.                 {
  50.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  51.                     SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
  52.                     EngineStatus[playerid] = 0;
  53.                     SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's engine {E31919}off!");
  54.                 }
  55.             }
  56.         }
  57.         else {
  58.         SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
  59.         }
  60.     }
  61.     else if(strcmp(params, "Lights", true) == 0)
  62.     {
  63.         if(IsPlayerInAnyVehicle(playerid))
  64.         {
  65.             if(veh != INVALID_VEHICLE_ID)
  66.             {
  67.                 if(LightsStatus[playerid] == 0)
  68.                 {
  69.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  70.                     SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
  71.                     LightsStatus[playerid] = 1;
  72.                     SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's lights {2F991A}on!");
  73.                 }
  74.                 else if(LightsStatus[playerid] == 1)
  75.                 {
  76.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  77.                     SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
  78.                     LightsStatus[playerid] = 0;
  79.                     SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's lights {E31919}off!");
  80.                 }
  81.             }
  82.         }
  83.         else {
  84.         SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
  85.         }
  86.     }
  87.     else if(strcmp(params, "Alarm", true) == 0)
  88.     {
  89.         if(IsPlayerInAnyVehicle(playerid))
  90.         {
  91.             if(veh != INVALID_VEHICLE_ID)
  92.             {
  93.                 if(AlarmStatus[playerid] == 0)
  94.                 {
  95.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  96.                     SetVehicleParamsEx(veh,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
  97.                     AlarmStatus[playerid] = 1;
  98.                     SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's alarm {2F991A}on!");
  99.                 }
  100.                 else if(AlarmStatus[playerid] == 1)
  101.                 {
  102.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  103.                     SetVehicleParamsEx(veh,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective);
  104.                     AlarmStatus[playerid] = 0;
  105.                     SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's alarm {E31919}off!");
  106.                 }
  107.             }
  108.         }
  109.         else {
  110.         SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
  111.         }
  112.     }
  113.     else if(strcmp(params, "Doors", true) == 0)
  114.     {
  115.         if(IsPlayerInAnyVehicle(playerid))
  116.         {
  117.             if(veh != INVALID_VEHICLE_ID)
  118.             {
  119.                 if(DoorsStatus[playerid] == 0)
  120.                 {
  121.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  122.                     SetVehicleParamsEx(veh,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
  123.                     DoorsStatus[playerid] = 1;
  124.                     SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's doors are now {2F991A}open!");
  125.                 }
  126.                 else if(DoorsStatus[playerid] == 1)
  127.                 {
  128.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  129.                     SetVehicleParamsEx(veh,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
  130.                     DoorsStatus[playerid] = 0;
  131.                     SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's doors are now {E31919}closed!");
  132.                 }
  133.             }
  134.         }
  135.         else {
  136.         SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
  137.         }
  138.     }
  139.     else if(strcmp(params, "Bonnet", true) == 0)
  140.     {
  141.         if(IsPlayerInAnyVehicle(playerid))
  142.         {
  143.             if(veh != INVALID_VEHICLE_ID)
  144.             {
  145.                 if(BonnetStatus[playerid] == 0)
  146.                 {
  147.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  148.                     SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
  149.                     BonnetStatus[playerid] = 1;
  150.                     SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's bonnet is now {2F991A}open!");
  151.                 }
  152.                 else if(BonnetStatus[playerid] == 1)
  153.                 {
  154.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  155.                     SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
  156.                     BonnetStatus[playerid] = 0;
  157.                     SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's bonnet is now {E31919}closed!");
  158.                 }
  159.             }
  160.         }
  161.         else {
  162.         SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
  163.         }
  164.     }
  165.     else if(strcmp(params, "Boot", true) == 0)
  166.     {
  167.         if(IsPlayerInAnyVehicle(playerid))
  168.         {
  169.             if(veh != INVALID_VEHICLE_ID)
  170.             {
  171.                 if(BootStatus[playerid] == 0)
  172.                 {
  173.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  174.                     SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
  175.                     BootStatus[playerid] = 1;
  176.                     SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's boot is now {2F991A}open!");
  177.                 }
  178.                 else if(BootStatus[playerid] == 1)
  179.                 {
  180.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  181.                     SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
  182.                     BootStatus[playerid] = 0;
  183.                     SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's boot is now {E31919}closed!");
  184.                 }
  185.             }
  186.         }
  187.         else {
  188.         SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
  189.         }
  190.     }
  191.     else if(strcmp(params, "Objective", true) == 0)
  192.     {
  193.         if(IsPlayerInAnyVehicle(playerid))
  194.         {
  195.             if(veh != INVALID_VEHICLE_ID)
  196.             {
  197.                 if(ObjectiveStatus[playerid] == 0)
  198.                 {
  199.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  200.                     SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,VEHICLE_PARAMS_ON);
  201.                     ObjectiveStatus[playerid] = 1;
  202.                     SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's objective is now {2F991A}active!");
  203.                 }
  204.                 else if(ObjectiveStatus[playerid] == 1)
  205.                 {
  206.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  207.                     SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,VEHICLE_PARAMS_OFF);
  208.                     ObjectiveStatus[playerid] = 0;
  209.                     SendClientMessage(playerid, 0xFFFFFFAA, "The vehicle's objective is now {E31919}unactive!");
  210.                 }
  211.             }
  212.         }
  213.         else {
  214.         SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
  215.         }
  216.     }
  217.     else SendClientMessage(playerid, 0xFFFFFFAA, "SYNTAX: /veh [function]"),
  218.     SendClientMessage(playerid, 0xFFFFFFAA, "Functions: Engine, Lights, Alarm, Doors, Bonnet, Boot, Objective");
  219.     return 1;
  220. }
RAW Paste Data