OnClientPlayerRadioSwitch: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Client event}} This event is triggered whenever a players radio station is changed ==Parameters== <syntaxhighlight lang="lua"> int stationID </syntaxhighlight> *'''stationID''': A int representin...)
 
No edit summary
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client event}}
{{Client event}}
This event is triggered whenever a players radio station is changed
This event is triggered whenever the local player's radio station is changed


==Parameters==
==Parameters==
Line 8: Line 8:
</syntaxhighlight>  
</syntaxhighlight>  


*'''stationID''': A [[int]] representing the station the player switched to.
*'''stationID''': An [[int]]eger representing the station the player switched to.
Station ID's:
Station ID's:
** '''1:''' Playback
{{SoundID}}
** '''2:''' K ROSE
 
** '''3:''' K-DST
==Source==
** '''4:''' Bounce
The [[event system#Event source|source]] of this event is the local [[player]].
** '''5:''' SF-UR
 
** '''6:''' Radio Los Santos
==Cancel effect==
** '''7:''' Radio X
If this event is [[Event system#Canceling|canceled]], the Radio station will not change.
** '''8:''' CSR 103.9
** '''9:''' K-Jah West
** '''10:''' Master Sounds 98.3
** '''11:''' WCTR
** '''12:''' User Track Player
==Example==  
==Example==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--Todo
label = guiCreateLabel ( 0.8, 0.9, 0.2, 0.1, "Radio off", true) --create a label to show the station
 
function stationDraw(station)
guiSetText ( label, getRadioChannelName(station)) --Show the station Name
end
 
addEventHandler("onClientPlayerRadioSwitch", getLocalPlayer(), stationDraw) -- add an event handler
</syntaxhighlight>
</syntaxhighlight>



Latest revision as of 03:21, 20 January 2015

This event is triggered whenever the local player's radio station is changed

Parameters

int stationID
  • stationID: An integer representing the station the player switched to.

Station ID's:

  • 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

Source

The source of this event is the local player.

Cancel effect

If this event is canceled, the Radio station will not change.

Example

label = guiCreateLabel ( 0.8, 0.9, 0.2, 0.1, "Radio off", true) --create a label to show the station

function stationDraw(station)
	guiSetText ( label, getRadioChannelName(station)) --Show the station Name
end

addEventHandler("onClientPlayerRadioSwitch", getLocalPlayer(), stationDraw) -- add an event handler

See Also

Client player events


Client Audio functions