SHARE
TWEET

Untitled

a guest May 19th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. YCMD:entergarage(playerid, params[] , help) {
  2.  
  3.         // Check if the player isn't inside a vehicle (the player must be on foot to use this command)
  4.     if (GetPlayerVehicleSeat(playerid) == -1 || GetPlayerVehicleSeat(playerid) == 0)
  5.     {
  6.         // Setup local variables
  7.         new GarageID, IntID;
  8.         // Loop through all garages
  9.         for (GarageID = 1; GarageID < MAX_GARAGES; GarageID++)
  10.         {
  11.             // Check if the garage exists
  12.             if (IsValidDynamicPickup(GarageInfo[GarageID][PickupID]))
  13.             {
  14.                 // Check if the player is in range of the garage-pickup
  15.                 if (IsPlayerInRangeOfPoint(playerid, 2.5, GarageInfo[GarageID][eX], GarageInfo[GarageID][eY], GarageInfo[GarageID][eZ]))
  16.                 {
  17.                    
  18.                     // The garage isn't open to the public, so keep anyone out who isn't the owner of the garage
  19.                     if (Garage_PlayerIsOwner(playerid, GarageID) == 0)
  20.                     {
  21.                         // Let the player know that this garage isn't open to the public and he can't enter it
  22.                         SendClientMessage(playerid, -1, "Nu esti ownerul acestui garaj.");
  23.                         return 1;
  24.                     }
  25.                    
  26.  
  27.                     // The player is the owner, let him in
  28.  
  29.                     // Get the interior to put the player in
  30.                     IntID = GarageInfo[GarageID][Size]; // Get the szie of the garage
  31.  
  32.                     //Store the GarageID where player enter
  33.                     PlayerGarageID[playerid] = GarageID;
  34.  
  35.                     // Set the position of the player at the spawn-location of the garage's interior
  36.                     if(GetPlayerVehicleID(playerid) != 0){
  37.                         SetPlayerPosEx1(playerid, GarageInteriors[IntID][intX], GarageInteriors[IntID][intY], GarageInteriors[IntID][intZ] , 1, GarageInfo[GarageID][VirtualWorld]);
  38.                         SetVehiclePosEx1(GetPlayerVehicleID(playerid),playerid ,GarageInteriors[IntID][intX], GarageInteriors[IntID][intY], GarageInteriors[IntID][intZ] , 1, GarageInfo[GarageID][VirtualWorld]);
  39.                     }
  40.                     else{
  41.                         SetPlayerPosEx1(playerid, GarageInteriors[IntID][intX], GarageInteriors[IntID][intY], GarageInteriors[IntID][intZ] , 1, GarageInfo[GarageID][VirtualWorld]);
  42.                     }
  43.  
  44.                     // Exit the function
  45.                     return 1;
  46.                 }
  47.             }
  48.         }
  49.     }
  50.  
  51.     // If no garage was in range, allow other script to use this command too (garage-script for example)
  52.     return 0;
  53. }
  54.  
  55. // This command lets the player exit the garage
  56. YCMD:exitgarage(playerid,params[], help) {
  57.  
  58.     if(PlayerGarageID[playerid] != 0) {
  59.         new GarageID = PlayerGarageID[playerid];
  60.         if(GetPlayerVehicleID(playerid) != 0) {
  61.             SetPlayerPosEx(playerid, GarageInfo[GarageID][eX] , GarageInfo[GarageID][eY], GarageInfo[GarageID][eZ]);
  62.             SetVehiclePosEx1(GetPlayerVehicleID(playerid),playerid ,GarageInfo[GarageID][eX] , GarageInfo[GarageID][eY], GarageInfo[GarageID][eZ], 90);
  63.         }
  64.         else{
  65.             SetPlayerPosEx1(playerid, GarageInfo[GarageID][eX] , GarageInfo[GarageID][eY], GarageInfo[GarageID][eZ]);
  66.             SetPlayerVirtualWorld(playerid, 0);
  67.             SetPlayerInterior(playerid, 0);
  68.         }
  69.         SendClientMessage(playerid, -1 , "Ai iesit din acest garaj.");
  70.     }
  71.     return 1;
  72. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top