Guest User

Untitled

a guest
Jul 26th, 2014
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. CMD:tow(playerid, params[]) {
  2. if(IsACop(playerid)) {
  3. if(IsPlayerInAnyVehicle(playerid))
  4. {
  5. new
  6. carid = GetPlayerVehicleID(playerid);
  7.  
  8. if(IsATowTruck(carid))
  9. {
  10. new
  11. closestcar = GetClosestCar(playerid, carid);
  12.  
  13. foreach(Player, i) {
  14. if(arr_Towing[i] == closestcar || (GetPlayerVehicleID(i) == closestcar && GetPlayerState(i) == 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't tow a vehicle which is occupied, or in tow.");
  15. }
  16.  
  17. if(GetDistanceToCar(playerid,closestcar) <= 8 && !IsTrailerAttachedToVehicle(carid)) {
  18. foreach(Player, i) {
  19. if(GetPlayerVehicle(i, closestcar) != -1) {
  20.  
  21. new
  22. hKey;
  23.  
  24. if(((hKey = PlayerInfo[i][pHouse]) != INVALID_HOUSE_ID) && IsPlayerInRangeOfPoint(playerid, 50.0, HouseInfo[hKey][hExteriorX], HouseInfo[hKey][hExteriorY], HouseInfo[hKey][hExteriorZ])
  25. ||((hKey = PlayerInfo[i][pHouse2]) != INVALID_HOUSE_ID) && IsPlayerInRangeOfPoint(playerid, 50.0, HouseInfo[hKey][hExteriorX], HouseInfo[hKey][hExteriorY], HouseInfo[hKey][hExteriorZ])) {
  26. return SendClientMessage(playerid, COLOR_GREY, "This vehicle doesn't need to be towed.");
  27. }
  28.  
  29.  
  30. if(ProxDetectorS(30.0,playerid,i))
  31. SendClientMessage(i, COLOR_LIGHTBLUE, "Someone is attempting to tow your vehicle away!");
  32.  
  33. arr_Towing[playerid] = closestcar;
  34. SendClientMessage(playerid, COLOR_GRAD2, "This player owned vehicle is available for impounding.");
  35. return AttachTrailerToVehicle(closestcar,carid);
  36. }
  37. }
  38. SendClientMessage(playerid, COLOR_GRAD2, "This vehicle has no registration, it is available for impounding.");
  39. AttachTrailerToVehicle(closestcar,carid);
  40. arr_Towing[playerid] = closestcar;
  41. return 1;
  42. }
  43. }
  44. else SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to tow with this vehicle.");
  45. }
  46. else SendClientMessage(playerid, COLOR_GRAD2, "You need to be inside a vehicle to use this command!");
  47. }
  48. else SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command.");
  49. return 1;
  50. }
  51.  
  52. CMD:untow(playerid, params[])
  53. {
  54. if(IsACop(playerid))
  55. {
  56. if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
  57. {
  58. SendClientMessage(playerid, COLOR_GRAD1,"You have unhooked the vehicle that you were towing.");
  59. arr_Towing[playerid] = INVALID_VEHICLE_ID;
  60. DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
  61. }
  62. else
  63. {
  64. SendClientMessage(playerid, COLOR_GRAD1,"You're currently not towing anything.");
  65. }
  66. }
  67. else
  68. {
  69. SendClientMessage(playerid, COLOR_GRAD2, "You're not authorized to use this command.");
  70. }
  71. return 1;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment