Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum rInfo
- {
- sCreated,
- Float:sX,
- Float:sY,
- Float:sZ,
- sObject,
- };
- new RoadInfo[MAX_ROADBLOCKS][rInfo];
- /////////////////////////////////////////////////////////////////////////////////////////////////
- if(strcmp(cmd, "/deployblocks", true) == 0)
- {
- if(!IsACop(playerid) && !IsANG(playerid))
- {
- return SendClientMessage(playerid,0xFF634700,"* You are not part of an LEO faction!");
- }
- if(PlayerInfo[playerid][pRank] < 9)
- {
- SendClientMessage(playerid, COLOR_GREY, " You need to be a higher rank!");
- return 1;
- }
- if(IsPlayerInAnyVehicle(playerid))
- {
- return SendClientMessage(playerid,COLOR_GREY," You cannot place a road block while inside a vehicle!");
- }
- new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
- GetPlayerPos(playerid,plocx,plocy,plocz);
- GetPlayerFacingAngle(playerid,ploca);
- new location[MAX_ZONE_NAME];
- GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
- GetPlayerFacingAngle(playerid,ploca);
- CreateRoad(plocx,plocy,plocz,ploca);
- format(string, sizeof(string), "HQ: %s %s has placed a road block at %s", GetPlayerRank(playerid),PlayerName(playerid), location);
- SendRadioMessage(1, TEAM_BLUE_COLOR, string);
- SendRadioMessage(2, TEAM_BLUE_COLOR, string);
- SendRadioMessage(3, TEAM_BLUE_COLOR, string);
- SendRadioMessage(5, TEAM_BLUE_COLOR, string);
- ApplyAnimation(playerid, "BOMBER","BOM_Plant_Loop",4.0, 0, 0, 0, 0, 1); // Plant bomb
- return 1;
- }
- if(strcmp(cmd, "/deleteblock", true) == 0)
- {
- if(!IsACop(playerid) && !IsANG(playerid))
- {
- return SendClientMessage(playerid,0xFF634700,"* You are not part of an LEO faction!");
- }
- if(PlayerInfo[playerid][pRank] < 9)
- {
- SendClientMessage(playerid, COLOR_GREY, " You need to be a higher rank!");
- return 1;
- }
- DeleteClosestRoad(playerid);
- return 1;
- }
- if(strcmp(cmd, "/deleteblocks", true) == 0)
- {
- if(!IsACop(playerid) && !IsANG(playerid))
- {
- return SendClientMessage(playerid,COLOR_GREY,"* You are not part of an LEO faction!");
- }
- if(PlayerInfo[playerid][pRank] < 9)
- {
- SendClientMessage(playerid, COLOR_GREY, " You need to be a higher rank!");
- return 1;
- }
- format(string, sizeof(string), "HQ: %s %s has deleted all road blocks.", GetPlayerRank(playerid),PlayerName(playerid));
- SendRadioMessage(1, TEAM_BLUE_COLOR, string);
- SendRadioMessage(2, TEAM_BLUE_COLOR, string);
- SendRadioMessage(3, TEAM_BLUE_COLOR, string);
- SendRadioMessage(5, TEAM_BLUE_COLOR, string);
- DeleteAllRoad();
- return 1;
- }
- /////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////
- stock CreateRoad(Float:x,Float:y,Float:z,Float:Angle)
- {
- for(new i = 0; i < sizeof(RoadInfo); i++)
- {
- if(RoadInfo[i][sCreated] == 0)
- {
- RoadInfo[i][sCreated]=1;
- RoadInfo[i][sX]=x;
- RoadInfo[i][sY]=y;
- RoadInfo[i][sZ]=z;
- RoadInfo[i][sObject] = CreateDynamicObject(978, x, y, z, 0, 0, Angle,0,0,-1,250);
- return 1;
- }
- }
- return 0;
- }
- stock DeleteAllRoad()
- {
- for(new i = 0; i < sizeof(RoadInfo); i++)
- {
- if(RoadInfo[i][sCreated] == 1)
- {
- RoadInfo[i][sCreated]=0;
- RoadInfo[i][sX]=0.0;
- RoadInfo[i][sY]=0.0;
- RoadInfo[i][sZ]=0.0;
- DestroyDynamicObject(RoadInfo[i][sObject]);
- }
- }
- return 0;
- }
- stock DeleteClosestRoad(playerid)
- {
- for(new i = 0; i < sizeof(RoadInfo); i++)
- {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, RoadInfo[i][sX], RoadInfo[i][sY], RoadInfo[i][sZ]))
- {
- if(RoadInfo[i][sCreated] == 1)
- {
- new string[256];
- new location[MAX_ZONE_NAME];
- GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
- format(string, sizeof(string), "HQ: %s %s has deleted a road block at %s.", GetPlayerRank(playerid),PlayerName(playerid), location);
- SendRadioMessage(1, TEAM_BLUE_COLOR, string);
- SendRadioMessage(2, TEAM_BLUE_COLOR, string);
- SendRadioMessage(3, TEAM_BLUE_COLOR, string);
- SendRadioMessage(5, TEAM_BLUE_COLOR, string);
- RoadInfo[i][sCreated] = 0;
- RoadInfo[i][sX] = 0.0;
- RoadInfo[i][sY] =0.0;
- RoadInfo[i][sZ] = 0.0;
- DestroyDynamicObject(RoadInfo[i][sObject]);
- return 1;
- }
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment