Full Radio Control
ОПИСАНИЕ
Этот мод призван упростить использование радио в автомобилях, позволяя легко изменять громкость или быстро выключать его. Создан на основе модов «Easy Radio Turn Off» и «Radio Volume Control», он использует упрощенную версию этих кодов с полностью настраиваемым интерфейсом и разграничением команд между клавиатурой и управлением на основе системы GTA IV.
Рядом с радио отображается небольшой спрайт, который меняется при изменении уровня громкости. Вы можете отключить спрайт/текст и полностью контролировать их цвет, прозрачность, границу, размер и положение через .ini
файл. При изменении звука радио будет воспроизводиться тот же звук, который воспроизводится в интерфейсе при изменении громкости, вы можете отключить это в .ini
файле.
Нажатие кнопки «X» выключит радио, повторное нажатие вернет к предыдущему радио. При нажатии на «,» и «.» изменяется громкость радио. Вы можете изменить клавиши клавиатуры через .ini
файл.
КОД СКРИПТА
SCRIPT_START
{
LVAR_INT scplayer iIncreaseKey iDecreaseKey iRadioChannel iTurnOffkey iCurrentRadioChannel iVolume iBorder r g b r2 g2 b2 iAlpha iAlpha2 iPlaySounds iShowSprite
LVAR_FLOAT x y x2 y2 siz fVolume fSizeMultiplier
GET_PLAYER_CHAR 0 scplayer
LOAD_TEXTURE_DICTIONARY fr_ctrl
LOAD_SPRITE 1 sound_icon1
LOAD_SPRITE 2 sound_icon2
LOAD_SPRITE 3 sound_icon3
ADD_TEXT_LABEL TMPVOLS "~1~"
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Controls" "IncreaseKey" iIncreaseKey
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Controls" "DecreaseKey " iDecreaseKey
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Controls" "TurnOffKey " iTurnOffkey
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "DisplayTextSprite" iShowSprite
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "PlaySounds" iPlaySounds
READ_FLOAT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "PositionX" x
READ_FLOAT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "PositionY" y
READ_FLOAT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "SizeMultiplier" fSizeMultiplier
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "SpriteBorder" iBorder
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "SpriteA" iAlpha
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "SpriteR" r
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "SpriteG" g
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "SpriteB" b
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "BorderA" iAlpha2
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "BorderR" r2
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "BorderG" g2
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "BorderB" b2
WHILE TRUE
WAIT 0
timerb = 0
WHILE IS_CHAR_SITTING_IN_ANY_CAR scplayer
WAIT 0
// Volume Control
// Controller
IF IS_PC_USING_JOYPAD
IF IS_BUTTON_JUST_PRESSED PAD1 DPADRIGHT // Increase volume
GOSUB IncreaseVolume
ENDIF
IF IS_BUTTON_JUST_PRESSED PAD1 DPADLEFT // Decrease volume
GOSUB DecreaseVolume
ENDIF
ENDIF
// Keyboard
IF IS_KEY_JUST_PRESSED iIncreaseKey // Increase volume
GOSUB IncreaseVolume
ENDIF
IF IS_KEY_JUST_PRESSED iDecreaseKey // Decrease volume
GOSUB DecreaseVolume
ENDIF
// Fancy Stuff
IF iPlaySounds = TRUE
IF IS_BUTTON_JUST_PRESSED PAD1 DPADRIGHT
OR IS_BUTTON_JUST_PRESSED PAD1 DPADLEFT
OR IS_KEY_JUST_PRESSED iIncreaseKey
OR IS_KEY_JUST_PRESSED iDecreaseKey
timerb = 0
GET_AUDIO_SFX_VOLUME fVolume
fVolume *= 0.85
CALL_METHOD 0x506EA0 0xB6BC90 3 0 (1.0 fVolume 5)()
ENDIF
ENDIF
IF iShowSprite = TRUE
IF timerb < 2500
GET_AUDIO_RADIO_VOLUME fVolume
fVolume *= 100.0
iVolume =# fVolume
CLEO_CALL DrawVolumeSprites 0 (x y fSizeMultiplier iBorder iVolume r g b r2 g2 b2 iAlpha iAlpha2)
ENDIF
ENDIF
// Quick radio turn off
// Controller
IF IS_PC_USING_JOYPAD
IF IS_BUTTON_PRESSED PAD1 DPADUP
OR IS_BUTTON_PRESSED PAD1 DPADDOWN
IF timera >= 1000
GET_RADIO_CHANNEL iCurrentRadioChannel
IF NOT iCurrentRadioChannel = 12 // Turn radio off
GET_RADIO_CHANNEL iRadioChannel
SET_RADIO_CHANNEL 12
ELSE
SET_RADIO_CHANNEL iRadioChannel // Set radio
ENDIF
WHILE IS_BUTTON_PRESSED PAD1 DPADUP
OR IS_BUTTON_PRESSED PAD1 DPADDOWN
WAIT 0
ENDWHILE
ENDIF
ELSE
timera = 0
ENDIF
ENDIF
// Keyboard
IF IS_KEY_JUST_PRESSED iTurnOffkey
GET_RADIO_CHANNEL iCurrentRadioChannel
IF NOT iCurrentRadioChannel = 12 // Radio Off
GET_RADIO_CHANNEL iRadioChannel
SET_RADIO_CHANNEL 12
ELSE
SET_RADIO_CHANNEL iRadioChannel
ENDIF
ENDIF
ENDWHILE
ENDWHILE
IncreaseVolume:
GET_AUDIO_RADIO_VOLUME fVolume
IF fVolume < 1.0
fVolume += 0.0625
IF fVolume > 1.0
fVolume = 1.0
ENDIF
WRITE_MEMORY 11926728 4 fVolume FALSE
fVolume *= 100.0
iVolume =# fVolume
ENDIF
RETURN
DecreaseVolume:
GET_AUDIO_RADIO_VOLUME fVolume
IF fVolume > 0.0
fVolume -= 0.0625
IF fVolume < 0.0
fVolume = 0.0
ENDIF
WRITE_MEMORY 11926728 4 fVolume FALSE
fVolume *= 100.0
iVolume =# fVolume
ENDIF
RETURN
}
SCRIPT_END
{
LVAR_FLOAT x y fSizeMultiplier //In
LVAR_INT iBorder iVolume r g b r2 g2 b2 iAlpha iAlpha2 //In
LVAR_INT iSprite
LVAR_FLOAT fSize x2 y2 fSizeX fSizeY fAngle fMargin fBorder
DrawVolumeSprites:
fSize = 16.0 * fSizeMultiplier
x -= fSize
IF iVolume > 20
iSprite = 2
IF iVolume > 50
iSprite = 3
ENDIF
ELSE
iSprite = 1
ENDIF
// Draw sprite
GET_FIXED_XY_ASPECT_RATIO fSize fSize fSizeX fSizeY
fBorder =# iBorder
fBorder *= 0.75
IF fBorder > 0.0
WHILE fAngle < 360.0
fAngle += 18.0
GET_COORD_FROM_ANGLED_DISTANCE x y fAngle fBorder x2 y2
DRAW_SPRITE iSprite x2 y2 fSizeX fSizeY r2 g2 b2 iAlpha2
ENDWHILE
ENDIF
DRAW_SPRITE iSprite x y fSizeX fSizeY r g b iAlpha
fAngle = 0.0
// Draw text
GET_FIXED_XY_ASPECT_RATIO 0.4 1.55 fSizeX fSizeY
fSizeX *= fSizeMultiplier
fSizeY *= fSizeMultiplier
SET_TEXT_FONT FONT_MENU
SET_TEXT_PROPORTIONAL TRUE
SET_TEXT_SCALE fSizeX fSizeY
IF iBorder > 0
SET_TEXT_EDGE iBorder r2 g2 b2 iAlpha2
ELSE
SET_TEXT_EDGE 0 0 0 0 0
ENDIF
SET_TEXT_COLOUR r g b iAlpha
SET_TEXT_CENTRE_SIZE 640.0
fSize *= 0.75
x2 = x + fSize
fSize *= 1.25
/*
fSize /= 3.15
fSizeY *= fSize
y -= fSizeY
*/
fSizeY *= 5.35
y -= fSizeY
DISPLAY_TEXT_WITH_NUMBER x2 y TMPVOLS iVolume
USE_TEXT_COMMANDS 0
CLEO_RETURN 0
}
КОД СКРИПТА
SCRIPT_START
{
LVAR_INT scplayer iIncreaseKey iDecreaseKey iRadioChannel iTurnOffkey iCurrentRadioChannel iVolume iBorder r g b r2 g2 b2 iAlpha iAlpha2 iPlaySounds iShowSprite
LVAR_FLOAT x y x2 y2 siz fVolume fSizeMultiplier
GET_PLAYER_CHAR 0 scplayer
LOAD_TEXTURE_DICTIONARY fr_ctrl
LOAD_SPRITE 1 sound_icon1
LOAD_SPRITE 2 sound_icon2
LOAD_SPRITE 3 sound_icon3
ADD_TEXT_LABEL TMPVOLS "~1~"
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Controls" "IncreaseKey" iIncreaseKey
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Controls" "DecreaseKey " iDecreaseKey
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Controls" "TurnOffKey " iTurnOffkey
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "DisplayTextSprite" iShowSprite
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "PlaySounds" iPlaySounds
READ_FLOAT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "PositionX" x
READ_FLOAT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "PositionY" y
READ_FLOAT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "SizeMultiplier" fSizeMultiplier
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "SpriteBorder" iBorder
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "SpriteA" iAlpha
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "SpriteR" r
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "SpriteG" g
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "SpriteB" b
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "BorderA" iAlpha2
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "BorderR" r2
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "BorderG" g2
READ_INT_FROM_INI_FILE "CLEOFull Radio Control.ini" "Interface" "BorderB" b2
WHILE TRUE
WAIT 0
timerb = 0
WHILE IS_CHAR_SITTING_IN_ANY_CAR scplayer
WAIT 0
// Volume Control
// Controller
IF IS_PC_USING_JOYPAD
IF IS_BUTTON_JUST_PRESSED PAD1 DPADRIGHT // Increase volume
GOSUB IncreaseVolume
ENDIF
IF IS_BUTTON_JUST_PRESSED PAD1 DPADLEFT // Decrease volume
GOSUB DecreaseVolume
ENDIF
ENDIF
// Keyboard
IF IS_KEY_JUST_PRESSED iIncreaseKey // Increase volume
GOSUB IncreaseVolume
ENDIF
IF IS_KEY_JUST_PRESSED iDecreaseKey // Decrease volume
GOSUB DecreaseVolume
ENDIF
// Fancy Stuff
IF iPlaySounds = TRUE
IF IS_BUTTON_JUST_PRESSED PAD1 DPADRIGHT
OR IS_BUTTON_JUST_PRESSED PAD1 DPADLEFT
OR IS_KEY_JUST_PRESSED iIncreaseKey
OR IS_KEY_JUST_PRESSED iDecreaseKey
timerb = 0
GET_AUDIO_SFX_VOLUME fVolume
fVolume *= 0.85
CALL_METHOD 0x506EA0 0xB6BC90 3 0 (1.0 fVolume 5)()
ENDIF
ENDIF
IF iShowSprite = TRUE
IF timerb < 2500
GET_AUDIO_RADIO_VOLUME fVolume
fVolume *= 100.0
iVolume =# fVolume
CLEO_CALL DrawVolumeSprites 0 (x y fSizeMultiplier iBorder iVolume r g b r2 g2 b2 iAlpha iAlpha2)
ENDIF
ENDIF
// Quick radio turn off
// Controller
IF IS_PC_USING_JOYPAD
IF IS_BUTTON_PRESSED PAD1 DPADUP
OR IS_BUTTON_PRESSED PAD1 DPADDOWN
IF timera >= 1000
GET_RADIO_CHANNEL iCurrentRadioChannel
IF NOT iCurrentRadioChannel = 12 // Turn radio off
GET_RADIO_CHANNEL iRadioChannel
SET_RADIO_CHANNEL 12
ELSE
SET_RADIO_CHANNEL iRadioChannel // Set radio
ENDIF
WHILE IS_BUTTON_PRESSED PAD1 DPADUP
OR IS_BUTTON_PRESSED PAD1 DPADDOWN
WAIT 0
ENDWHILE
ENDIF
ELSE
timera = 0
ENDIF
ENDIF
// Keyboard
IF IS_KEY_JUST_PRESSED iTurnOffkey
GET_RADIO_CHANNEL iCurrentRadioChannel
IF NOT iCurrentRadioChannel = 12 // Radio Off
GET_RADIO_CHANNEL iRadioChannel
SET_RADIO_CHANNEL 12
ELSE
SET_RADIO_CHANNEL iRadioChannel
ENDIF
ENDIF
ENDWHILE
ENDWHILE
IncreaseVolume:
GET_AUDIO_RADIO_VOLUME fVolume
IF fVolume < 1.0
fVolume += 0.0625
IF fVolume > 1.0
fVolume = 1.0
ENDIF
WRITE_MEMORY 11926728 4 fVolume FALSE
fVolume *= 100.0
iVolume =# fVolume
ENDIF
RETURN
DecreaseVolume:
GET_AUDIO_RADIO_VOLUME fVolume
IF fVolume > 0.0
fVolume -= 0.0625
IF fVolume < 0.0
fVolume = 0.0
ENDIF
WRITE_MEMORY 11926728 4 fVolume FALSE
fVolume *= 100.0
iVolume =# fVolume
ENDIF
RETURN
}
SCRIPT_END
{
LVAR_FLOAT x y fSizeMultiplier //In
LVAR_INT iBorder iVolume r g b r2 g2 b2 iAlpha iAlpha2 //In
LVAR_INT iSprite
LVAR_FLOAT fSize x2 y2 fSizeX fSizeY fAngle fMargin fBorder
DrawVolumeSprites:
fSize = 16.0 * fSizeMultiplier
x -= fSize
IF iVolume > 20
iSprite = 2
IF iVolume > 50
iSprite = 3
ENDIF
ELSE
iSprite = 1
ENDIF
// Draw sprite
GET_FIXED_XY_ASPECT_RATIO fSize fSize fSizeX fSizeY
fBorder =# iBorder
fBorder *= 0.75
IF fBorder > 0.0
WHILE fAngle < 360.0
fAngle += 18.0
GET_COORD_FROM_ANGLED_DISTANCE x y fAngle fBorder x2 y2
DRAW_SPRITE iSprite x2 y2 fSizeX fSizeY r2 g2 b2 iAlpha2
ENDWHILE
ENDIF
DRAW_SPRITE iSprite x y fSizeX fSizeY r g b iAlpha
fAngle = 0.0
// Draw text
GET_FIXED_XY_ASPECT_RATIO 0.4 1.55 fSizeX fSizeY
fSizeX *= fSizeMultiplier
fSizeY *= fSizeMultiplier
SET_TEXT_FONT FONT_MENU
SET_TEXT_PROPORTIONAL TRUE
SET_TEXT_SCALE fSizeX fSizeY
IF iBorder > 0
SET_TEXT_EDGE iBorder r2 g2 b2 iAlpha2
ELSE
SET_TEXT_EDGE 0 0 0 0 0
ENDIF
SET_TEXT_COLOUR r g b iAlpha
SET_TEXT_CENTRE_SIZE 640.0
fSize *= 0.75
x2 = x + fSize
fSize *= 1.25
/*
fSize /= 3.15
fSizeY *= fSize
y -= fSizeY
*/
fSizeY *= 5.35
y -= fSizeY
DISPLAY_TEXT_WITH_NUMBER x2 y TMPVOLS iVolume
USE_TEXT_COMMANDS 0
CLEO_RETURN 0
}