Advertisement
Guest User

BoomBox(Radio)

a guest
Jul 5th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.11 KB | None | 0 0
  1. pBoomBox,
  2.  
  3. ////////////////////////////////////////////////////RADIO SYSTEM(BOOMBOX)/////////////////////////////////////////////
  4. CMD:rhelp(playerid, params[])
  5. {
  6. if(UlogovanProvera[playerid] == 0) return SCM(playerid,-1," "CRVENA2"Moras se ulogovati da bi koristio ovu komandu!");
  7. if(PlayerInfo[playerid][pBoomBox] == 0) return SCM(playerid, -1, ""CRVENA2"SERVER: Nemate Radio!");
  8. SendClientMessage(playerid, COLOR_RED, ""CRVENA2"Radio Komande: /postaviradio /pokupiradio /podesiradio");
  9. return 1;
  10. }
  11.  
  12. CMD:postaviradio(playerid, params[])
  13. {
  14. if(PlayerInfo[playerid][pBoomBox] == 0) return SCM(playerid, -1, ""CRVENA2"SERVER: Nemate Radio!");
  15. new string[128], Float:BBCoord[4], pName[MAX_PLAYERS];
  16. GetPlayerPos(playerid, BBCoord[0], BBCoord[1], BBCoord[2]);
  17. GetPlayerFacingAngle(playerid, BBCoord[3]);
  18. SetPVarFloat(playerid, "BBX", BBCoord[0]);
  19. SetPVarFloat(playerid, "BBY", BBCoord[1]);
  20. SetPVarFloat(playerid, "BBZ", BBCoord[2]);
  21. GetPlayerName(playerid, pName, sizeof(pName));
  22. BBCoord[0] += (2 * floatsin(-BBCoord[3], degrees));
  23. BBCoord[1] += (2 * floatcos(-BBCoord[3], degrees));
  24. BBCoord[2] -= 1.0;
  25. //if(Boombox[playerid] == 0) return SCM(playerid, COLOR_WHITE, "You don't have a Boombox - Ask a Admin for one"); // Part of Variable
  26. if(GetPVarInt(playerid, "PlacedBB")) return SCM(playerid, -1, "Vec ste postavili radio- /pokupiradio");
  27. foreach(Player, i)
  28. {
  29. if(GetPVarType(i, "PlacedBB"))
  30. {
  31. if(IsPlayerInRangeOfPoint(playerid, 30.0, GetPVarFloat(i, "BBX"), GetPVarFloat(i, "BBY"), GetPVarFloat(i, "BBZ")))
  32. {
  33. SendClientMessage(playerid, COLOR_WHITE, "Neko je vec postavio radio u ovoj blizini");
  34. return 1;
  35. }
  36. }
  37. }
  38. new string2[128];
  39. format(string2, sizeof(string2), "%s postavlja radio na zemlju. ", pName);
  40. SendNearbyMessage(playerid, 15, string2, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  41. SetPVarInt(playerid, "PlacedBB", CreateDynamicObject(2226, BBCoord[0], BBCoord[1], BBCoord[2], 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
  42. SetPVarInt(playerid, "BBLabel", _:CreateDynamic3DTextLabel(string, -1, BBCoord[0], BBCoord[1], BBCoord[2]+0.6, 5, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
  43. SetPVarInt(playerid, "BBArea", CreateDynamicSphere(BBCoord[0], BBCoord[1], BBCoord[2], 30.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)));
  44. SetPVarInt(playerid, "BBInt", GetPlayerInterior(playerid));
  45. SetPVarInt(playerid, "BBVW", GetPlayerVirtualWorld(playerid));
  46. ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
  47. ApplyAnimation(playerid,"BOMBER","BOM_Plant",4.0,0,0,0,0,0);
  48. return 1;
  49. }
  50.  
  51. CMD:podesiradio(playerid, params[])
  52. {
  53. if(PlayerInfo[playerid][pBoomBox] == 0) return SCM(playerid, -1, ""CRVENA2"SERVER: Nemate Radio!");
  54. if(GetPVarType(playerid, "PlacedBB"))
  55. {
  56. if(IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ")))
  57. {
  58. ShowPlayerDialog(playerid,DIALOG_BOOMBOX,DIALOG_STYLE_LIST,"Lista Stanica","Jazz\nPop\nRap\nR&B and Urban\nRock\nCountry\nEnter URL\nTurn Off Boombox","Select", "Cancel");
  59. }
  60. else
  61. {
  62. return SendClientMessage(playerid, -1, "Niste u blizini radia!");
  63. }
  64. }
  65. else
  66. {
  67. SendClientMessage(playerid, -1, " Nemate postavljen radio na zemlji!");
  68. }
  69. return 1;
  70. }
  71.  
  72. CMD:pokupiradio(playerid, params [])
  73. {
  74. if(PlayerInfo[playerid][pBoomBox] == 0) return SCM(playerid, -1, ""CRVENA2"SERVER: Nemate Radio!");
  75. if(!GetPVarInt(playerid, "PlacedBB"))
  76. {
  77. SendClientMessage(playerid, -1, "Niste postavili radio!");
  78. }
  79. if(IsPlayerInRangeOfPoint(playerid, 3.0, GetPVarFloat(playerid, "BBX"), GetPVarFloat(playerid, "BBY"), GetPVarFloat(playerid, "BBZ")))
  80. {
  81. PickUpBoombox(playerid);
  82. SendClientMessage(playerid, -1, "Pokupili ste radio sa zemlje.");
  83. }
  84. return 1;
  85. }
  86.  
  87. // MARKET KUPOVINA
  88. case 10:
  89. {
  90. if(PlayerInfo[playerid][pBoomBox] == 1) return SCM(playerid,-1, ""CRVENA" "BELA"Vec imate radio.");
  91. if(PlayerInfo[playerid][pNovacDzep] < 500) return SCM(playerid,-1, ""CRVENA" "BELA"Nemate dovoljno novca, potrebno vam je 500$ za radio.");
  92. g_NovacMinus(playerid,500);
  93. FirmaNovac(UsaoFirma[playerid],500);
  94. PlayerInfo[playerid][pBoomBox] = 1;
  95. SCM(playerid,-1,""BELA"Kupili ste radio (/rhelp)!");
  96. SavePlayer(playerid);
  97. }
  98.  
  99. INI_Int("Radio",PlayerInfo[playerid][pBoomBox]);
  100. INI_WriteInt(File,"Radio",PlayerInfo[playerid][pBoomBox]);
  101.  
  102. NA KRAJU MODA
  103.  
  104. public OnPlayerEnterDynamicArea(playerid, areaid)
  105. {
  106. foreach(Player, i)
  107. {
  108. if(GetPVarType(i, "BBArea"))
  109. {
  110. if(areaid == GetPVarInt(i, "BBArea"))
  111. {
  112. new station[256];
  113. GetPVarString(i, "BBStation", station, sizeof(station));
  114. if(!isnull(station))
  115. {
  116. PlayStream(playerid, station, GetPVarFloat(i, "BBX"), GetPVarFloat(i, "BBY"), GetPVarFloat(i, "BBZ"), 30.0, 1);
  117. //SendClientMessage(playerid, -1, "Pocinjete da cujete muziku u blizini");
  118. }
  119. return 1;
  120. }
  121. }
  122. }
  123. return 1;
  124. }
  125. //------------------------------------------------------------------------------
  126.  
  127. public OnPlayerLeaveDynamicArea(playerid, areaid)
  128. {
  129. foreach(Player, i)
  130. {
  131. if(GetPVarType(i, "BBArea"))
  132. {
  133. if(areaid == GetPVarInt(i, "BBArea"))
  134. {
  135. StopStream(playerid);
  136. //SendClientMessage(playerid, -1, "Ne cujete vise muziku");
  137. return 1;
  138. }
  139. }
  140. }
  141. return 1;
  142. }
  143.  
  144. stock StopStream(playerid)
  145. {
  146. DeletePVar(playerid, "pAudioStream");
  147. StopAudioStreamForPlayer(playerid);
  148. }
  149.  
  150. stock PlayStream(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
  151. {
  152. if(GetPVarType(playerid, "pAudioStream")) StopAudioStreamForPlayer(playerid);
  153. else SetPVarInt(playerid, "pAudioStream", 1);
  154. PlayAudioStreamForPlayer(playerid, url, posX, posY, posZ, distance, usepos);
  155. }
  156.  
  157. stock PickUpBoombox(playerid)
  158. {
  159. foreach(Player, i)
  160. {
  161. if(IsPlayerInDynamicArea(i, GetPVarInt(playerid, "BBArea")))
  162. {
  163. StopStream(i);
  164. }
  165. }
  166. DeletePVar(playerid, "BBArea");
  167. DestroyDynamicObject(GetPVarInt(playerid, "PlacedBB"));
  168. DestroyDynamic3DTextLabel(Text3D:GetPVarInt(playerid, "BBLabel"));
  169. DeletePVar(playerid, "PlacedBB"); DeletePVar(playerid, "BBLabel");
  170. DeletePVar(playerid, "BBX"); DeletePVar(playerid, "BBY"); DeletePVar(playerid, "BBZ");
  171. DeletePVar(playerid, "BBInt");
  172. DeletePVar(playerid, "BBVW");
  173. DeletePVar(playerid, "BBStation");
  174. return 1;
  175. }
  176.  
  177. stock SendNearbyMessage(playerid, Float:radius, string[], col1, col2, col3, col4, col5)
  178. {
  179. new Float:x, Float:y, Float:z;
  180. GetPlayerPos(playerid, x, y, z);
  181. new Float:ix, Float:iy, Float:iz;
  182. new Float:cx, Float:cy, Float:cz;
  183. foreach(Player, i)
  184. {
  185. if(gPlayerLoggin{i})
  186. {
  187. if(GetPlayerInterior(playerid) == GetPlayerInterior(i) && GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i))
  188. {
  189. GetPlayerPos(i, ix, iy, iz);
  190. cx = (x - ix);
  191. cy = (y - iy);
  192. cz = (z - iz);
  193. if(((cx < radius/16) && (cx > -radius/16)) && ((cy < radius/16) && (cy > -radius/16)) && ((cz < radius/16) && (cz > -radius/16)))
  194. {
  195. SendClientMessage(i, col1, string);
  196. }
  197. else if(((cx < radius/8) && (cx > -radius/8)) && ((cy < radius/8) && (cy > -radius/8)) && ((cz < radius/8) && (cz > -radius/8)))
  198. {
  199. SendClientMessage(i, col2, string);
  200. }
  201. else if(((cx < radius/4) && (cx > -radius/4)) && ((cy < radius/4) && (cy > -radius/4)) && ((cz < radius/4) && (cz > -radius/4)))
  202. {
  203. SendClientMessage(i, col3, string);
  204. }
  205. else if(((cx < radius/2) && (cx > -radius/2)) && ((cy < radius/2) && (cy > -radius/2)) && ((cz < radius/2) && (cz > -radius/2)))
  206. {
  207. SendClientMessage(i, col4, string);
  208. }
  209. else if(((cx < radius) && (cx > -radius)) && ((cy < radius) && (cy > -radius)) && ((cz < radius) && (cz > -radius)))
  210. {
  211. SendClientMessage(i, col5, string);
  212. }
  213. }
  214. }
  215. }
  216. return 1;
  217. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement