Skip to content

Update to latest sampapi #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 46 commits into
base: multiver
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
f89b35e
fix CScoreboard::Enable address
kin4stat Oct 13, 2022
6fa5384
Fix CPed R3 constructor address
Northn May 1, 2023
d51892b
Merge pull request #7 from Northn/patch-1
THE-FYP May 1, 2023
2da2a85
Fix CPickupPool::Create argument type
Northn May 13, 2023
4edd1b1
Fix CGame::ArrayUsedPlayerSlots type
Northn May 13, 2023
966b853
Add more CNetGame R1 methods
Northn May 13, 2023
ee97581
Reverse R1 CChatBubble
Northn May 13, 2023
ec84997
Reverse R1 CHelpDialog
Northn May 13, 2023
5215213
Reverse R1 CObjectMaterialText
Northn May 13, 2023
ae4500e
Reverse R1 CSrvNetStats
Northn May 13, 2023
9ba4b3a
Add R1 InputHandler::RefAntiCheatDetectCount
Northn May 13, 2023
a869c7a
Reverse R3 InputHandler
Northn May 13, 2023
226a6e8
Add missing includes of new headers
Northn May 13, 2023
d9fb86a
Add fully reversed SAMP 0.3.7-R5 items
Northn May 13, 2023
ebc6577
Reverse CObjectEdit
kin4stat May 13, 2023
929401b
Add missing R5 defines
Northn May 13, 2023
023c782
Complete 0.3.7-R5-1 support, new classes and fixes
Northn May 15, 2023
81e0bbb
Change names to match different versions and common naming style
THE-FYP May 15, 2023
eee1423
Delete VS project files
THE-FYP May 15, 2023
ea0559b
Remove `MSVC_RUNTIME_LIBRARY` cmake property
THE-FYP May 15, 2023
9954a13
Reverse R3 & R5 RPCs handlers addresses
Northn May 21, 2023
1160ed8
Fix several addresses
Northn Jun 5, 2023
69d45e0
Merge pull request #8 from Northn/multiver
THE-FYP Jun 5, 2023
80d8fe8
add rate & multiplier for 0.3.7 r3-1 & 0.3.7 r5-1
imring Jun 30, 2023
754463d
Merge pull request #9 from imring/rate
THE-FYP Jul 10, 2023
8a3c44a
Add CChat methods (0.3.7-R1)
imring Jul 12, 2023
430b151
Fix build for MinGW
sr-tream Jul 15, 2023
b9d3311
Add CNetGame methods (0.3.7-R1)
imring Jul 18, 2023
bdd4343
Add CObjectEdit methods (0.3.7-R1)
imring Jul 18, 2023
33458be
Add CObjectPool methods (0.3.7-R1)
imring Jul 18, 2023
be1e565
Add CPed methods (0.3.7-R1)
imring Jul 18, 2023
b8ccf9b
Fix MSVC __pragma macro wrapper
sr-tream Jul 18, 2023
f79a159
fix CObjectPool::Get (0.3.7-R1)
imring Jul 22, 2023
e3f1836
Edit GetLocalPlayerPing/GetLocalPlayerScore
imring Jul 22, 2023
eaa5ca7
Add RefLocalDebug (0.3.7-R1)
imring Jul 22, 2023
5803307
Fix CObjectEdit formatting
imring Jul 22, 2023
bfc7959
Add 0.3.DL
xARMORx Feb 26, 2024
dbd3e8a
Add CDownloadWindow and CDownloadedFilesPool
xARMORx Feb 26, 2024
6c374d8
Merge pull request #10 from sr-tream/multiver
THE-FYP Feb 27, 2024
3410751
Merge pull request #11 from imring/new-methods
THE-FYP Feb 27, 2024
6d4a1cd
Merge pull request #12 from xARMORx/multiver
THE-FYP Feb 27, 2024
fbbb73d
fix CHelpDialog constructor and add more CDownloadWindow methods
xARMORx Apr 7, 2024
4f6d12f
Update CDownloadWindow.h
xARMORx Apr 7, 2024
6ca665c
Merge pull request #13 from xARMORx/multiver
THE-FYP Apr 7, 2024
7654c05
Add class CCustomModels and CDownloadWindow methods
xARMORx Apr 12, 2024
6d4db99
Merge pull request #14 from xARMORx/multiver
THE-FYP Apr 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.15)
project(sampapi VERSION 1.1.0 LANGUAGES CXX)
project(sampapi VERSION 1.2.0 LANGUAGES CXX)

