Advertisement
Guest User

Untitled

a guest
Jan 17th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. #define FILTERSCRIPT
  2.  
  3. #include <a_samp>
  4. #include <sampvoip>
  5.  
  6. //Microfone
  7. new SV_DLSTREAM:pstream[MAX_PLAYERS] = SV_NULL;
  8. new StreamCreate[MAX_PLAYERS];
  9.  
  10.  
  11. public SV_BOOL:OnPlayerVoice(SV_UINT:playerid, SV_PACKET:packet, SV_UINT:volume)
  12. {
  13. if(StreamCreate[playerid])
  14. sv_send_packet(packet, pstream[playerid]);
  15.  
  16.  
  17. SetPlayerChatBubble(playerid, "((x)) Falando ((x))", 0x9acd32FF, 20.0, 100000);
  18. return SV_TRUE; // Delete the packet? (SV_TRUE - yes, SV_FALSE - no)
  19. }
  20.  
  21. public OnFilterScriptInit()
  22. {
  23. print("\n----------------------------------------------------------------------------");
  24. print(" Filterscript SAMPVOIP carregado com sucesso!");
  25. print(" |");
  26. print(" |__> Por Dudu_Insane V0.1");
  27. print("----------------------------------------------------------------------------\n");
  28. return 1;
  29. }
  30.  
  31. public OnFilterScriptExit()
  32. {
  33. return 1;
  34. }
  35.  
  36. forward CarregarMicrofone(playerid);
  37. public CarregarMicrofone(playerid)
  38. {
  39.  
  40. if(sv_get_version(playerid) == SV_NULL)
  41. ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{FFFF00}SAMPVOIP", "{F60000}INFO: {C9C9C9} Voce nao tem o SAMPVOIP instalado em seu dispositivo, baixe-o em discord.gg/playvicio - ABA VOIP!", "Fechar", "");
  42. else if(sv_get_version(playerid) < SV_VERSION)
  43. ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{FFFF00}SAMPVOIP", "{F60000}INFO: {C9C9C9} Voce esta usando uma versao desatualizada do plugin, atualize-o em discord.gg/playvicio - ABA VOIP", "Fechar", "");
  44. else
  45. {
  46. // Checando microfone
  47. if(!sv_has_micro(playerid))
  48. ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "{FFFF00}SAMPVOIP", "{F60000}INFO: {C9C9C9} Nao conseguimos detectar seu microfone.", "Fechar", "");
  49.  
  50. // Instalacao do microfone do player
  51. pstream[playerid] = sv_dlstream_create_at_player(playerid);
  52. sv_set_key(playerid, 0x42);
  53. StreamCreate[playerid] = true;
  54. SendClientMessage(playerid, -1, "[PlayVicio]: {FFFFFF}Voce conectou-se com sucesso ao {FFFF00}SAMPVOIP{FFFFFF} do PlayVicio, segure '{F60000}B{FFFFFF}' para falar!");
  55. }
  56. }
  57.  
  58. public OnPlayerConnect(playerid)
  59. {
  60. StreamCreate[playerid] = false;
  61. return 1;
  62. }
  63.  
  64. public OnPlayerDisconnect(playerid, reason)
  65. {
  66. if(StreamCreate[playerid])
  67. {
  68. sv_stream_delete(pstream[playerid]);
  69. }
  70. return 1;
  71. }
  72.  
  73. public OnPlayerSpawn(playerid)
  74. {
  75. if(!StreamCreate[playerid])
  76. CarregarMicrofone(playerid);
  77. return 1;
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement