Skip to content

Commit f2f12fc

Browse files
committed
add AudioStream Functions
Добавил функции для работы с pAudioStream.
1 parent 156cc42 commit f2f12fc

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,9 @@ TextdrawGetString( id ) -- Получает Текст текстдрава
7777

7878
-- Dialog
7979
ShowDialog( iID, iStyle, szCaption, szText, szButton1, szButton2, bSendRequestToServer ) -- Показывает DXUT диалог на экране
80+
81+
-- AudioStream
82+
PlayAudioStream( szUrl, posX, posY, posZ, fRadius, bIs3d ) -- Проигрывает аудио-поток. Возращает значение BOOL(0 - false, не 0 - true)
83+
StopAudioStream( bWait ) -- Останавливает Аудио-поток. Возращает значение BOOL(0 - false, не 0 - true)
84+
8085
```

SA-MP API/init.lua

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ local mem = require( 'memory' )
99
local ffi = require( 'ffi' )
1010

1111
local module = {
12-
_version = 2.1,
12+
_version = 2.2,
1313

1414
Version = nil,
1515
Handle = 0x0,
@@ -42,6 +42,10 @@ local offset = {
4242
fnTakeScreenshot = {['0_3_7-R1'] = 0x070FC0, ['0_3_7-R3'] = 0x074EB0, ['0_3_DL-R1'] = 0x075040, ['0_3_7-R4-2'] = 0x075620};
4343
-- Update v2.1(Aug 23, 2021)
4444
fnShowDialog = {['0_3_7-R1'] = 0x06B9C0, ['0_3_7-R3'] = 0x06F8C0, ['0_3_DL-R1'] = 0x06FA50, ['0_3_7-R4-2'] = 0x070010};
45+
-- Update v2.2(Aug 24, 2021)
46+
stAudioStream = {['0_3_7-R1'] = 0x21A0F0, ['0_3_7-R3'] = 0x26E8D4, ['0_3_DL-R1'] = 0x2ACA1C, ['0_3_7-R4-2'] = 0x26EA04};
47+
fnAudioStreamPlay = {['0_3_7-R1'] = 0x062DA0, ['0_3_7-R3'] = 0x0661F0, ['0_3_DL-R1'] = 0x0663E0, ['0_3_7-R4-2'] = 0x066960};
48+
fnAudioStreamStop = {['0_3_7-R1'] = 0x0629A0, ['0_3_7-R3'] = 0x065DF0, ['0_3_DL-R1'] = 0x065FE0, ['0_3_7-R4-2'] = 0x066560};
4549
};
4650

4751
local define = require( 'SA-MP API.samp.definitions' )
@@ -288,4 +292,20 @@ function module.GetCurrentWeaponID( )
288292
return this.byteCurrentWeapon
289293
end
290294

295+
-- Update v2.2(Aug 24, 2021)
296+
297+
function module.PlayAudioStream( szUrl, posX, posY, posZ, fRadius, bIs3d )
298+
local this = ffi.cast( 'void**', module.Handle + offset['stAudioStream'][module.Version] )
299+
if ( this == 0x0 ) then return end
300+
301+
return ffi.cast( 'int ( __thiscall* )( void *, const char*, float, float, float, float, bool )', module.Handle + offset.fnAudioStreamPlay[module.Version] )( this, szUrl, posX, posY, posZ, fRadius, bIs3d )
302+
end
303+
304+
function module.StopAudioStream( bWait )
305+
local this = ffi.cast( 'void**', module.Handle + offset['stAudioStream'][module.Version] )
306+
if ( this == 0x0 ) then return end
307+
308+
return ffi.cast( 'int ( __thiscall* )( void *, bool )', module.Handle + offset.fnAudioStreamStop[module.Version] )( this, bWait )
309+
end
310+
291311
return module

0 commit comments

Comments
 (0)