Advertisement
Jesterrrr

Rent-A-Truck Script

Jun 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.22 KB | None | 0 0
  1. //Global Variables:
  2. JDEV_rentTruck = false;
  3.  
  4. //Script on NPC:
  5. this addaction["Rent a truck",JDEV_fnc_rentTruck];
  6.  
  7. // File: fn_rentTruck.sqf
  8. // Author: Jester
  9. // Description: Rents a truck for you to use
  10. JDEV_rentTruck = true;
  11. if (JDEV_rentTruck isEqualTo true) then {
  12.     titleText ["You rented a truck for the next 3 minutes!", "PLAIN"];
  13.     _truckRental = "C_Van_01_box_white_F" createVehicle getMarkerPos "marker_8";
  14.     player moveInAny _truckRental;
  15. };
  16. JDEV_rentTime = 180; //seconds of rental
  17. while {(JDEV_rentTruck isEqualTo true) and (JDEV_rentTime > -1)} do {
  18.     sleep 1;
  19.     JDEV_rentTime = JDEV_rentTime - 1;
  20.     if (JDEV_rentTime == 60) then { //1 minute warning
  21.         hint "1 minute left on rental!";
  22.     };
  23.     if (JDEV_rentTime == 30) then { //30 sec warning
  24.     hint "30 seconds left on rental!";
  25.     };
  26.     if ((JDEV_rentTime < 11) and (JDEV_rentTime > 0))  then { //Will countdown once it gets to 10 seconds
  27.         hintSilent format ["Seconds until rental is over: %1", JDEV_rentTime];
  28.     };
  29.     if (JDEV_rentTime == 0) then { //When timer is done
  30.         _truck = ((getPos player) nearestObject "C_Van_01_box_white_F");
  31.         deleteVehicle _truck;
  32.         hint "Rental Time is over! Go back to the rental NPC to rent it again.";
  33.         JDEV_rentTruck = false;
  34.     };
  35. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement