Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FiveM - Added method that returns players current channels #302

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion fivem_script/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ If the channel name contains 'Call' it will be displayed as a call on the ingame
<td>Id of the radio channel</td>
</tr>
</table>

- ### getPlayerChannels()

Returns a list of the players currently connected radio channels

- ### isPlayerInChannel(channel)

Expand All @@ -73,7 +77,6 @@ If the channel name contains 'Call' it will be displayed as a call on the ingame
- ### clientRequestUpdateChannels()

Requests to update the local radio channels
</table>

- ### setPlayerData(playerName, key, data, shared)

Expand Down
5 changes: 5 additions & 0 deletions fivem_script/tokovoip_script/src/c_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@ AddEventHandler("TokoVoip:onPlayerJoinChannel", function(channelId, playerServer
end
end)

function getPlayerChannels()
return voip.myChannels
end

function isPlayerInChannel(channel)
if (voip.myChannels[channel]) then
return true;
Expand Down Expand Up @@ -420,5 +424,6 @@ end)
-- Make exports available on first tick
exports("addPlayerToRadio", addPlayerToRadio);
exports("removePlayerFromRadio", removePlayerFromRadio);
exports("getPlayerChannels", getPlayerChannels);
exports("isPlayerInChannel", isPlayerInChannel);
exports("setRadioVolume", setRadioVolume);