Advertisement
Guest User

Basic courier

a guest
Jan 25th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.75 KB | None | 0 0
  1. CMD:dropcrate(playerid, params[])
  2. {
  3. RemovePlayerAttachedObject(playerid, JOB_SLOT);
  4. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
  5. PlayerData[playerid][pLoading] = 0;
  6. return 1;
  7. }
  8. CMD:takecrate(playerid, params[])
  9. {
  10. if(PlayerData[playerid][pJob] != JOB_COURIER)
  11. return SendErrorMessage(playerid, "You don't have the appropriate job.");
  12.  
  13. if(IsPlayerInAnyVehicle(playerid))
  14. return SendErrorMessage(playerid, "You must exit the vehicle first.");
  15.  
  16. if(PlayerData[playerid][pLoading] == 1)
  17. return SendErrorMessage(playerid, "You still carry the crate");
  18.  
  19. PlayerData[playerid][pLoading] = 1;
  20. ApplyAnimation(playerid, "CARRY", "liftup", 4.1, 0, 0, 0, 0, 0, 1);
  21. SetPlayerAttachedObject(playerid, JOB_SLOT, 3014, 1, 0.038192, 0.371544, 0.055191, 0.000000, 90.000000, 357.668670, 1.000000, 1.000000, 1.000000);
  22. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
  23. return 1;
  24. }
  25. CMD:putcrate(playerid, params[])
  26. {
  27. for (new i = 1; i != MAX_VEHICLES; i ++) if (IsPlayerNearBoot(playerid, i))
  28. {
  29. if (CoreVehicles[i][vehLoadType] != 0 && CoreVehicles[i][vehLoadType] != PlayerData[playerid][pLoadType])
  30. return SendErrorMessage(playerid, "This vehicle is already loaded with something else.");
  31.  
  32. if (CoreVehicles[i][vehLoads] >= 6)
  33. return SendErrorMessage(playerid, "This vehicle can only hold up to 6 crates.");
  34.  
  35. if (IsLoadableVehicle(i))
  36. {
  37. ApplyAnimation(playerid, "CARRY", "putdwn", 4.0, 0, 0, 0, 0, 0);
  38. RemovePlayerAttachedObject(playerid, JOB_SLOT);
  39. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
  40. PlayerData[playerid][pLoading] = 0;
  41. CoreVehicles[i][vehLoads]++;
  42. CoreVehicles[i][vehLoadType] = PlayerData[playerid][pLoadType];
  43. return 1;
  44. }
  45. else
  46. {
  47. SendErrorMessage(playerid, "This car is not filled with crates");
  48. return 1;
  49. }
  50.  
  51. }
  52. SendErrorMessage(playerid, "You arenot in range of loadable");
  53. return 1;
  54. }
  55. CMD:unloadcrate(playerid, params[])
  56. {
  57. new
  58. id = -1,
  59. vehid = GetPlayerVehicleID(playerid);
  60.  
  61. if (PlayerData[playerid][pJob] != JOB_COURIER)
  62. return SendErrorMessage(playerid, "You don't have the appropriate job.");
  63.  
  64. if(!IsLoadableVehicle(GetPlayerVehicleID(playerid)))
  65. return SendErrorMessage(playerid, "You must be in truck to use this action.");
  66.  
  67. if (!CoreVehicles[vehid][vehLoadType] || CoreVehicles[vehid][vehLoads] < 1)
  68. return SendErrorMessage(playerid, "There is nothing loaded in this vehicle.");
  69.  
  70. if(PlayerData[playerid][pSedangUnload] == 1)
  71. return SendErrorMessage(playerid, "Kamu sedang unload crate");
  72.  
  73. if((id = Business_NearestDeliver(playerid)) != -1)
  74. {
  75. if (PlayerData[playerid][pShipment] != -1 && id != PlayerData[playerid][pShipment])
  76. return SendErrorMessage(playerid, "You didn't accept shipment for this business.");
  77. }
  78. PlayerData[playerid][pSedangUnload] = 1;
  79. TogglePlayerControllable(playerid, 0);
  80. PlayerData[playerid][pUnloadVehicle] = vehid;
  81. GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~r~Unloading crates...", 5000, 3);
  82. SetTimerEx("Unloadcourier", 5000, false, "dd", playerid, vehid);
  83. return 1;
  84.  
  85. }
  86.  
  87. function Unloadcourier(playerid, vehid)
  88. {
  89. PlayerData[playerid][pSedangUnload] = 0;
  90. TogglePlayerControllable(playerid, 1);
  91. CoreVehicles[PlayerData[playerid][pUnloadVehicle]][vehLoads] = 0;
  92. PlayerTextDrawHide(playerid, PlayerData[playerid][pTextdraws][82]);
  93. TruckingCheck[playerid] = 0;
  94. PlayerData[playerid][pDelayTruck] = 1;
  95. SendServerMessage(playerid, "You did it");
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement