GetRadioChannel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
m (Improved example)
 
(18 intermediate revisions by 9 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Client function}}
This function retrieves the ID of the currently active radio channel.
The function is used to retrieve the ID of the current radio channel.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
int getRadioChannel ( )            
int getRadioChannel ( )
</syntaxhighlight>  
</syntaxhighlight>  


Line 15: Line 15:
This example prints out the name of your current radio station to the chat box.
This example prints out the name of your current radio station to the chat box.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler ( "getradio",
addCommandHandler("getradio", function ()
    function ()
local radio = getRadioChannelName(getRadioChannel())
        outputChatBox ( "You're currently listening to " .. getRadioChannelName ( getRadioChannel() ) .. "!" )
outputChatBox("You're currently listening to "..radio.."!")
    end
end)
)
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{Client_audio_functions}}


{{Client_audio_functions}}
[[ar:getRadioChannel]]
[[HU:GetRadioChannel]]
[[de:getRadioChannel]]
[[AR:getRadioChannel]]
[[hu:getRadioChannel]]
[[RU:GetRadioChannel]]
[[pl:getRadioChannel]]
[[PL:GetRadioChannel]]
[[ro:getRadioChannel]]
[[RO:GetRadioChannel]]
[[ru:GetRadioChannel]]
[[PT-BR:GetRadioChannel]]

Latest revision as of 06:45, 30 October 2023

The function is used to retrieve the ID of the current radio channel.

Syntax

int getRadioChannel ( )

Returns

Returns the ID of the radio channel.

  • 0: Radio Off
  • 1: Playback FM
  • 2: K-Rose
  • 3: K-DST
  • 4: Bounce FM
  • 5: SF-UR
  • 6: Radio Los Santos
  • 7: Radio X
  • 8: CSR 103.9
  • 9: K-Jah West
  • 10: Master Sounds 98.3
  • 11: WCTR
  • 12: User Track Player

Example

This example prints out the name of your current radio station to the chat box.

addCommandHandler("getradio", function ()
	local radio = getRadioChannelName(getRadioChannel())
	outputChatBox("You're currently listening to "..radio.."!")
end)

See Also