Advertisement
Guest User

Vehicle Control By Shadow-

a guest
Jan 8th, 2012
2,241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 5.12 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.     return 1;
  9. }
  10.  
  11. public OnPlayerCommandText(playerid, cmdtext[])
  12. {
  13.     if(strcmp(cmdtext,"/vcontrol",true)==0)
  14.     {
  15.         if(!IsPlayerInAnyVehicle(playerid))
  16.         {
  17.             SendClientMessage(playerid, 0xCC0000FF, "ERROR : You must be inside a vehicle to use this command.");
  18.         }
  19.         else
  20.         {
  21.             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 )\nSet Licence Plate", "Select", "Cancel");
  22.         }
  23.         return 1;
  24.     }
  25.     if(strcmp(cmdtext, "/spawncar", true) == 0)
  26.     {
  27.         new Float:x, Float:y, Float:z;
  28.         GetPlayerPos(playerid, x, y, z);
  29.         AddStaticVehicle(420, x, y, z, 0, 1, 1);
  30.         return 1;
  31.     }
  32.     return 0;
  33. }
  34.  
  35.  
  36. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  37. {
  38.     new veh = GetPlayerVehicleID(playerid);
  39.     new engine,lights,alarm,doors,bonnet,boot,objective;
  40.     if(dialogid == 1)
  41.     {
  42.         if(!response) return SendClientMessage(playerid, 0xCC0000FF, "INFORMATION : You pressed Cancel");
  43.         switch(listitem)
  44.         {
  45.             case 0:
  46.             {
  47.                 if(GetPVarInt(playerid, "Lights") == 0)
  48.                 {
  49.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  50.                     SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
  51.                     SetPVarInt(playerid, "Lights", 1);
  52.                 }
  53.                 else if(GetPVarInt(playerid, "Lights") == 1)
  54.                 {
  55.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  56.                     SetVehicleParamsEx(veh,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
  57.                     SetPVarInt(playerid, "Lights", 0);
  58.                 }
  59.             }
  60.             case 1:
  61.             {
  62.                 if(GetPVarInt(playerid, "Bonnet") == 0)
  63.                 {
  64.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  65.                     SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_ON,boot,objective);
  66.                     SetPVarInt(playerid, "Bonnet", 1);
  67.                 }
  68.                 else if(GetPVarInt(playerid, "Bonnet") == 1)
  69.                 {
  70.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  71.                     SetVehicleParamsEx(veh,engine,lights,alarm,doors,VEHICLE_PARAMS_OFF,boot,objective);
  72.                     SetPVarInt(playerid, "Bonnet", 0);
  73.                 }
  74.             }
  75.             case 2:
  76.             {
  77.                 if(GetPVarInt(playerid, "Boot") == 0)
  78.                 {
  79.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  80.                     SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_ON,objective);
  81.                     SetPVarInt(playerid, "Boot", 1);
  82.                 }
  83.                 else if(GetPVarInt(playerid, "Boot") == 1)
  84.                 {
  85.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  86.                     SetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,VEHICLE_PARAMS_OFF,objective);
  87.                     SetPVarInt(playerid, "Boot", 0);
  88.                 }
  89.             }
  90.             case 3:
  91.             {
  92.                 if(GetPVarInt(playerid, "Doors") == 0)
  93.                 {
  94.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  95.                     SetVehicleParamsEx(veh,engine,lights,alarm,VEHICLE_PARAMS_ON,bonnet,boot,objective);
  96.                     SetPVarInt(playerid, "Doors", 1);
  97.                 }
  98.                 else if(GetPVarInt(playerid, "Doors") == 1)
  99.                 {
  100.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  101.                     SetVehicleParamsEx(veh,engine,lights,alarm,VEHICLE_PARAMS_OFF,bonnet,boot,objective);
  102.                     SetPVarInt(playerid, "Doors", 0);
  103.                 }
  104.             }
  105.             case 4:
  106.             {
  107.                 if(GetPVarInt(playerid, "Engine") == 0)
  108.                 {
  109.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  110.                     SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
  111.                     SetPVarInt(playerid, "Engine", 1);
  112.                 }
  113.                 else if(GetPVarInt(playerid, "Engine") == 1)
  114.                 {
  115.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  116.                     SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
  117.                     SetPVarInt(playerid, "Engine", 0);
  118.                 }
  119.             }
  120.             case 5:
  121.             {
  122.                 if(GetPVarInt(playerid, "Alarm") == 0)
  123.                 {
  124.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  125.                     SetVehicleParamsEx(veh,engine,lights,VEHICLE_PARAMS_ON,doors,bonnet,boot,objective);
  126.                     SetPVarInt(playerid, "Alarm", 1);
  127.                 }
  128.                 else if(GetPVarInt(playerid, "Alarm") == 1)
  129.                 {
  130.                     GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
  131.                     SetVehicleParamsEx(veh,engine,lights,VEHICLE_PARAMS_OFF,doors,bonnet,boot,objective);
  132.                     SetPVarInt(playerid, "Alarm", 0);
  133.                 }
  134.             }
  135.             case 6:
  136.             {
  137.                 ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "License Plate", "Please type your chosen number plate [A-Z, 0-9] (32 Characters Only)", "Set", "");
  138.             }
  139.         }
  140.         return 1;
  141.     }
  142.     if(dialogid == 2)
  143.     {
  144.         if(response)
  145.         {
  146.             new Float:vX, Float:vY, Float:vZ, Float:vA;
  147.             SetVehicleNumberPlate(veh, inputtext);
  148.             GetVehiclePos(veh,vX,vY,vZ);
  149.             GetVehicleZAngle(veh,vA);
  150.             SetVehicleToRespawn(veh);
  151.             SetVehiclePos(veh,vX,vY,vZ);
  152.             PutPlayerInVehicle(playerid,veh,0);
  153.             SetVehicleZAngle(veh,vA);
  154.         }
  155.         return 1;
  156.     }
  157.     return 0;
  158. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement