Advertisement
Guest User

ORG IN SAMPVOICE

a guest
Jan 19th, 2021
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. #include a_samp
  2. #include sampvoice
  3.  
  4. new SV_GSTREAM:orgstream1 = SV_NULL;
  5. new SV_GSTREAM:orgstream2 = SV_NULL;
  6.  
  7. new Org[MAX_PLAYERS];
  8.  
  9. enum
  10. {
  11. NONE,
  12. ORG1,
  13. ORG2,
  14. }
  15.  
  16. public OnGameModeInit()
  17. {
  18. orgstream1 = SvCreateGStream(0xffff0000, "Org");
  19.  
  20. orgstream2 = SvCreateGStream(0xffff0000, "Org");
  21.  
  22. return true;
  23. }
  24.  
  25. public OnGameModeExit()
  26. {
  27. if(orgstream1)
  28. {
  29. SvDeleteStream(orgstream1);
  30. }
  31. if(orgstream2)
  32. {
  33. SvDeleteStream(orgstream2);
  34. }
  35.  
  36. return true;
  37. }
  38.  
  39. public OnPlayerConnect(playerid)
  40. {
  41. if (SvGetVersion(playerid) == SV_NULL)
  42. {
  43. SendClientMessage(playerid, -1, "Could not find plugin sampvoice.");
  44. }
  45. else if (SvHasMicro(playerid) == SV_FALSE)
  46. {
  47. SendClientMessage(playerid, -1, "The microphone could not be found.");
  48. }
  49. else if(Org[playerid] == ORG1)
  50. {
  51. SendClientMessage(playerid, -1, "Press Z to talk to org chat");
  52.  
  53. if(orgstream1)
  54. {
  55. SvAttachListenerToStream(orgstream1, playerid);
  56. }
  57.  
  58. SvAddKey(playerid, 0x5A);
  59. }
  60. else if(Org[playerid] == ORG2)
  61. {
  62. SendClientMessage(playerid, -1, "Press Z to talk to org chat");
  63.  
  64. if(orgstream2)
  65. {
  66. SvAttachListenerToStream(orgstream2, playerid);
  67. }
  68. }
  69.  
  70. return true;
  71. }
  72.  
  73. public OnPlayerDisconnect(playerid)
  74. {
  75. Org[playerid] = NONE;
  76.  
  77. return true;
  78. }
  79.  
  80. public SV_VOID:OnPlayerActivationKeyPress(SV_UINT:playerid, SV_UINT:keyid)
  81. {
  82. if(keyid == 0x5A && orgstream1 && Org[playerid] == ORG1)
  83. {
  84. SvAttachSpeakerToStream(orgstream1, playerid);
  85. }
  86. if(keyid == 0x5A && orgstream2 && Org[playerid] == ORG2)
  87. {
  88. SvAttachSpeakerToStream(orgstream2, playerid);
  89. }
  90. }
  91.  
  92. public SV_VOID:OnPlayerActivationKeyRelease(SV_UINT:playerid, SV_UINT:keyid)
  93. {
  94. if (keyid == 0x5A && orgstream1 && Org[playerid] == ORG1)
  95. {
  96. SvDetachSpeakerFromStream(orgstream1, playerid);
  97. }
  98. if (keyid == 0x5A && orgstream2 && Org[playerid] == ORG2)
  99. {
  100. SvDetachSpeakerFromStream(orgstream2, playerid);
  101. }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement