AR/setRadioChannel: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 19: Line 19:


==Example==
==Example==
This example adds a command ''setradio'' which can be used to change the current radio station by ID.
هذا المثال يقوم بأضافة امر "setradio " لتغير قناة الراديو الحالية عبر الايدي
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler ( "setradio",
addCommandHandler ( "setradio", -- "setradio" اضافة امر
     function ( command, stationID )
     function ( command, stationID ) -- تعريف
         local result = setRadioChannel ( tonumber( stationID ) )
         local result = setRadioChannel ( tonumber( stationID ) ) -- وضع قناة الراديو عبر الايدي
         if result then -- if we had a valid ID
         if result then -- if we had a valid ID
             outputChatBox ( "Changed your radio station to " .. getRadioChannelName ( tonumber ( stationID ) ) .. "!" )
             outputChatBox ( "Changed your radio station to " .. getRadioChannelName ( tonumber ( stationID ) ) .. "!" ) -- اضهار نص في الشات
         else
         else
             outputChatBox ( "Invalid radio station ID, valid ones are 0-12." )
             outputChatBox ( "Invalid radio station ID, valid ones are 0-12." ) -- اضهار نص في الشات
         end
         end
     end
     end  
)
)
</syntaxhighlight>
</syntaxhighlight>

Revision as of 09:51, 7 February 2016

This function sets the currently active radio channel.

This function also works while not in a vehicle.

Syntax

bool setRadioChannel ( int ID )             

Required Arguments

  • ID: .ايدي الراديو الذي تريد تشغيله
  • 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

هذا المثال يقوم بأضافة امر "setradio " لتغير قناة الراديو الحالية عبر الايدي

Click to collapse [-]
Client
addCommandHandler ( "setradio", -- "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 
)

أنظر أيضاً