add_library(sampapi)
add_library(BlastHack::sampapi ALIAS sampapi)
Expand All @@ -17,4 +17,3 @@ target_include_directories(sampapi
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
set_property(TARGET sampapi PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
4 changes: 1 addition & 3 deletions include/sampapi/0.3.7-R1/CCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ class SAMPAPI_EXPORT CCamera {
CMatrix* m_pMatrix;

CCamera();
~CCamera() {
Detach();
}
~CCamera();

void Fade(BOOL bin);
void GetMatrix(CMatrix* pMatrix);
Expand Down
10 changes: 4 additions & 6 deletions include/sampapi/0.3.7-R1/CChat.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
This is a SAMP (0.3.7-R1) API project file.
Developer: LUCHARE <luchare.dev@gmail.com>

See more here https://github.com/LUCHARE/SAMP-API

Copyright (c) 2018 BlastHack Team <BlastHack.Net>. All rights reserved.
*/

Expand Down Expand Up @@ -43,7 +43,7 @@ class SAMPAPI_EXPORT CChat {
D3DCOLOR m_debugColor; // 0xFFA9C4E4
long m_nWindowBottom;
struct SAMPAPI_EXPORT ChatEntry {
__int32 m_timestamp;
int m_timestamp;
char m_szPrefix[28];
char m_szText[144];
char unused[64];
Expand Down Expand Up @@ -74,9 +74,7 @@ class SAMPAPI_EXPORT CChat {
CChat(IDirect3DDevice9* pDevice, CFonts* pFontRenderer, const char* pChatLogPath);
~CChat();

int GetMode() {
return m_nMode;
}
int GetMode();
void SwitchMode();
void RecalcFontSize();
void OnLostDevice();
Expand Down
36 changes: 36 additions & 0 deletions include/sampapi/0.3.7-R1/CChatBubble.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
This is a SAMP (0.3.7-R1) API project file.
Developer: LUCHARE <luchare.dev@gmail.com>

See more here https://github.com/LUCHARE/SAMP-API

Copyright (c) 2018 BlastHack Team <BlastHack.Net>. All rights reserved.
*/

#pragma once

#include "sampapi/sampapi.h"

SAMPAPI_BEGIN_PACKED_V037R1

class SAMPAPI_EXPORT CChatBubble {
public:
struct SAMPAPI_EXPORT Player {
BOOL m_bExists;
char m_szText[256];
int m_creationTick;
int m_lifeSpan;
D3DCOLOR m_color;
float m_fDrawDistance;
int m_nMaxLineLength;
} m_player[1004];

CChatBubble();

void Add(ID nPlayer, const char* szText, D3DCOLOR color, float fDrawDistance, int lifeSpan);
void Draw();
};

SAMPAPI_EXPORT SAMPAPI_VAR CChatBubble*& RefChatBubble();

SAMPAPI_END_PACKED
2 changes: 1 addition & 1 deletion include/sampapi/0.3.7-R1/CGame.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SAMPAPI_EXPORT CGame {
bool m_aKeepLoadedVehicleModels[212];

static SAMPAPI_EXPORT SAMPAPI_VAR char*& RefGameTextMessage(); // [256], temp buffer
static SAMPAPI_EXPORT SAMPAPI_VAR bool* ArrayUsedPlayerSlots(); // [SAMP_MAX_PLAYER_PED_SLOTS]
static SAMPAPI_EXPORT SAMPAPI_VAR BOOL* ArrayUsedPlayerSlots(); // [SAMP_MAX_PLAYER_PED_SLOTS]

CGame();

Expand Down
27 changes: 27 additions & 0 deletions include/sampapi/0.3.7-R1/CHelpDialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
This is a SAMP (0.3.7-R1) API project file.
Developer: LUCHARE <luchare.dev@gmail.com>

See more here https://github.com/LUCHARE/SAMP-API

Copyright (c) 2018 BlastHack Team <BlastHack.Net>. All rights reserved.
*/

#pragma once

#include "sampapi/sampapi.h"

SAMPAPI_BEGIN_PACKED_V037R1

class SAMPAPI_EXPORT CHelpDialog {
public:
IDirect3DDevice9* m_pDevice;

CHelpDialog(IDirect3DDevice9* pDevice = SAMPAPI_UNUSED);

void Show();
};

SAMPAPI_EXPORT SAMPAPI_VAR CHelpDialog*& RefHelpDialog();

SAMPAPI_END_PACKED
8 changes: 4 additions & 4 deletions include/sampapi/0.3.7-R1/CLocalPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
SAMPAPI_BEGIN_PACKED_V037R1

enum SpectatingMode : unsigned char {
SPEC_MODE_VEHICLE = 3,
SPEC_MODE_PLAYER = 4,
SPEC_MODE_FIXED = 15,
SPEC_MODE_SIDE = 14
SPECTATING_MODE_VEHICLE = 3,
SPECTATING_MODE_PLAYER = 4,
SPECTATING_MODE_FIXED = 15,
SPECTATING_MODE_SIDE = 14
};

enum SpectatingType : unsigned char {
Expand Down
5 changes: 5 additions & 0 deletions include/sampapi/0.3.7-R1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,9 @@ target_sources(sampapi
SpecialAction.h
Synchronization.h
VehicleSelection.h
CChatBubble.h
CHelpDialog.h
CObjectMaterialText.h
CSrvNetStats.h
CObjectEdit.h
)
26 changes: 8 additions & 18 deletions include/sampapi/0.3.7-R1/CNetGame.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class SAMPAPI_EXPORT CNetGame {
struct SAMPAPI_EXPORT Pools {
CActorPool* m_pActor;
CObjectPool* m_pObject;
CGangZonePool* m_pGangzone;
CGangZonePool* m_pGangZone;
CLabelPool* m_pLabel;
CTextDrawPool* m_pTextdraw;
CTextDrawPool* m_pTextDraw;
CMenuPool* m_pMenu;
CPlayerPool* m_pPlayer;
CVehiclePool* m_pVehicle;
Expand Down Expand Up @@ -158,23 +158,13 @@ class SAMPAPI_EXPORT CNetGame {
void Process();
void ProcessGameStuff();
CPlayerPool* GetPlayerPool();
CObjectPool* GetObjectPool() {
return m_pPools->m_pObject;
}
CActorPool* GetActorPool() {
return m_pPools->m_pActor;
}
int GetState() {
return m_nGameState;
}
BOOL LanMode() {
return m_bLanMode;
}
CObjectPool* GetObjectPool();
CActorPool* GetActorPool();
int GetState();
BOOL LanMode();
CVehiclePool* GetVehiclePool();
RakClientInterface* GetRakClient() {
return m_pRakClient;
}
__int64 GetCounter();
RakClientInterface* GetRakClient();
__int64 GetCounter();
};

SAMPAPI_EXPORT SAMPAPI_VAR CNetGame*& RefNetGame();
Expand Down
2 changes: 1 addition & 1 deletion include/sampapi/0.3.7-R1/CObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SAMPAPI_EXPORT CObject : public CEntity {
ID m_nAttachedToObject;
CVector m_attachOffset;
CVector m_attachRotation;
char field_1;
bool m_bSyncRotation;
CMatrix m_targetMatrix;
char pad_4[148];
char m_bMoving;
Expand Down
101 changes: 101 additions & 0 deletions include/sampapi/0.3.7-R1/CObjectEdit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
This is a SAMP (0.3.7-R1) API project file.
Developers: LUCHARE <luchare.dev@gmail.com>, kin4stat

See more here https://github.com/LUCHARE/SAMP-API

Copyright (c) 2018 BlastHack Team <BlastHack.Net>. All rights reserved.
*/

#pragma once

#include "sampapi/sampapi.h"
#include "sampapi/CVector.h"
#include "sampapi/CMatrix.h"
#include "sampapi/CRect.h"
#include "sampapi/CPoint.h"

SAMPAPI_BEGIN_PACKED_V037R1

enum ObjectEditType {
OBJECT_EDIT_TYPE_NONE = 0x0,
OBJECT_EDIT_TYPE_ATTACHEDOBJECT = 0x2,
OBJECT_EDIT_TYPE_OBJECT = 0x1,
};

enum ObjectEditMode {
OBJECT_EDIT_MODE_POSITION = 0x0,
OBJECT_EDIT_MODE_ROTATION = 0x1,
OBJECT_EDIT_MODE_SCALE = 0x2,
};

enum ObjectEditProcessType {
OBJECT_EDIT_PROCESS_TYPE_XAXIS = 0x0,
OBJECT_EDIT_PROCESS_TYPE_YAXIS = 0x1,
OBJECT_EDIT_PROCESS_TYPE_ZAXIS = 0x2,
OBJECT_EDIT_PROCESS_TYPE_SETPOSITION = 0x3,
OBJECT_EDIT_PROCESS_TYPE_SETROTATION = 0x4,
OBJECT_EDIT_PROCESS_TYPE_SETSCALE = 0x5,
OBJECT_EDIT_PROCESS_TYPE_SAVE = 0xA,
};

class CObjectEdit {
public:
CPoint m_CharMaxSize;
CRect m_xAxisButtonRect;
CRect m_yAxisButtonRect;
CRect m_zAxisButtonRect;
CRect m_PositionButtonRect;
CRect m_RotationButtonRect;
CRect m_ScaleButtonRect;
CRect m_SaveButtonRect;
int m_nEditType;
int m_nEditMode;
BOOL m_bEnabled;
BOOL m_bRenderedThisFrame;
ID m_nEditObjectId;
unsigned int m_nAttachedObjectIndex;
BOOL m_bIsPlayerObject;
CVector m_vRotation;
unsigned int m_nLastSentNotificationTick;
bool m_bRenderScaleButton;
bool m_bEditingRightNow;
bool m_bTopXOfObjectIsOnLeftOfScreen;
bool m_bTopYOfObjectIsOnLeftOfScreen;
bool m_bTopZOfObjectIsOnLeftOfScreen;
CPoint m_EditStartPos;
CPoint m_CursorPosInGame;
BOOL m_bObjectXSizeYCoordDiffMoreThanX;
BOOL m_bObjectYSizeYCoordDiffMoreThanX;
BOOL m_bObjectZSizeYCoordDiffMoreThanX;
CMatrix m_entityMatrix;
IDirect3DDevice9* m_pDevice;
ID3DXLine* m_pLine;
ID3DXFont* m_pIconFontSmall;
ID3DXFont* m_pIconFontBig;
int m_nProcessType;

CObjectEdit(IDirect3DDevice9* RefDevice);
float WorldToScreen(CVector* in, float (&out)[2]);
float WorldToScreen(CVector* in, float*);
int RenderAxes(CMatrix* a2, float linesize);
const char* GetRenderChar(BOOL for_big_font);
void TryChangeProcessType();
void SetEditMode(ObjectEditMode mode);
void ResetMousePos();
void EnterEditObject(ID object_id, BOOL player_object);
void SendEditEndNotification(int response);
void SendAttachedEditEndNotification(int response);
void Disable(BOOL result);
BOOL RenderControlsForObject(CMatrix* object_matrix, float linesize);
void ApplyChanges(ObjectEditProcessType type, float diff);
void ProcessMouseMove();
BOOL MsgProc(int uMsg, int wParam, int lParam);
void Render();

static const char* GetMaxSizeChar();
};

SAMPAPI_EXPORT SAMPAPI_VAR CObjectEdit*& RefObjectEdit();

SAMPAPI_END_PACKED
32 changes: 32 additions & 0 deletions include/sampapi/0.3.7-R1/CObjectMaterialText.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
This is a SAMP (0.3.7-R1) API project file.
Developer: LUCHARE <luchare.dev@gmail.com>

See more here https://github.com/LUCHARE/SAMP-API

Copyright (c) 2018 BlastHack Team <BlastHack.Net>. All rights reserved.
*/

#pragma once

#include "sampapi/sampapi.h"

SAMPAPI_BEGIN_PACKED_V037R1

class SAMPAPI_EXPORT CObjectMaterialText {
public:
IDirect3DDevice9* m_pDevice;
ID3DXSprite* m_pSprite;
ID3DXSprite* m_pSprite_0; // maybe unused

CObjectMaterialText(IDirect3DDevice9* pDevice);
~CObjectMaterialText();

void OnResetDevice();
void OnLostDevice();
IDirect3DTexture9* Create(const char* szText, const char* szFont, char nFontSize, int nBgSizeX, int nBgSizeY, D3DCOLOR fontColor, D3DCOLOR bgColor, bool bBold, char align);
};

SAMPAPI_EXPORT SAMPAPI_VAR CObjectMaterialText*& RefObjectMaterialTextManager();

SAMPAPI_END_PACKED
6 changes: 1 addition & 5 deletions include/sampapi/0.3.7-R1/CObjectPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ class SAMPAPI_EXPORT CObjectPool {
void ShutdownMaterials();
void Draw();
void DrawLast();
CObject* Get(ID nId) {
if (m_bNotEmpty[nId])
return m_pObject[nId];
return nullptr;
}
CObject* Get(ID nId);
};

SAMPAPI_END_PACKED
2 changes: 1 addition & 1 deletion include/sampapi/0.3.7-R1/CPickupPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SAMPAPI_EXPORT CPickupPool {
CPickupPool();
~CPickupPool();

void Create(Pickup* pData, ID nId);
void Create(Pickup* pData, int nId);
void CreateWeapon(int nModel, CVector position, int nAmmo, ID nExOwner);
void Delete(int nId);
void DeleteWeapon(ID nExOwner);
Expand Down
22 changes: 9 additions & 13 deletions include/sampapi/0.3.7-R1/CPlayerPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,15 @@ class SAMPAPI_EXPORT CPlayerPool {
int GetScore(ID nId);
int GetPing(ID nId);
const char* GetName(ID nId);
int GetLocalPlayerPing() {
return m_localInfo.m_nPing;
}
int GetLocalPlayerScore() {
return m_localInfo.m_nScore;
}
int GetCount(BOOL bIncludeNPC = 0);
CLocalPlayer* GetLocalPlayer();
CObject* FindAccessory(::CObject* pGameObject);
CPlayerInfo* GetAt(ID nId);
BOOL IsNPC(ID nId);
void SetPing(ID nId, int nValue);
void SetScore(ID nId, int nValue);
int GetLocalPlayerPing();
int GetLocalPlayerScore();
int GetCount(BOOL bIncludeNPC = 0);
CLocalPlayer* GetLocalPlayer();
CObject* FindAccessory(::CObject* pGameObject);
CPlayerInfo* GetAt(ID nId);
BOOL IsNPC(ID nId);
void SetPing(ID nId, int nValue);
void SetScore(ID nId, int nValue);
};

SAMPAPI_END_PACKED
Loading