SA-MP/bot/main.h

155 lines
3.1 KiB
C
Raw Permalink Normal View History

2023-10-22 01:43:00 +08:00
#pragma once
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
2023-10-22 17:08:53 +08:00
#define SLEEP(x) { Sleep(x); }
2023-10-22 01:43:00 +08:00
#include <windows.h>
2023-10-22 17:08:53 +08:00
#include <mmsystem.h>
#include <malloc.h>
2023-10-22 01:43:00 +08:00
#else
2023-10-22 17:08:53 +08:00
#define SLEEP(x) { usleep(x * 1000); }
#include <unistd.h>
2023-10-22 01:43:00 +08:00
#endif
#define MAX_PLAYER_NAME 24
2024-01-15 23:51:39 +08:00
#define MAX_PLAYERS 1000
2024-01-15 23:52:08 +08:00
#define MAX_VEHICLES 2000
2023-10-22 01:43:00 +08:00
#define MAX_SETTINGS_STRING 256
2024-08-28 23:12:12 +08:00
#define PI 3.14159265f
2024-01-29 19:36:08 +08:00
#define ARRAY_SIZE(a) ( sizeof((a)) / sizeof(*(a)) )
#define SAFE_DELETE(p) { if (p) { delete (p); (p) = NULL; } }
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = NULL; } }
2023-10-22 01:43:00 +08:00
typedef struct _GAME_SETTINGS {
CHAR szConnectPass[MAX_SETTINGS_STRING+1];
CHAR szConnectHost[MAX_SETTINGS_STRING+1];
CHAR szConnectPort[MAX_SETTINGS_STRING+1];
CHAR szNickName[MAX_SETTINGS_STRING+1];
CHAR szModeName[MAX_SETTINGS_STRING+1];
} GAME_SETTINGS;
#include <stdio.h>
#include <stdlib.h>
2024-01-30 21:52:00 +08:00
#include <map>
#include <string>
#include "../raknet/RakClientInterface.h"
#include "../raknet/RakNetworkFactory.h"
#include "../raknet/PacketEnumerations.h"
#include "../raknet/SAMPRPC.h"
2024-01-15 23:51:39 +08:00
typedef unsigned short PLAYERID;
2024-01-15 23:52:08 +08:00
typedef unsigned short VEHICLEID;
#include "../server/amx/amx.h"
2024-08-28 23:12:47 +08:00
#include "../server/system.h"
2023-11-18 00:00:52 +08:00
#include "scrtimers.h"
2024-01-19 23:19:26 +08:00
#include "gamemodes.h"
2023-11-18 00:00:52 +08:00
#include "net/netrpc.h"
2023-11-18 00:00:52 +08:00
#include "net/playerpool.h"
#include "net/vehiclepool.h"
2023-10-22 17:08:53 +08:00
#include "net/netgame.h"
#include "net/scriptrpc.h"
2023-10-22 17:08:53 +08:00
void logprintf(char* format, ...);
#ifdef LINUX
void SignalHandler(int sig);
long GetTickCount();
char* strlwr(char* str);
#endif
2024-06-02 22:36:16 +08:00
#define SPECIAL_ACTION_NONE 0
#define PLAYER_STATE_NONE 0
#define PLAYER_STATE_ONFOOT 1
#define PLAYER_STATE_DRIVER 2
#define PLAYER_STATE_PASSENGER 3
#define PLAYER_STATE_EXIT_VEHICLE 4
#define PLAYER_STATE_ENTER_VEHICLE_DRIVER 5
#define PLAYER_STATE_ENTER_VEHICLE_PASSENGER 6
#define PLAYER_STATE_WASTED 7
#define PLAYER_STATE_SPAWNED 8
#define PLAYER_STATE_SPECTATING 9
2024-06-02 22:36:16 +08:00
#pragma pack(1)
typedef struct _PLAYER_SPAWN_INFO
{
char _gap0[6];
VECTOR vecPos;
float fRotation;
char _gap16[24];
2024-06-02 22:36:16 +08:00
} PLAYER_SPAWN_INFO;
#pragma pack(1)
typedef struct _ONFOOT_SYNC_DATA
{
WORD lrAnalog;
WORD udAnalog;
WORD wKeys;
VECTOR vecPos;
QUATERNION quatRotation;
BYTE byteHealth;
BYTE byteArmour;
BYTE byteCurrentWeapon : 6;
BYTE byteSpecialKey : 2;
BYTE byteSpecialAction;
VECTOR vecMoveSpeed;
VECTOR vecSurfOffsets;
WORD wSurfInfo;
DWORD field_40;
} ONFOOT_SYNC_DATA;
#pragma pack(1)
typedef struct _INCAR_SYNC_DATA
{
VEHICLEID VehicleID;
WORD lrAnalog;
WORD udAnalog;
WORD wKeys;
QUATERNION quatRotation;
VECTOR vecPos;
2024-10-04 16:58:22 +08:00
VECTOR vecMoveSpeed;
float fCarHealth;
BYTE bytePlayerHealth;
BYTE bytePlayerArmour;
BYTE byteCurrentWeapon : 6;
BYTE byteSpecialKey : 2;
2024-10-04 16:58:22 +08:00
BYTE byteSirenOn;
BYTE byteLandingGearState;
VEHICLEID TrailerID;
union {
FLOAT fTrainSpeed;
FLOAT fBikeBankingAngle;
DWORD dwHydraThrustAngle;
};
} INCAR_SYNC_DATA;
#pragma pack(1)
typedef struct _PASSENGER_SYNC_DATA
{
VEHICLEID VehicleID;
char _gap2;
BYTE byteCurrentWeapon : 6;
BYTE byteSpecialKey : 2;
BYTE bytePlayerHealth;
BYTE bytePlayerArmour;
WORD lrAnalog;
WORD udAnalog;
WORD wKeys;
VECTOR vecPos;
} PASSENGER_SYNC_DATA;