HU/setRadioChannel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 10: Line 10:


===Required Arguments===  
===Required Arguments===  
*'''ID:''' The ID of the radio station you want to play.
*'''ID:''' A lejátszani kívánt rádióállomás ID-je.


{{SoundID}}
{{SoundID}}

Revision as of 19:09, 21 July 2018

Ez a funkció a rádiócsatornát állítja be, még akkor is, ha nincs a járműben.

[[{{{image}}}|link=|]] Note: Ez a funkció ismeretlen okokból néha nem működük, ha a rádiót egy másik csatornára állítjuk be, mint a jelenlegi. Ha ezt a problémát tapasztalja, egyszerűen csak adja hozzá a setRadioChannel(0)-t a szkript legelején, bármelyik funkción kívül.

Syntax

bool setRadioChannel ( int ID )             

Required Arguments

  • ID: A lejátszani kívánt rádióállomás ID-je.
  • 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

Returns

Returns true if channel was set successfully, false otherwise.

Example

This example adds a command setradio which can be used to change the current radio station by ID.

Click to collapse [-]
Client
addCommandHandler ( "setradio",
    function ( command, stationID )
        local result = setRadioChannel ( tonumber( stationID ) )
        if result then -- if we had a valid ID
            outputChatBox ( "Changed your radio station to " .. getRadioChannelName ( tonumber ( stationID ) ) .. "!" )
        else
            outputChatBox ( "Invalid radio station ID, valid ones are 0-12." )
        end
    end
)

Issues

Issue ID Description
#8908 setRadioChannel sometimes doesn't work when outside a vehicle

See Also