Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include a_samp
- #include sampvoice
- new SV_GSTREAM:orgstream1 = SV_NULL;
- new SV_GSTREAM:orgstream2 = SV_NULL;
- new Org[MAX_PLAYERS];
- enum
- {
- NONE,
- ORG1,
- ORG2,
- }
- public OnGameModeInit()
- {
- orgstream1 = SvCreateGStream(0xffff0000, "Org");
- orgstream2 = SvCreateGStream(0xffff0000, "Org");
- return true;
- }
- public OnGameModeExit()
- {
- if(orgstream1)
- {
- SvDeleteStream(orgstream1);
- }
- if(orgstream2)
- {
- SvDeleteStream(orgstream2);
- }
- return true;
- }
- public OnPlayerConnect(playerid)
- {
- if (SvGetVersion(playerid) == SV_NULL)
- {
- SendClientMessage(playerid, -1, "Could not find plugin sampvoice.");
- }
- else if (SvHasMicro(playerid) == SV_FALSE)
- {
- SendClientMessage(playerid, -1, "The microphone could not be found.");
- }
- else if(Org[playerid] == ORG1)
- {
- SendClientMessage(playerid, -1, "Press Z to talk to org chat");
- if(orgstream1)
- {
- SvAttachListenerToStream(orgstream1, playerid);
- }
- SvAddKey(playerid, 0x5A);
- }
- else if(Org[playerid] == ORG2)
- {
- SendClientMessage(playerid, -1, "Press Z to talk to org chat");
- if(orgstream2)
- {
- SvAttachListenerToStream(orgstream2, playerid);
- }
- }
- return true;
- }
- public OnPlayerDisconnect(playerid)
- {
- Org[playerid] = NONE;
- return true;
- }
- public SV_VOID:OnPlayerActivationKeyPress(SV_UINT:playerid, SV_UINT:keyid)
- {
- if(keyid == 0x5A && orgstream1 && Org[playerid] == ORG1)
- {
- SvAttachSpeakerToStream(orgstream1, playerid);
- }
- if(keyid == 0x5A && orgstream2 && Org[playerid] == ORG2)
- {
- SvAttachSpeakerToStream(orgstream2, playerid);
- }
- }
- public SV_VOID:OnPlayerActivationKeyRelease(SV_UINT:playerid, SV_UINT:keyid)
- {
- if (keyid == 0x5A && orgstream1 && Org[playerid] == ORG1)
- {
- SvDetachSpeakerFromStream(orgstream1, playerid);
- }
- if (keyid == 0x5A && orgstream2 && Org[playerid] == ORG2)
- {
- SvDetachSpeakerFromStream(orgstream2, playerid);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement