Guest User

Untitled

a guest
Apr 25th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.94 KB | None | 0 0
  1. enum rInfo
  2. {
  3.     sCreated,
  4.     Float:sX,
  5.     Float:sY,
  6.     Float:sZ,
  7.     sObject,
  8. };
  9. new RoadInfo[MAX_ROADBLOCKS][rInfo];
  10.  
  11. /////////////////////////////////////////////////////////////////////////////////////////////////
  12.  
  13.     if(strcmp(cmd, "/deployblocks", true) == 0)
  14.     {
  15.         if(!IsACop(playerid) && !IsANG(playerid))
  16.         {
  17.             return SendClientMessage(playerid,0xFF634700,"* You are not part of an LEO faction!");
  18.         }
  19.         if(PlayerInfo[playerid][pRank] < 9)
  20.         {
  21.             SendClientMessage(playerid, COLOR_GREY, "   You need to be a higher rank!");
  22.             return 1;
  23.         }
  24.         if(IsPlayerInAnyVehicle(playerid))
  25.         {
  26.             return SendClientMessage(playerid,COLOR_GREY,"   You cannot place a road block while inside a vehicle!");
  27.         }
  28.         new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
  29.         GetPlayerPos(playerid,plocx,plocy,plocz);
  30.         GetPlayerFacingAngle(playerid,ploca);
  31.         new location[MAX_ZONE_NAME];
  32.         GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
  33.         GetPlayerFacingAngle(playerid,ploca);
  34.         CreateRoad(plocx,plocy,plocz,ploca);
  35.         format(string, sizeof(string), "HQ: %s %s has placed a road block at %s", GetPlayerRank(playerid),PlayerName(playerid), location);
  36.         SendRadioMessage(1, TEAM_BLUE_COLOR, string);
  37.         SendRadioMessage(2, TEAM_BLUE_COLOR, string);
  38.         SendRadioMessage(3, TEAM_BLUE_COLOR, string);
  39.         SendRadioMessage(5, TEAM_BLUE_COLOR, string);
  40.         ApplyAnimation(playerid, "BOMBER","BOM_Plant_Loop",4.0, 0, 0, 0, 0, 1); // Plant bomb
  41.         return 1;
  42.     }
  43.    
  44.     if(strcmp(cmd, "/deleteblock", true) == 0)
  45.     {
  46.         if(!IsACop(playerid) && !IsANG(playerid))
  47.         {
  48.             return SendClientMessage(playerid,0xFF634700,"* You are not part of an LEO faction!");
  49.         }
  50.         if(PlayerInfo[playerid][pRank] < 9)
  51.         {
  52.             SendClientMessage(playerid, COLOR_GREY, "   You need to be a higher rank!");
  53.             return 1;
  54.         }
  55.         DeleteClosestRoad(playerid);
  56.         return 1;
  57.     }
  58.    
  59.     if(strcmp(cmd, "/deleteblocks", true) == 0)
  60.     {
  61.         if(!IsACop(playerid) && !IsANG(playerid))
  62.         {
  63.             return SendClientMessage(playerid,COLOR_GREY,"* You are not part of an LEO faction!");
  64.         }
  65.         if(PlayerInfo[playerid][pRank] < 9)
  66.         {
  67.             SendClientMessage(playerid, COLOR_GREY, "   You need to be a higher rank!");
  68.             return 1;
  69.         }
  70.         format(string, sizeof(string), "HQ: %s %s has deleted all road blocks.", GetPlayerRank(playerid),PlayerName(playerid));
  71.         SendRadioMessage(1, TEAM_BLUE_COLOR, string);
  72.         SendRadioMessage(2, TEAM_BLUE_COLOR, string);
  73.         SendRadioMessage(3, TEAM_BLUE_COLOR, string);
  74.         SendRadioMessage(5, TEAM_BLUE_COLOR, string);
  75.         DeleteAllRoad();
  76.         return 1;
  77.     }
  78.    
  79.    
  80.    
  81.    
  82.    
  83.    
  84. /////////////////////////////////////////////////////////////////////////////////////////////////
  85. /////////////////////////////////////////////////////////////////////////////////////////////////
  86. /////////////////////////////////////////////////////////////////////////////////////////////////
  87. /////////////////////////////////////////////////////////////////////////////////////////////////
  88. /////////////////////////////////////////////////////////////////////////////////////////////////
  89.    
  90.    
  91.    
  92.    
  93.  
  94.  
  95. stock CreateRoad(Float:x,Float:y,Float:z,Float:Angle)
  96. {
  97.     for(new i = 0; i < sizeof(RoadInfo); i++)
  98.     {
  99.         if(RoadInfo[i][sCreated] == 0)
  100.         {
  101.             RoadInfo[i][sCreated]=1;
  102.             RoadInfo[i][sX]=x;
  103.             RoadInfo[i][sY]=y;
  104.             RoadInfo[i][sZ]=z;
  105.             RoadInfo[i][sObject] = CreateDynamicObject(978, x, y, z, 0, 0, Angle,0,0,-1,250);
  106.             return 1;
  107.         }
  108.     }
  109.     return 0;
  110. }
  111.  
  112. stock DeleteAllRoad()
  113. {
  114.     for(new i = 0; i < sizeof(RoadInfo); i++)
  115.     {
  116.         if(RoadInfo[i][sCreated] == 1)
  117.         {
  118.             RoadInfo[i][sCreated]=0;
  119.             RoadInfo[i][sX]=0.0;
  120.             RoadInfo[i][sY]=0.0;
  121.             RoadInfo[i][sZ]=0.0;
  122.             DestroyDynamicObject(RoadInfo[i][sObject]);
  123.         }
  124.     }
  125.     return 0;
  126. }
  127.  
  128. stock DeleteClosestRoad(playerid)
  129. {
  130.     for(new i = 0; i < sizeof(RoadInfo); i++)
  131.     {
  132.         if(IsPlayerInRangeOfPoint(playerid, 2.0, RoadInfo[i][sX], RoadInfo[i][sY], RoadInfo[i][sZ]))
  133.         {
  134.             if(RoadInfo[i][sCreated] == 1)
  135.             {
  136.                 new string[256];
  137.                 new location[MAX_ZONE_NAME];
  138.                 GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
  139.                 format(string, sizeof(string), "HQ: %s %s has deleted a road block at %s.", GetPlayerRank(playerid),PlayerName(playerid), location);
  140.                 SendRadioMessage(1, TEAM_BLUE_COLOR, string);
  141.                 SendRadioMessage(2, TEAM_BLUE_COLOR, string);
  142.                 SendRadioMessage(3, TEAM_BLUE_COLOR, string);
  143.                 SendRadioMessage(5, TEAM_BLUE_COLOR, string);
  144.                 RoadInfo[i][sCreated] = 0;
  145.                 RoadInfo[i][sX] = 0.0;
  146.                 RoadInfo[i][sY] =0.0;
  147.                 RoadInfo[i][sZ] = 0.0;
  148.                 DestroyDynamicObject(RoadInfo[i][sObject]);
  149.                 return 1;
  150.             }
  151.         }
  152.     }
  153.     return 0;
  154. }
Add Comment
Please, Sign In to add comment