11--[[
22 Project: SA-MP API
3- Author: LUCHARE
4- Website: BlastHack.Net
5- Copyright (c) 2018
3+ Author: LUCHARE, Tim4ukys
4+ Website: BlastHack.Net, vk.com/tim4ukys
5+ Copyright (c) 2018, 2021
66]]
77
88local mem = require ( ' memory' )
99local ffi = require ( ' ffi' )
1010
1111local module = {
12- _version = 1.11 ,
12+ _version = 2.1 ,
1313
1414 Version = nil ,
1515 Handle = 0x0 ,
@@ -38,7 +38,10 @@ local offset = {
3838 fnDisableScoreboard = {[' 0_3_7-R1' ] = 0x06A320 , [' 0_3_7-R3' ] = 0x06E270 , [' 0_3_DL-R1' ] = 0x06E410 , [' 0_3_7-R4-2' ] = 0x06E9E0 };
3939 fnSetSpecialAction = {[' 0_3_7-R1' ] = 0x0030C0 , [' 0_3_7-R3' ] = 0x0030C0 , [' 0_3_DL-R1' ] = 0x003110 , [' 0_3_7-R4-2' ] = 0x0030F0 };
4040
41+ -- Update v1.1.1(Jun 2, 2021)
4142 fnTakeScreenshot = {[' 0_3_7-R1' ] = 0x070FC0 , [' 0_3_7-R3' ] = 0x074EB0 , [' 0_3_DL-R1' ] = 0x075040 , [' 0_3_7-R4-2' ] = 0x075620 };
43+ -- Update v2.1(Aug 23, 2021)
44+ fnShowDialog = {[' 0_3_7-R1' ] = 0x06B9C0 , [' 0_3_7-R3' ] = 0x06F8C0 , [' 0_3_DL-R1' ] = 0x06FA50 , [' 0_3_7-R4-2' ] = 0x070010 };
4245};
4346
4447local define = require ( ' SA-MP API.samp.definitions' )
7780function module .Get ()
7881 if ( define ~= nil ) then define ( module .Version ); define = nil end
7982 return {
80- pChat = cast ( ' stChatInfo' ),
81- pChatInput = cast ( ' stInputInfo' ),
82- pKillList = cast ( ' stKillInfo' ),
83- pBase = cast ( ' stSAMP' ),
84- pScoreboard = cast ( ' stScoreboardInfo' ),
85- pRecentDialog = cast ( ' stDialogInfo' ),
86- pMisc = cast ( ' stGameInfo' ),
83+ pChat = cast ( ' stChatInfo' ),
84+ pChatInput = cast ( ' stInputInfo' ),
85+ pKillList = cast ( ' stKillInfo' ),
86+ pBase = cast ( ' stSAMP' ),
87+ pScoreboard = cast ( ' stScoreboardInfo' ),
88+ pRecentDialog = cast ( ' stDialogInfo' ),
89+ pMisc = cast ( ' stGameInfo' ),
8790
8891 -- see samp/%version%/enums.lua
8992 Enum = require ( ' SA-MP API.samp.' .. module .Version .. ' .enums' )
@@ -164,10 +167,6 @@ function module._RegisterClientCommand( cmd, func )
164167 ffi .cast ( ' void ( __thiscall * )( void *, char *, CMDPROC )' , module .Handle + offset .fnAddChatCmd [module .Version ] )( this , cmd , callback )
165168end
166169
167- function module .TakeScreenshot ()
168- ffi .cast ( ' void ( __cdecl * )( void )' , module .Handle + offset .fnTakeScreenshot [module .Version ] )( )
169- end
170-
171170function module .RequestSpawn ()
172171 local this = module .Get ().pBase .pPools .pPlayer .pLocalPlayer
173172 if ( this == 0x0 ) then return end
@@ -244,7 +243,12 @@ function module.SetSpecialAction( actionId )
244243 ffi .cast ( ' void ( __thiscall * )( void *, char )' , module .Handle + offset .fnSetSpecialAction [module .Version ] )( this , actionId )
245244end
246245
247- -- Update
246+ -- Update v1.1.1(Jun 2, 2021)
247+
248+ function module .TakeScreenshot ()
249+ ffi .cast ( ' void ( __cdecl * )( void )' , module .Handle + offset .fnTakeScreenshot [module .Version ] )( )
250+ end
251+
248252function module .AddChatMessage ( msgColor , msg )
249253 module .AddMessageToChat ( 8 , msg , nullptr , msgColor , 0 )
250254end
@@ -268,4 +272,20 @@ function module.TextdrawGetString( id )
268272 return ' '
269273end
270274
271- return module
275+ -- Update v2.1(Aug 23, 2021)
276+
277+ function module .ShowDialog ( iID , iStyle , szCaption , szText , szButton1 , szButton2 , bSendRequestToServer )
278+ local this = module .Get ().pRecentDialog
279+ if ( this == 0x0 ) then return end
280+
281+ ffi .cast ( ' void ( __thiscall * )( void *, int, int, const char*, const char*, const char*, const char*, bool )' , module .Handle + offset .fnShowDialog [module .Version ] )( this , iID , iStyle , szCaption , szText , szButton1 , szButton2 , bSendRequestToServer )
282+ end
283+
284+ function module .GetCurrentWeaponID ( )
285+ local this = module .Get ().pBase .pPools .pPlayer .pLocalPlayer
286+ if ( this == 0x0 ) then return 0 end
287+
288+ return this .byteCurrentWeapon
289+ end
290+
291+ return module
0 commit comments