Guest User

deploycade

a guest
May 24th, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. CMD:deploycade(playerid, params[])
  2. {
  3. if(IsACop(playerid))
  4. {
  5. if(IsPlayerInAnyVehicle(playerid))
  6. {
  7. SendClientMessage(playerid, COLOR_GREY, "You must be on foot to use this command.");
  8. return 1;
  9. }
  10. if(PlayerInfo[playerid][pRank] < 3 && PlayerInfo[playerid][pFaction] != 2)
  11. {
  12. SendClientMessage(playerid, COLOR_GREY, "You need to be at least rank 3 to use this command.");
  13. return 1;
  14. }
  15. if(GetPlayerInterior(playerid) != 0)
  16. {
  17. SendClientMessage(playerid, COLOR_GREY, "You can't deploy barricades in interiors.");
  18. return 1;
  19. }
  20.  
  21. new string[128], Float:Position[4];
  22. for(new i; i<MAX_BARRICADES; i++)
  23. {
  24. if(Barricade[i] == 0)
  25. {
  26. GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
  27. GetPlayerFacingAngle(playerid, Position[3]);
  28. Barricade[i] = CreateDynamicObject(981, Position[0], Position[1], Position[2], 0.0, 0.0, Position[3]+180.0, -1, -1, -1, 200.0);
  29. SetPlayerPos(playerid, Position[0], Position[1]+4, Position[2]);
  30. new zone[MAX_ZONE_NAME];
  31. GetPlayer3DZone(playerid, zone, sizeof(zone));
  32. format(string, sizeof(string), "HQ: A barricade has been deployed by %s at %s.", GetPlayerNameEx(playerid), zone);
  33. foreach(Player, x)
  34. {
  35. if(IsACop(x))
  36. {
  37. SendClientMessage(x, TEAM_BLUE_COLOR, string);
  38. if(PlayerInfo[x][pRank] >= 3)
  39. {
  40. SendClientMessage(x, COLOR_YELLOW, "You can remove a barricade by typing /destroycade.");
  41. }
  42. }
  43. }
  44. return 1;
  45. }
  46. }
  47. SendClientMessage(playerid, COLOR_GREY, "All available barriers have been deployed.");
  48. }
  49. else
  50. {
  51. SendClientMessage(playerid, COLOR_GREY, "You're not a law enforcement officer.");
  52. }
  53. return 1;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment