Advertisement
Guest User

Untitled

a guest
Jan 30th, 2021
521
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.22 KB | None | 0 0
  1. //Sistema de JBL desenvolvido por Guilherme Porto
  2.  
  3. #include <a_samp>
  4. #include <streamer>
  5.  
  6. #define MAX_JBL 30 //Máixmo de JBL's que podem está conectadas simultaneamente
  7. #define D_JBL 777 //ID da Dialog JBL
  8.  
  9. enum JBL_Info
  10. {
  11. Text3D:TextJBL[MAX_JBL],
  12. JblUsed[MAX_JBL],
  13. Float:xJBL[MAX_JBL],
  14. Float:yJBL[MAX_JBL],
  15. Float:zJBL[MAX_JBL],
  16. StringMusica[100]
  17. };
  18. new InfoJBL[JBL_Info], JBL[MAX_PLAYERS], OuvindoMusica[MAX_PLAYERS];
  19.  
  20. public OnGameModeInit()
  21. {
  22. SetTimer("ChamadaJBL", 1000, true);
  23. for(new j; j < MAX_JBL; j++)
  24. {
  25. InfoJBL[JblUsed][j] = -1;
  26. InfoJBL[xJBL][j] = -1; InfoJBL[yJBL][j] = -1; InfoJBL[zJBL][j] = -1;
  27. InfoJBL[TextJBL][j] = CreateDynamic3DTextLabel("{FFFFFF}JBL", -1, -999.0, -98383.3, -9292.0, 10.0);
  28. }
  29. return 1;
  30. }
  31.  
  32. public OnPlayerConnect(playerid)
  33. {
  34. JBL[playerid] = -1;
  35. return 1;
  36. }
  37.  
  38. public OnPlayerDisconnect(playerid, reason)
  39. {
  40. if(JBL[playerid] > -1)
  41. {
  42. for(new j; j < MAX_JBL; j++)
  43. {
  44. if(InfoJBL[JblUsed][j] == JBL[playerid])
  45. {
  46. InfoJBL[JblUsed][j] = -1;
  47. DestroyDynamic3DTextLabel(InfoJBL[TextJBL][j]);
  48. InfoJBL[TextJBL][j] = CreateDynamic3DTextLabel("{FFFFFF}JBL", -1, -999.0, -98383.3, -9292.0, 10.0);//Text3D
  49. }
  50. }
  51. DestroyDynamicObject(JBL[playerid]);
  52. JBL[playerid] = -1;
  53. }
  54. return 1;
  55. }
  56.  
  57. public OnPlayerCommandText(playerid, cmdtext[])
  58. {
  59. new cmd[128], idx; cmd = strtok(cmdtext, idx);
  60. if(strcmp(cmd, "/LigarJBL", true) == 0)
  61. {
  62. if(IsPlayerAdmin(playerid))
  63. {
  64. if(GetPlayerInterior(playerid) != 0)
  65. {
  66. return SendClientMessage(playerid, 0xFF4500FF, "| ERRO | Não é permitido usar esse comando em interiores");
  67. }
  68. if(IsPlayerInAnyVehicle(playerid))
  69. {
  70. return SendClientMessage(playerid, 0xFF4500FF, "| ERRO | Você não pode usar esse comando em veículos");
  71. }
  72. if(JBL[playerid] > -1)
  73. {
  74. return SendClientMessage(playerid, 0xFF4500FF, "| ERRO | Sua JBL já está ligada em algum lugar");
  75. }
  76. new stringj[1200];
  77. strcat(stringj,"{FFFFFF}Douglas e Vinícius - Figurinha - part. MC Bruninho\n");
  78. strcat(stringj,"Henrique e Juliano - ALÔ BEBÊ\n");
  79. strcat(stringj,"Henrique e Juliano - NÃO GOSTO EU AMO\n");
  80. strcat(stringj,"Zé Neto e Cristiano - CONDOMÍNIO FECHADO\n");
  81. strcat(stringj,"Marília Mendonça & Maiara e Maraisa - Você nem é tudo isso\n");
  82. strcat(stringj,"Diego & Victor Hugo, Raí Saia Rodada - Pisadinha\n");
  83. strcat(stringj,"Os Barões da Pisadinha - Tá Rocheda\n");
  84. strcat(stringj,"Os Barões da Pisadinha ft. Luan Estilizado - Galera do Interior\n");
  85. strcat(stringj,"Os Barões da Pisadinha - Só Basta você me Ligar Ft. Xand Avião\n");
  86. strcat(stringj,"Do Fundo da Grota - Baitaca\n");
  87. strcat(stringj,"Kawe - Gigante\n");
  88. strcat(stringj,"MC Hariel - Espancando Recalque (GR6 Explode) DJ Pedro\n");
  89. strcat(stringj,"Hungria Hip Hop - Um Pedido\n");
  90. strcat(stringj,"Childish\n");
  91. strcat(stringj,"Internet Money - Lemonade\n");
  92. strcat(stringj,"Pop Smoke - Enjoy Yourself ft. KAROL G\n");
  93. strcat(stringj,"TA COM SAUDADE QUER TBT - MC Talibã e MC Rennan\n");
  94. strcat(stringj,"MC Luan da Bs e MC Vitin LC - Bipolar\n");
  95. strcat(stringj,"Grupo Revelação Oficial - Deixa Acontecer\n");
  96. strcat(stringj,"Zé Neto e Cristiano - WHISKY E GELO\n");
  97. strcat(stringj,"Aviões - Inquilina\n");
  98. strcat(stringj,"Roses (Imanbek Remix)\n");
  99. strcat(stringj,"Stereo Love - Original\n");
  100. strcat(stringj,"Rap Das Armas\n");
  101. strcat(stringj,"I'm an Albatraoz\n");
  102. strcat(stringj,"Fogo na Babilonia\n");
  103. strcat(stringj,"Cerveja de Garrafa - Atitude 67\n");
  104. strcat(stringj,"Deixa Acontecer - Grupo Revelação\n");
  105. strcat(stringj,"Cheia de Manias - Raça Negra");
  106. return ShowPlayerDialog(playerid, D_JBL, DIALOG_STYLE_LIST, "{FFFFFF}JBL - Playlist", stringj, "Tocar", "Fechar");
  107. }
  108. else
  109. {
  110. return SendClientMessage(playerid, 0xFF4500FF, "| ERRO | Você não tem permissão");
  111. }
  112. }
  113. if(strcmp(cmd, "/PararJBL", true) == 0)
  114. {
  115. if(IsPlayerAdmin(playerid))
  116. {
  117. SendClientMessage(playerid, 0xFFFF00FF, "| INFO | Você parou de ouvir musica da JBL");
  118. OuvindoMusica[playerid] = 0;
  119. StopAudioStreamForPlayer(playerid);
  120. return 1;
  121. }
  122. else
  123. {
  124. return SendClientMessage(playerid, 0xFF4500FF, "| ERRO | Você não tem permissão");
  125. }
  126. }
  127. if(strcmp(cmd, "/DesligarJBL", true) == 0)
  128. {
  129. if(IsPlayerAdmin(playerid))
  130. {
  131. if(JBL[playerid] == -1)
  132. {
  133. return SendClientMessage(playerid, 0xFF4500FF, "| ERRO | Você não ligou sua JBL");
  134. }
  135. for(new j; j < MAX_JBL; j++)
  136. {
  137. if(InfoJBL[JblUsed][j] == JBL[playerid])
  138. {
  139. new Float:X, Float:Y, Float:Z; GetDynamicObjectPos(InfoJBL[JblUsed][j], X, Y, Z);
  140. if(IsPlayerInRangeOfPoint(playerid, 3.0, X, Y, Z))
  141. {
  142. SendClientMessage(playerid, 0xFFFF00FF, "| INFO | Você desligou sua JBL");
  143. DestroyDynamicObject(InfoJBL[JblUsed][j]);
  144. JBL[playerid] = -1;
  145. InfoJBL[JblUsed][j] = -1;
  146. DestroyDynamic3DTextLabel(InfoJBL[TextJBL][j]);
  147. InfoJBL[TextJBL][j] = CreateDynamic3DTextLabel("{FFFFFF}JBL", -1, -999.0, -98383.3, -9292.0, 10.0);//Text3D
  148. for(new i; i < MAX_PLAYERS; i++)
  149. {
  150. if(IsPlayerInRangeOfPoint(i, 20.0, X, Y, Z))
  151. {
  152. StopAudioStreamForPlayer(i);
  153. OuvindoMusica[i] = 0;
  154. }
  155. }
  156. return 1;
  157. }
  158. else
  159. {
  160. return SendClientMessage(playerid, 0xFF4500FF, "| ERRO | Você não está próximo da sua JBL");
  161. }
  162. }
  163. }
  164. return SendClientMessage(playerid, 0xFF4500FF, "| ERRO | Sua JBL não foi encontrada");
  165. }
  166. else
  167. {
  168. return SendClientMessage(playerid, 0xFF4500FF, "| ERRO | Você não tem permissão");
  169. }
  170. }
  171. return 0;
  172. }
  173.  
  174. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  175. {
  176. if(dialogid == D_JBL)
  177. {
  178. if(response)
  179. {
  180. for(new j; j < MAX_JBL; j++)
  181. {
  182. if(InfoJBL[JblUsed][j] > -1)
  183. {
  184. new Float:XB, Float:YB, Float:ZB; GetDynamicObjectPos(InfoJBL[JblUsed][j], XB, YB, ZB);
  185. if(IsPlayerInRangeOfPoint(playerid, 20.0, XB, YB, ZB))
  186. {
  187. return SendClientMessage(playerid, 0xFF4500FF, "| ERRO | Já tem uma JBL tocando nesse local");
  188. }
  189. }
  190. }
  191. for(new j; j < MAX_JBL; j++)
  192. {
  193. if(InfoJBL[JblUsed][j] == -1)
  194. {
  195. new String1[128], Nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, Nome, sizeof(Nome));
  196. format(String1, sizeof(String1), "| JBL | O(A) Jogador(a) %s[%d] ligou sua JBL", Nome, playerid);
  197. SendClientMessageToAll(0xFFFF00FF, String1);
  198. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  199. GetPlayerPos(playerid, InfoJBL[xJBL][j], InfoJBL[yJBL][j], InfoJBL[zJBL][j]);
  200. GetXYInFrontOfPlayer(playerid, InfoJBL[xJBL][j], InfoJBL[yJBL][j], 0.7);
  201. JBL[playerid] = CreateDynamicObject(2226, InfoJBL[xJBL][j], InfoJBL[yJBL][j], InfoJBL[zJBL][j] - 0.9, 0.0, 0, 0);
  202. InfoJBL[JblUsed][j] = JBL[playerid];
  203. DestroyDynamic3DTextLabel(InfoJBL[TextJBL][j]);
  204. new strp[80]; format(strp, sizeof(strp), "{FF00FF}JBL {FFFFFF}Ligada\nJogador(a): %s[%d]", Nome, playerid);
  205. InfoJBL[TextJBL][j] = CreateDynamic3DTextLabel(strp, -1, InfoJBL[xJBL][j], InfoJBL[yJBL][j], InfoJBL[zJBL][j]-0.5, 10.0);
  206. Streamer_Update(playerid);
  207. switch(listitem)
  208. {
  209. case 0:
  210. {
  211. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/rld8terrprn93s7/Figurinha.mp3");
  212. }
  213. case 1:
  214. {
  215. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/91gkmceb2ku6het/AloBebe.mp3");
  216. }
  217. case 2:
  218. {
  219. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/787ksks2ul7tlh7/NaoGostoEuAmo.mp3");
  220. }
  221. case 3:
  222. {
  223. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/ubpciz2k2vemwv2/CondominioFechado.mp3");
  224. }
  225. case 4:
  226. {
  227. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/nb9hquikxue2863/VoceNemEtudoIsso.mp3");
  228. }
  229. case 5:
  230. {
  231. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/xu2qiy39hkmnlhx/Pisadinha.mp3");
  232. }
  233. case 6:
  234. {
  235. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/5fi1batjo85mo5v/TaRocheda.mp3");
  236. }
  237. case 7:
  238. {
  239. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/apiacgvhcu1dlsq/GaleraDoInterior.mp3");
  240. }
  241. case 8:
  242. {
  243. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/xmzfao1b53v6nd2/SoBastaVoceMeLigar.mp3");
  244. }
  245. case 9:
  246. {
  247. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/ci73wbvt4auuco2/Baitaca.mp3");
  248. }
  249. case 10:
  250. {
  251. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/z03wo3a9e80q06r/Gigante.mp3");
  252. }
  253. case 11:
  254. {
  255. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/xgwrfimts7yqyen/EspancandoRecalque.mp3");
  256. }
  257. case 12:
  258. {
  259. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/0rqa3f9w7qkjp50/UmPedido.mp3");
  260. }
  261. case 13:
  262. {
  263. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/wvuu1orf810khlk/Childish.mp3");
  264. }
  265. case 14:
  266. {
  267. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/5xlcn4ra7cd400s/Lemonade.mp3");
  268. }
  269. case 15:
  270. {
  271. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/k68sqj0stkg8too/EnjoyYourself.mp3");
  272. }
  273. case 16:
  274. {
  275. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/2etlj6ozb7oqnec/TaComSaudadeQuerTBT.mp3");
  276. }
  277. case 17:
  278. {
  279. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/96pw316ogwzxff0/Bipolar.mp3");
  280. }
  281. case 18:
  282. {
  283. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/uyutzsqzl323crv/DeixaAcontecer.mp3");
  284. }
  285. case 19:
  286. {
  287. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/b9lhnkcz60fcoea/WhiskyeGelo.mp3");
  288. }
  289. case 20:
  290. {
  291. format(InfoJBL[StringMusica][j], 100, "https://dl.dropboxusercontent.com/s/1go2fdn2xneav6g/Inquilina.mp3");
  292. }
  293. case 21:
  294. {
  295. format(InfoJBL[StringMusica][j], 100, "https://drive.google.com/u/1/uc?id=1s_DrW_8Hlqg0ALLsijYfq8_0kvhyK7oE&export=download");
  296. }
  297. case 22:
  298. {
  299. format(InfoJBL[StringMusica][j], 100, "https://drive.google.com/u/1/uc?id=1-9z8mEMYuevvVo-MMfP5hBx8yB4me3_y&export=download");
  300. }
  301. case 23:
  302. {
  303. format(InfoJBL[StringMusica][j], 100, "https://drive.google.com/u/2/uc?id=1a0P8xFLrk3lUUyyRk7_eYMfIQX4qYGSc&export=download");
  304. }
  305. case 24:
  306. {
  307. format(InfoJBL[StringMusica][j], 100, "https://drive.google.com/u/0/uc?id=1-_b0p6A3AyhdAKerLRn5stYUKoabH5CW&export=download");
  308. }
  309. case 25:
  310. {
  311. format(InfoJBL[StringMusica][j], 100, "https://drive.google.com/u/2/uc?id=1tfOXMi2B-ZOWBDihtNV2Ob2FzRqfKmrT&export=download");
  312. }
  313. case 26:
  314. {
  315. format(InfoJBL[StringMusica][j], 100, "https://drive.google.com/u/0/uc?id=1n5jo1VJmuVdFSXCf_oMRVEJ3Md0P59au&export=download");
  316. }
  317. case 27:
  318. {
  319. format(InfoJBL[StringMusica][j], 100, "https://drive.google.com/u/1/uc?id=1EomyjO7inB-FGN-Qcywyc1OBVH4gCyEE&export=download");
  320. }
  321. case 28:
  322. {
  323. format(InfoJBL[StringMusica][j], 100, "https://drive.google.com/u/2/uc?id=1URS2aeyC-egYhGFQSQ3E4tUNc-ShcKMq&export=download");
  324. }
  325. }
  326. return 1;
  327. }
  328. }
  329. return SendClientMessage(playerid, 0xFF4500FF, "| ERRO | Não é possivel colocar uma JBL pois já tem muitas JBL's ligadas no servidor");
  330. }
  331. }
  332. return 1;
  333. }
  334.  
  335. forward ChamadaJBL();
  336. public ChamadaJBL()
  337. {
  338. for (new i = 0, g = GetPlayerPoolSize(); i <= g; i++)
  339. {
  340. if(IsPlayerConnected(i))
  341. {
  342. for(new j; j < MAX_JBL; j++)
  343. {
  344. if(InfoJBL[JblUsed][j] > -1)
  345. {
  346. new Float:XB, Float:YB, Float:ZB; GetDynamicObjectPos(InfoJBL[JblUsed][j], XB, YB, ZB);
  347. if(IsPlayerInRangeOfPoint(i, 20.0, XB, YB, ZB) && OuvindoMusica[i] == 0)
  348. {
  349. PlayAudioStreamForPlayer(i, InfoJBL[StringMusica][j], XB, YB, ZB, 20.0, 1); OuvindoMusica[i] = 120;
  350. break;
  351. }
  352. }
  353. }
  354. if(OuvindoMusica[i] > 0)
  355. {
  356. OuvindoMusica[i] --;
  357. }
  358. }
  359. }
  360. return 1;
  361. }
  362.  
  363. stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
  364. {
  365. new Float:a;
  366. GetPlayerPos(playerid, x, y, a);
  367. GetPlayerFacingAngle(playerid, a);
  368. if (GetPlayerVehicleID(playerid)) {
  369. GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
  370. }
  371. x += (distance * floatsin(-a, degrees));
  372. y += (distance * floatcos(-a, degrees));
  373. }
  374.  
  375. strtok(const string[], &index)
  376. {
  377. new length = strlen(string);
  378. while ((index < length) && (string[index] <= ' '))
  379. {
  380. index++;
  381. }
  382.  
  383. new offset = index;
  384. new result[20];
  385. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  386. {
  387. result[index - offset] = string[index];
  388. index++;
  389. }
  390. result[index - offset] = EOS;
  391. return result;
  392. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement