Last active
January 5, 2024 18:09
-
-
Save JuniorDjjr/eb6e5685768cca1c0db66ce1f8f85a0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SCRIPT_START | |
{ | |
LVAR_INT scplayer hPed | |
LVAR_INT pBASS pBASS_RecordStart pBASS_ChannelGetLevel pBASS_RecordInit pBASS_SetConfig pBASS_RecordFree pBASS_ErrorGetCode | |
LVAR_INT hRecord | |
LVAR_INT iLevel | |
LVAR_INT iResult iTemp bIsFirstTime | |
LVAR_INT iMinLevel iMouthUpdate bEnabled bDebugMode iLanguage | |
GET_PLAYER_CHAR 0 (scplayer) | |
GOSUB LoadINI | |
IF bEnabled = TRUE | |
WAIT 3000 // fixes a bug | |
GOTO activate_mod | |
ENDIF | |
bIsFirstTime = TRUE | |
/////////////////////////////////////////////////////////////////////////////////////////////////// | |
activation_loop: | |
WAIT 0 | |
IF TEST_CHEAT MICRO | |
IF iLanguage = 1 | |
PRINT_STRING_NOW "Microphone Talk by Junior_Djjr - ~g~Enabled" 1500 | |
ELSE | |
PRINT_STRING_NOW "Microphone Talk by Junior_Djjr - ~g~Ativado" 1500 | |
ENDIF | |
activate_mod: | |
GOSUB LoadDLL | |
IF GOSUB InitRecord | |
GOSUB mod_loop | |
ENDIF | |
GOSUB ReleaseDLL | |
ENDIF | |
GOTO activation_loop | |
/////////////////////////////////////////////////////////////////////////////////////////////////// | |
mod_loop: | |
WAIT 0 | |
CALL_FUNCTION_RETURN pBASS_ChannelGetLevel 1 0 (hRecord) (iLevel) | |
ABS_LVAR_INT iLevel | |
IF iLevel > 0 | |
iLevel /= 10000 | |
IF timera > iMouthUpdate | |
IF iLevel > iMinLevel | |
START_CHAR_FACIAL_TALK scplayer iMouthUpdate | |
timera = 0 | |
GOSUB PedsAI | |
ELSE | |
STOP_CHAR_FACIAL_TALK scplayer | |
timera = iMouthUpdate | |
ENDIF | |
ENDIF | |
ENDIF | |
IF bDebugMode = TRUE | |
PRINT_FORMATTED "~s~Level ~y~%i" 100 iLevel | |
ENDIF | |
IF timerb > 60000 // 1 min | |
GOSUB Reload // we don't want hours of resources storing during gameplay... we are not recording anything | |
timerb = 0 | |
ENDIF | |
IF TEST_CHEAT MICRO | |
GOSUB Free | |
IF iLanguage = 1 | |
PRINT_STRING_NOW "Microphone Talk by Junior_Djjr - ~r~Disabled" 1500 | |
ELSE | |
PRINT_STRING_NOW "Microphone Talk by Junior_Djjr - ~r~Desativado" 1500 | |
ENDIF | |
RETURN | |
ENDIF | |
GOTO mod_loop | |
/////////////////////////////////////////////////////////////////////////////////////////////////// | |
PedsAI: | |
STORE_CLOSEST_ENTITIES scplayer (iTemp hPed) | |
IF DOES_CHAR_EXIST hPed | |
IF LOCATE_CHAR_ANY_MEANS_CHAR_3D scplayer hPed 8.0 8.0 5.0 FALSE | |
TASK_LOOK_AT_CHAR hPed scplayer 3000 | |
ENDIF | |
ENDIF | |
RETURN | |
Reload: | |
GOSUB Free | |
GOSUB InitRecord | |
RETURN | |
Free: | |
CALL_FUNCTION_RETURN pBASS_RecordFree 0 0 (iResult) | |
RETURN | |
InitRecord: | |
CALL_FUNCTION pBASS_SetConfig 2 0 (1000 /*length*/, 19 /*BASS_CONFIG_REC_BUFFER*/) // maybe useless.... doesn't fixes latency | |
CALL_FUNCTION_RETURN pBASS_RecordInit 1 0 (-1 /* default device */) (iResult) | |
IF iResult = FALSE | |
GOSUB ShowBassError | |
IS_AUSTRALIAN_GAME | |
RETURN | |
ENDIF | |
CALL_FUNCTION_RETURN pBASS_RecordStart 5 0 (0 /*user*/, 0 /*proc*/, 0 /*flags*/, 1 /*chans*/, 44100 /*freq*/) (hRecord) | |
IF iResult = FALSE | |
GOSUB ShowBassError | |
IS_AUSTRALIAN_GAME | |
RETURN | |
ENDIF | |
timera = 0 | |
timerb = 0 | |
IS_PC_VERSION | |
RETURN | |
LoadDLL: | |
IF NOT LOAD_DYNAMIC_LIBRARY BASS.DLL (pBASS) | |
IF iLanguage = 1 | |
PRINT_STRING_NOW "~r~ERROR: Unable to load 'bass.dll'" 10000 | |
ELSE | |
PRINT_STRING_NOW "~r~ERRO: Nao foi possivel carregar 'bass.dll'" 10000 | |
ENDIF | |
TERMINATE_THIS_CUSTOM_SCRIPT | |
ENDIF | |
IF NOT GET_DYNAMIC_LIBRARY_PROCEDURE "BASS_RecordStart" pBASS (pBASS_RecordStart) | |
IF iLanguage = 1 | |
PRINT_STRING_NOW "~r~ERROR: Unable to find 'BASS_RecordStart' of 'bass.dll'" 10000 | |
ELSE | |
PRINT_STRING_NOW "~r~ERRO: Nao foi possivel encontrar 'BASS_RecordStart' da 'bass.dll'" 10000 | |
ENDIF | |
TERMINATE_THIS_CUSTOM_SCRIPT | |
ENDIF | |
IF NOT GET_DYNAMIC_LIBRARY_PROCEDURE "BASS_ChannelGetLevel" pBASS (pBASS_ChannelGetLevel) | |
IF iLanguage = 1 | |
PRINT_STRING_NOW "~r~ERROR: Unable to find 'BASS_ChannelGetLevel' of 'bass.dll'" 10000 | |
ELSE | |
PRINT_STRING_NOW "~r~ERRO: Nao foi possivel encontrar 'BASS_ChannelGetLevel' da 'bass.dll'" 10000 | |
ENDIF | |
TERMINATE_THIS_CUSTOM_SCRIPT | |
ENDIF | |
IF NOT GET_DYNAMIC_LIBRARY_PROCEDURE "BASS_RecordInit" pBASS (pBASS_RecordInit) | |
IF iLanguage = 1 | |
PRINT_STRING_NOW "~r~ERROR: Unable to find 'BASS_RecordInit' of 'bass.dll'" 10000 | |
ELSE | |
PRINT_STRING_NOW "~r~ERRO: Nao foi possivel encontrar 'BASS_RecordInit' da 'bass.dll'" 10000 | |
ENDIF | |
TERMINATE_THIS_CUSTOM_SCRIPT | |
ENDIF | |
IF NOT GET_DYNAMIC_LIBRARY_PROCEDURE "BASS_SetConfig" pBASS (pBASS_SetConfig) | |
IF iLanguage = 1 | |
PRINT_STRING_NOW "~r~ERROR: Unable to find 'BASS_SetConfig' of 'bass.dll'" 10000 | |
ELSE | |
PRINT_STRING_NOW "~r~ERRO: Nao foi possivel encontrar 'BASS_SetConfig' da 'bass.dll'" 10000 | |
ENDIF | |
TERMINATE_THIS_CUSTOM_SCRIPT | |
ENDIF | |
IF NOT GET_DYNAMIC_LIBRARY_PROCEDURE "BASS_RecordFree" pBASS (pBASS_RecordFree) | |
IF iLanguage = 1 | |
PRINT_STRING_NOW "~r~ERROR: Unable to find 'BASS_RecordFree' of 'bass.dll'" 10000 | |
ELSE | |
PRINT_STRING_NOW "~r~ERRO: Nao foi possivel encontrar 'BASS_RecordFree' da 'bass.dll'" 10000 | |
ENDIF | |
TERMINATE_THIS_CUSTOM_SCRIPT | |
ENDIF | |
IF NOT GET_DYNAMIC_LIBRARY_PROCEDURE "BASS_ErrorGetCode" pBASS (pBASS_ErrorGetCode) | |
IF iLanguage = 1 | |
PRINT_STRING_NOW "~r~ERROR: Unable to find 'BASS_ErrorGetCode' of 'bass.dll'" 10000 | |
ELSE | |
PRINT_STRING_NOW "~r~ERRO: Nao foi possivel encontrar 'BASS_ErrorGetCode' da 'bass.dll'" 10000 | |
ENDIF | |
TERMINATE_THIS_CUSTOM_SCRIPT | |
ENDIF | |
RETURN | |
ReleaseDLL: | |
FREE_DYNAMIC_LIBRARY pBASS | |
RETURN | |
LoadINI: | |
READ_INT_FROM_INI_FILE "CLEO/Microphone Talk.ini" "Settings" "Enabled" (bEnabled) | |
IF NOT READ_INT_FROM_INI_FILE "CLEO/Microphone Talk.ini" "Settings" "MinLevel" (iMinLevel) | |
IF iLanguage = 1 | |
PRINT_STRING_NOW "~r~ERROR: Unable to read 'MinLevel' from 'Microphone Talk.ini'" 10000 | |
ELSE | |
PRINT_STRING_NOW "~r~ERRO: Nao foi possivel ler 'MinLevel' do 'Microphone Talk.ini'" 10000 | |
ENDIF | |
TERMINATE_THIS_CUSTOM_SCRIPT | |
ENDIF | |
IF NOT READ_INT_FROM_INI_FILE "CLEO/Microphone Talk.ini" "Settings" "MouthUpdate" (iMouthUpdate) | |
IF iLanguage = 1 | |
PRINT_STRING_NOW "~r~ERROR: Unable to read 'MouthUpdate' from 'Microphone Talk.ini'" 10000 | |
ELSE | |
PRINT_STRING_NOW "~r~ERRO: Nao foi possivel ler 'MouthUpdate' do 'Microphone Talk.ini'" 10000 | |
ENDIF | |
TERMINATE_THIS_CUSTOM_SCRIPT | |
ENDIF | |
IF NOT READ_INT_FROM_INI_FILE "CLEO/Microphone Talk.ini" "Settings" "Language" (iLanguage) | |
iLanguage = 1 | |
ENDIF | |
READ_INT_FROM_INI_FILE "CLEO/Microphone Talk.ini" "Settings" "DebugMode" (bDebugMode) | |
RETURN | |
ShowBassError: | |
CALL_FUNCTION_RETURN pBASS_ErrorGetCode 0 0 () (iResult) | |
PRINT_FORMATTED_NOW "~r~ERROR Code '%i'" 10000 (iResult) | |
RETURN | |
} | |
SCRIPT_END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment