Guest User

Untitled

a guest
Sep 23rd, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.65 KB | None | 0 0
  1. CMD:placeboombox(playerid, params[])
  2. {
  3. if(PlayerInfo[playerid][pBoombox] == 1 || PlayerInfo[playerid][pAdmin] >= 4)
  4. {
  5. if(GetPVarInt(playerid, "IsInArena") >= 0) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this while being in an arena!");
  6. if(WatchingTV[playerid] != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can not do this while watching TV!");
  7. if(GetPVarInt(playerid, "Injured") == 1 || PlayerInfo[playerid][pHospital] == 1 || IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now.");
  8. if(GetPVarType(playerid, "pBoomBox")) return SendClientMessageEx(playerid, COLOR_WHITE, "You already have a boombox out, use /destroyboombox.");
  9.  
  10. foreach(new i: Player)
  11. {
  12. if(GetPVarType(i, "pBoomBox"))
  13. {
  14. if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "pBoomBoxX"), GetPVarFloat(i, "pBoomBoxY"), GetPVarFloat(i, "pBoomBoxZ")))
  15. {
  16. SendClientMessage(playerid, COLOR_WHITE, "You are in range of another boombox, you can't place one here!");
  17. return 1;
  18. }
  19. }
  20. }
  21.  
  22. new string[128];
  23. format(string, sizeof(string), "%s has placed a boombox!", GetPlayerNameEx(playerid));
  24. ProxDetector(30.0, playerid, string, COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
  25.  
  26. new Float:x, Float:y, Float:z, Float:a;
  27. GetPlayerPos(playerid, x, y, z);
  28. GetPlayerFacingAngle(playerid, a);
  29. ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In", 4.0, 0, 0, 0, 0, 0, 1);
  30. x += (2 * floatsin(-a, degrees));
  31. y += (2 * floatcos(-a, degrees));
  32. z -= 1.0;
  33.  
  34. SetPVarInt(playerid, "pBoomBox", CreateDynamicObject(2226, x, y, z, 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
  35. SetPVarFloat(playerid, "pBoomBoxX", x); SetPVarFloat(playerid, "pBoomBoxY", y); SetPVarFloat(playerid, "pBoomBoxZ", z);
  36. format(string, sizeof(string), "%s's boombox\n{FF0000}/setboombox {FFFF00}or\n{FF0000}/destroyboombox", GetPlayerNameEx(playerid));
  37. SetPVarInt(playerid, "pBoomBoxLabel", _:CreateDynamic3DTextLabel(string, COLOR_YELLOW, x, y, z+0.6, 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
  38. SetPVarInt(playerid, "pBoomBoxArea", CreateDynamicSphere(x, y, z, 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
  39. SetPVarInt(playerid, "pBoomBoxInt", GetPlayerInterior(playerid));
  40. SetPVarInt(playerid, "pBoomBoxVW", GetPlayerVirtualWorld(playerid));
  41. }
  42. else
  43. {
  44. SendClientMessageEx(playerid, COLOR_GRAD1, "You don't have a boom box! Buy from one a administrator/forums.");
  45. }
  46. return 1;
  47. }
  48.  
  49. CMD:destroyboombox(playerid, params[])
  50. {
  51. if(GetPVarType(playerid, "pBoomBox"))
  52. {
  53. DestroyDynamicObject(GetPVarInt(playerid, "pBoomBox"));
  54. DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "pBoomBoxLabel"));
  55. DeletePVar(playerid, "pBoomBox"); DeletePVar(playerid, "pBoomBoxStation"); DeletePVar(playerid, "pBoomBoxLabel");
  56. DeletePVar(playerid, "pBoomBoxX"); DeletePVar(playerid, "pBoomBoxY"); DeletePVar(playerid, "pBoomBoxZ");
  57. if(GetPVarType(playerid, "pBoomBoxArea"))
  58. {
  59. new string[128];
  60. format(string, sizeof(string), "* %s has destroyed the boombox.", GetPlayerNameEx(playerid));
  61. foreach(new i: Player)
  62. {
  63. if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "pBoomBoxArea")))
  64. {
  65. StopAudioStreamForPlayer(i);
  66. SendClientMessage(i, COLOR_PURPLE, string);
  67. }
  68. }
  69. DeletePVar(playerid, "pBoomBoxArea");
  70. }
  71. SendClientMessage(playerid, COLOR_WHITE, "You've destroyed your boombox!");
  72. }
  73. else
  74. {
  75. foreach(new i: Player)
  76. {
  77. if(GetPVarType(i, "pBoomBox"))
  78. {
  79. if(GetPVarInt(i, "pBoomBoxVW") == GetPlayerVirtualWorld(playerid) && GetPVarInt(i, "pBoomBoxInt") == GetPlayerInterior(playerid) && IsPlayerInRangeOfPoint(playerid, 5.0, GetPVarFloat(i, "pBoomBoxX"), GetPVarFloat(i, "pBoomBoxY"), GetPVarFloat(i, "pBoomBoxZ")))
  80. {
  81. DestroyDynamicObject(GetPVarInt(i, "pBoomBox"));
  82. DestroyDynamic3DTextLabel(Text3D:GetPVarInt(i, "pBoomBoxLabel"));
  83.  
  84. DeletePVar(i, "pBoomBox");
  85. DeletePVar(i, "pBoomBoxStation");
  86. DeletePVar(i, "pBoomBoxLabel");
  87. DeletePVar(i, "pBoomBoxX");
  88. DeletePVar(i, "pBoomBoxY");
  89. DeletePVar(i, "pBoomBoxZ");
  90. DeletePVar(i, "pBoomBoxInt");
  91. DeletePVar(i, "pBoomBoxVW");
  92.  
  93. new string[128];
  94. if(GetPVarType(i, "pBoomBoxArea"))
  95. {
  96. format(string, sizeof(string), "* %s has destroyed the boombox.", GetPlayerNameEx(playerid));
  97. foreach(new pi: Player)
  98. {
  99. if(IsPlayerInDynamicArea(pi, GetPVarInt(i, "pBoomBoxArea")))
  100. {
  101. StopAudioStreamForPlayer(pi);
  102. SendClientMessage(pi, COLOR_PURPLE, string);
  103. }
  104. }
  105. DeletePVar(i, "pBoomBoxArea");
  106. }
  107. format(string, sizeof(string), "%s has destroyed your boombox!", GetPlayerNameEx(playerid));
  108. SendClientMessage(i, COLOR_WHITE, string);
  109. return 1;
  110. }
  111. }
  112. }
  113. SendClientMessage(playerid, COLOR_WHITE, "You don't have a boombox or you are not near one to destroy.");
  114. }
  115. return 1;
  116. }
  117.  
  118. CMD:setboombox(playerid, params[])
  119. {
  120. if(GetPVarType(playerid, "pBoomBox"))
  121. {
  122. ShowPlayerDialog(playerid,SETSTATION,DIALOG_STYLE_LIST,"Radio Menu","HOT 108 JAMZ\n108.FM THE HITLIST\nHIP HOP STOP\nTurn radio off","Select", "Close");
  123. }
  124. else
  125. {
  126. SendClientMessage(playerid, COLOR_GRAD2, "You don't have a boombox out!");
  127. }
  128. return 1;
  129. }
Add Comment
Please, Sign In to add comment