├── stdafx.cpp ├── Server.Launcher.lib ├── makefile ├── sdk ├── APIServer.h ├── CVector4.h ├── Structs.h ├── Plane.cpp ├── APICef.h ├── Plane.h ├── APIWorld.h ├── APIVisual.h ├── APINpc.h ├── APIObject.h ├── CVector2.cpp ├── Quaternion.cpp ├── Quaternion.h ├── CVector3.cpp ├── APICheckpoint.h ├── APIPlayer.h ├── CMaths.h ├── CVector2.h ├── APIEntity.h ├── CVector3.h └── APIVehicle.h ├── api.h ├── README.md ├── stdafx.h ├── .gitignore ├── Public API.sln ├── api.cpp ├── Base.vcxproj.filters ├── Base.vcxproj └── LICENSE /stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | -------------------------------------------------------------------------------- /Server.Launcher.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FiveMP/FiveMP-API/HEAD/Server.Launcher.lib -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | API.Base: api.cpp 2 | g++ api.cpp sdk/*.cpp -o ../../bin/Linux/plugin/API.Base.so -ldl -shared -fPIC -std=c++11 3 | -------------------------------------------------------------------------------- /sdk/APIServer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | namespace API 7 | { 8 | class Server 9 | { 10 | public: 11 | DLL_PUBLIC_I static void PrintMessage(const std::wstring message); 12 | }; 13 | } 14 | #ifdef __cplusplus 15 | } 16 | #endif -------------------------------------------------------------------------------- /api.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if defined _WIN32 || defined __CYGWIN__ 4 | #ifdef __GNUC__ 5 | #define DLL_PUBLIC __attribute__ ((dllexport)) 6 | #else 7 | #define DLL_PUBLIC __declspec(dllexport) 8 | #endif 9 | #else 10 | #define DLL_PUBLIC 11 | #endif 12 | 13 | #if defined _WIN32 || defined __CYGWIN__ 14 | #ifdef __GNUC__ 15 | #define DLL_PUBLIC_I __attribute__ ((dllimport)) 16 | #else 17 | #define DLL_PUBLIC_I __declspec(dllimport) 18 | #endif 19 | #else 20 | #define DLL_PUBLIC_I 21 | #endif -------------------------------------------------------------------------------- /sdk/CVector4.h: -------------------------------------------------------------------------------- 1 | class CVector4 2 | { 3 | public: 4 | float x; 5 | float y; 6 | float z; 7 | float w; 8 | 9 | CVector4() 10 | { 11 | x = y = z = w = 0.0f; 12 | } 13 | 14 | CVector4(float _x, float _y, float _z, float _w) 15 | { 16 | x = _x; y = _y; z = _z; w = _w; 17 | } 18 | 19 | bool IsEmpty() const 20 | { 21 | return (x == 0 && y == 0 && z == 0 && w == 0); 22 | } 23 | 24 | CVector4 operator+ (const CVector4& vecRight) const 25 | { 26 | return CVector4(x + vecRight.x, y + vecRight.y, z + vecRight.z, w + vecRight.w); 27 | } 28 | }; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # FiveMP - Public API 2 | This API was created to give an idea of how the API could look like in 0.2a, this API is lacking a lot of features and options; so it's practically useless. 3 | 4 | ## Contribute 5 | 1. Clone the source 6 | 2. Open `Public API.sln` 7 | 3. Do stuff... 8 | 4. Submit pull request 9 | 10 | ## How to use 11 | 1. Clone the source 12 | 2. Open `Public API.sln' 13 | 3. Change the project target name to your plugin name 14 | 4. Do stuff... 15 | 16 | ## Releasing your plugin 17 | You're completely free to release your plugin as long as you use the same license. Please make your plugin open-source if this is what you're planning on doing. 18 | -------------------------------------------------------------------------------- /stdafx.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define _USE_MATH_DEFINES 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "api.h" 13 | 14 | // Math 15 | #include "sdk/CVector2.h" 16 | #include "sdk/CVector3.h" 17 | #include "sdk/CVector4.h" 18 | #include "sdk/Plane.h" 19 | #include "sdk/Quaternion.h" 20 | 21 | #include "sdk/CMaths.h" 22 | #include "sdk/Structs.h" 23 | 24 | // API Function Imports 25 | #include "sdk/APICef.h" 26 | #include "sdk/APIVisual.h" 27 | #include "sdk/APIWorld.h" 28 | #include "sdk/APIEntity.h" 29 | #include "sdk/APICheckpoint.h" 30 | #include "sdk/APINpc.h" 31 | #include "sdk/APIObject.h" 32 | #include "sdk/APIPlayer.h" 33 | #include "sdk/APIServer.h" 34 | #include "sdk/APIVehicle.h" -------------------------------------------------------------------------------- /sdk/Structs.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct Color { 4 | int Red; 5 | int Green; 6 | int Blue; 7 | int Alpha; 8 | }; 9 | 10 | struct PedComponent 11 | { 12 | int drawableid = -1; 13 | int textureid = -1; 14 | int paletteid = -1; 15 | }; 16 | 17 | struct PedHeadBlend 18 | { 19 | int shapeFirst = 0; 20 | int shapeSecond = 0; 21 | int shapeThird = 0; 22 | int skinFirst = 0; 23 | int skinSecond = 0; 24 | int skinThird = 0; 25 | float shapeMix = 0; 26 | float skinMix = 0; 27 | float thirdMix = 0; 28 | }; 29 | 30 | struct PedHeadOverlay 31 | { 32 | int index = 0; 33 | float opacity = 0.0f; 34 | int colorType = 0; 35 | int colorID = 0; 36 | int secondColorID = 0; 37 | }; 38 | 39 | struct PedProp 40 | { 41 | int drawableid = 0; 42 | int textureid = 0; 43 | }; 44 | 45 | struct PedFeature 46 | { 47 | float scale = 0.0f; 48 | }; -------------------------------------------------------------------------------- /sdk/Plane.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | File: 3 | Plane.cpp 4 | 5 | Author: 6 | Ethem Kurt (BigETI) 7 | */ 8 | 9 | #include "../stdafx.h" 10 | 11 | Plane::Plane() : xv(CVector3::up), yv(CVector3::right) 12 | { 13 | // 14 | } 15 | 16 | Plane::Plane(const Plane & p) : xv(p.xv), yv(p.yv) 17 | { 18 | // 19 | } 20 | 21 | Plane::Plane(const CVector3 &_xv, const CVector3 &_yv) : xv(_xv), yv(_yv) 22 | { 23 | // 24 | } 25 | 26 | Plane::Plane(float_t xvx, float_t xvy, float_t xvz, float_t yvx, float_t yvy, float_t yvz) : xv(xvx, xvy, xvz), yv(yvx, yvy, yvz) 27 | { 28 | // 29 | } 30 | 31 | Plane::~Plane() 32 | { 33 | // 34 | } 35 | 36 | Plane & Plane::operator=(const Plane & p) 37 | { 38 | xv = p.xv; 39 | yv = p.yv; 40 | } 41 | 42 | CVector3 Plane::GetPoint(const CVector2 & p) 43 | { 44 | return (xv * p.x) + (yv * p.y); 45 | } 46 | 47 | CVector3 Plane::GetPoint(float_t x, float_t y) 48 | { 49 | return GetPoint(CVector2(x, y)); 50 | } 51 | 52 | CVector3 Plane::GetNormal() 53 | { 54 | return xv.CrossProduct(yv); 55 | } -------------------------------------------------------------------------------- /sdk/APICef.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | namespace API 7 | { 8 | class CEF 9 | { 10 | public: 11 | /// 12 | /// Sets the browser's URL for the player 13 | /// 14 | /// The entity you wish to set the URL for 15 | /// The URL which is supposed to load 16 | /// The JavaScript code that's used to initialize the page's functions 17 | /// Whether the loading URL is remote (http/https) or local (from server files) 18 | DLL_PUBLIC_I static void LoadURL(const int entity, std::string url, std::string appcode = "", bool remote = false); 19 | 20 | /// 21 | /// Executes JavaScript for the player 22 | /// 23 | /// The entity you wish to execute the call for 24 | /// The JavaScript code you wish to execute 25 | DLL_PUBLIC_I static void JavaScriptCall(const int entity, std::string call); 26 | }; 27 | } 28 | #ifdef __cplusplus 29 | } 30 | #endif -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | *.smod 19 | 20 | # Compiled Static libraries 21 | *.lai 22 | *.la 23 | *.a 24 | *.lib 25 | 26 | # Executables 27 | *.exe 28 | *.out 29 | *.app 30 | 31 | # Build results 32 | [Dd]ebug/ 33 | [Dd]ebugPublic/ 34 | [Rr]elease/ 35 | [Rr]eleases/ 36 | x64/ 37 | x86/ 38 | [Oo]bj/ 39 | [Ll]og/ 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | *.lib 66 | 67 | ipch/ 68 | *.ipch 69 | *.aps 70 | *.ncb 71 | *.opendb 72 | *.opensdf 73 | *.sdf 74 | *.cachefile 75 | *.VC.db 76 | *.VC.VC.opendb 77 | *.db 78 | *.tlog 79 | *.lastbuildstate 80 | *.idb 81 | *.iobj 82 | *.ipdb 83 | *.exp 84 | *.suo 85 | *.suo 86 | /.vs/Public API/v14/.suo 87 | /.vs/Public API/v15/.suo 88 | *.db-shm 89 | *.db-wal 90 | /.vs/Public API/v15/Solution.VC.db-wal 91 | /.vs/Public API/v15/Solution.VC.db-shm 92 | -------------------------------------------------------------------------------- /Public API.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "My Plugin", "Base.vcxproj", "{62BEAF06-48E0-4B13-A40D-8CF54E308F22}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {62BEAF06-48E0-4B13-A40D-8CF54E308F22}.Debug|x64.ActiveCfg = Debug|x64 17 | {62BEAF06-48E0-4B13-A40D-8CF54E308F22}.Debug|x64.Build.0 = Debug|x64 18 | {62BEAF06-48E0-4B13-A40D-8CF54E308F22}.Debug|x86.ActiveCfg = Debug|Win32 19 | {62BEAF06-48E0-4B13-A40D-8CF54E308F22}.Debug|x86.Build.0 = Debug|Win32 20 | {62BEAF06-48E0-4B13-A40D-8CF54E308F22}.Release|x64.ActiveCfg = Release|x64 21 | {62BEAF06-48E0-4B13-A40D-8CF54E308F22}.Release|x64.Build.0 = Release|x64 22 | {62BEAF06-48E0-4B13-A40D-8CF54E308F22}.Release|x86.ActiveCfg = Release|Win32 23 | {62BEAF06-48E0-4B13-A40D-8CF54E308F22}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /api.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | extern "C" DLL_PUBLIC bool API_Initialize(void) { 4 | // When Plugin gets loaded 5 | API::Server::PrintMessage(L"Initialized"); 6 | return true; 7 | } 8 | 9 | extern "C" DLL_PUBLIC bool API_Close(void) { 10 | // When plugin gets unloaded 11 | API::Server::PrintMessage(L"Closed"); 12 | return true; 13 | } 14 | 15 | extern "C" DLL_PUBLIC bool API_OnTick(void) { 16 | // Every server tick this gets called 17 | API::Server::PrintMessage(L"Tick"); 18 | return true; 19 | } 20 | 21 | extern "C" DLL_PUBLIC bool API_OnPlayerConnecting(const std::string guid) 22 | { 23 | // When a player connects (still loading everything from the server) 24 | API::Server::PrintMessage(L"Connecting"); 25 | return true; 26 | } 27 | 28 | extern "C" DLL_PUBLIC bool API_OnPlayerConnected(int entity) 29 | { 30 | // When the player is successfully connected (loaded in, but not spawned yet) 31 | API::Server::PrintMessage(L"Connected"); 32 | return true; 33 | } 34 | 35 | // When a entity enters a checkpoint (only players right now) 36 | extern "C" DLL_PUBLIC void API_OnEntityEnterCheckpoint(int checkpoint, int entity) 37 | { 38 | API::Server::PrintMessage(L"OnEntityEnterCheckpoint"); 39 | } 40 | 41 | // When a entity exits a checkpoint (only players right now) 42 | extern "C" DLL_PUBLIC void API_OnEntityExitCheckpoint(int checkpoint, int entity) 43 | { 44 | API::Server::PrintMessage(L"OnEntityExitCheckpoint"); 45 | } 46 | 47 | // When a player sends a command 48 | extern "C" DLL_PUBLIC void API_OnPlayerCommand(const int entity, const std::string message) 49 | { 50 | API::Server::PrintMessage(L"OnPlayerCommand"); 51 | } 52 | 53 | // When a player sends a message 54 | extern "C" DLL_PUBLIC void API_OnPlayerMessage(const int entity, const std::string message) 55 | { 56 | API::Server::PrintMessage(L"OnPlayerMessage"); 57 | } -------------------------------------------------------------------------------- /sdk/Plane.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// Plane class 3 | /// By Ethem Kurt (BigETI) 4 | /// 5 | class Plane 6 | { 7 | public: 8 | 9 | /// 10 | /// X axis vector component 11 | /// 12 | CVector3 xv; 13 | 14 | /// 15 | /// Y axis vector component 16 | /// 17 | CVector3 yv; 18 | 19 | /// 20 | /// Constructor 21 | /// 22 | Plane(); 23 | 24 | /// 25 | /// Copy constructor 26 | /// 27 | /// Plane to assign from 28 | Plane(const Plane &p); 29 | 30 | /// 31 | /// Constructor 32 | /// 33 | /// X axis vector component 34 | /// Y axis vector component 35 | Plane(const CVector3 &_xv, const CVector3 &_yv); 36 | 37 | /// 38 | /// Constructor 39 | /// 40 | /// X axis vector X component 41 | /// X axis vector Y component 42 | /// X axis vector Z component 43 | /// Y axis vector X component 44 | /// Y axis vector Y component 45 | /// Y axis vector Z component 46 | Plane(float_t xvx, float_t xvy, float_t xvz, float_t yvx, float_t yvy, float_t yvz); 47 | 48 | /// 49 | /// Destructor 50 | /// 51 | ~Plane(); 52 | 53 | /// 54 | /// Assign plane 55 | /// 56 | /// Plane to assign from 57 | /// Itself 58 | Plane &operator=(const Plane &p); 59 | 60 | /// 61 | /// Get point in space from plane X and Y coordinate 62 | /// This function is not designed for projecting vectors 63 | /// 64 | /// Point on plane 65 | /// Point in 3D space 66 | CVector3 GetPoint(const CVector2 &p); 67 | 68 | /// 69 | /// Get point in space from plane X and Y coordinate 70 | /// This function is not designed for projecting vectors 71 | /// 72 | /// X axis 73 | /// Y axis 74 | /// Point in 3D space 75 | CVector3 GetPoint(float_t x, float_t y); 76 | 77 | /// 78 | /// Get plane normal vector 79 | /// 80 | /// Plane normal vector 81 | CVector3 GetNormal(); 82 | }; -------------------------------------------------------------------------------- /sdk/APIWorld.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | namespace API 7 | { 8 | class World 9 | { 10 | public: 11 | /// 12 | /// Gets the World Time 13 | /// 14 | /// The Hour (this is a pointer) 15 | /// The Minute (this is a pointer) 16 | /// The Second (this is a pointer) 17 | /// 18 | DLL_PUBLIC_I static void GetTime(int *hour, int *minute, int *second); 19 | /// 20 | /// Sets the World Time 21 | /// 22 | /// The Hour you wish to set 23 | /// The Minute you wish to set 24 | /// The Second you wish to set 25 | DLL_PUBLIC_I static void SetTime(const int hour, const int minute, const int second); 26 | /// 27 | /// Gets the Weather 28 | /// 29 | /// The current weather on the server 30 | DLL_PUBLIC_I static const std::wstring GetWeather(); 31 | /// 32 | /// Sets the Weather 33 | /// 34 | /// The weather you wish to set 35 | DLL_PUBLIC_I static void SetWeather(const std::wstring weather); 36 | /// 37 | /// Loads an IPL for all players and future newly connected players 38 | /// 39 | /// The name of the IPL 40 | DLL_PUBLIC_I static void LoadIPL(const std::wstring ipl); 41 | /// 42 | /// Loads an IPL for a specific player 43 | /// 44 | /// The name of the IPL 45 | /// The entity of the player you wish to load the ipl for 46 | DLL_PUBLIC_I static void LoadIPL(const int entity, const std::wstring v); 47 | /// 48 | /// Unloads an IPL for all players and future newly connected players 49 | /// 50 | /// The name of the IPL 51 | DLL_PUBLIC_I static void UnloadIPL(const std::wstring ipl); 52 | /// 53 | /// Unloads an IPL for a specific player 54 | /// 55 | /// The name of the IPL 56 | /// The entity of the player you wish to unload the ipl for 57 | DLL_PUBLIC_I static void UnloadIPL(const int entity, const std::wstring ipl); 58 | }; 59 | } 60 | #ifdef __cplusplus 61 | } 62 | #endif -------------------------------------------------------------------------------- /Base.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | sdk\Maths 7 | 8 | 9 | sdk\Maths 10 | 11 | 12 | sdk\Maths 13 | 14 | 15 | sdk\Maths 16 | 17 | 18 | 19 | 20 | 21 | 22 | sdk 23 | 24 | 25 | sdk 26 | 27 | 28 | sdk 29 | 30 | 31 | sdk 32 | 33 | 34 | sdk 35 | 36 | 37 | sdk 38 | 39 | 40 | sdk 41 | 42 | 43 | sdk 44 | 45 | 46 | sdk 47 | 48 | 49 | sdk 50 | 51 | 52 | sdk\Maths 53 | 54 | 55 | sdk\Maths 56 | 57 | 58 | sdk\Maths 59 | 60 | 61 | sdk\Maths 62 | 63 | 64 | sdk\Maths 65 | 66 | 67 | sdk\Maths 68 | 69 | 70 | 71 | 72 | 73 | {53ff5b31-1865-4560-a251-9cf7d011eef7} 74 | 75 | 76 | {1bb4f979-0f11-4640-8295-e4c642ebd1ae} 77 | 78 | 79 | -------------------------------------------------------------------------------- /sdk/APIVisual.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | namespace API 7 | { 8 | class Visual 9 | { 10 | public: 11 | /// 12 | /// Sends a notification message that displays above the game minimap to all clients. 13 | /// 14 | /// The message of the notification 15 | /// Picture to display (pastebin.com/XdpJVbHz) 16 | /// The icon type to use (iconTypes: 1 : Chat Box, 2 : Email, 3 : Add Friend Request, 4 : Nothing, 5 : Nothing, 6 : Nothing, 7 : Right Jumping Arrow, 8 : RP Icon, 9 : $ Icon) 17 | /// The sender is the very top header. This can be any string. 18 | /// The subject is the header under the sender. 19 | /// 20 | DLL_PUBLIC_I static void ShowMessageAboveMap(const std::wstring message, const std::wstring pic, const int icontype, const std::wstring sender, const std::wstring subject); 21 | 22 | /// 23 | /// Sends a notification message that displays above the game minimap to a specific client. 24 | /// 25 | /// The entity id of the player you wish to send it too 26 | /// The message of the notification 27 | /// Picture to display (pastebin.com/XdpJVbHz) 28 | /// The icon type to use (iconTypes: 1 : Chat Box, 2 : Email, 3 : Add Friend Request, 4 : Nothing, 5 : Nothing, 6 : Nothing, 7 : Right Jumping Arrow, 8 : RP Icon, 9 : $ Icon) 29 | /// The sender is the very top header. This can be any string. 30 | /// The subject is the header under the sender. 31 | /// 32 | DLL_PUBLIC_I static void ShowMessageAboveMapToPlayer(const int entity, const std::wstring message, const std::wstring pic, const int icontype, const std::wstring sender, const std::wstring subject); 33 | 34 | /// 35 | /// Sends a chat message to all clients. 36 | /// 37 | /// The string of the message 38 | DLL_PUBLIC_I static void SendChatMessage(const std::string message); 39 | 40 | /// 41 | /// Sends a chat message to a client. 42 | /// 43 | /// The entityid of the player you wish to send the message to. 44 | /// The string of the message 45 | DLL_PUBLIC_I static void SendChatMessageToPlayer(const int entity, const std::string message); 46 | 47 | /// 48 | /// Enables/disables the cursor on-screen. Works with CEF and ImGui 49 | /// 50 | /// The entityid of the player you wish to enable/disable the cursor of. 51 | /// Whether to show the cursor or not (true/false) 52 | DLL_PUBLIC_I static void ShowCursor(const int entity, bool show); 53 | }; 54 | } 55 | #ifdef __cplusplus 56 | } 57 | #endif -------------------------------------------------------------------------------- /sdk/APINpc.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | namespace API 7 | { 8 | class NPC 9 | { 10 | public: 11 | /// 12 | /// Creates a NPC of a desired model at the position defined 13 | /// 14 | /// The model of the npc you wish to create 15 | /// The position you wish to create the npc at 16 | /// The heading you wish to have the npc facing 17 | /// The npc server entity id 18 | DLL_PUBLIC_I static const int Create(const std::wstring model, const CVector3 position, const CVector3 rotation); 19 | }; 20 | } 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | 25 | class NPC { 26 | private: 27 | int Entity; 28 | public: 29 | const int GetEntity() { return Entity; } 30 | 31 | void Create(const std::wstring model, const CVector3 position, const CVector3 rotation) 32 | { 33 | Entity = API::NPC::Create(model, position, rotation); 34 | } 35 | 36 | void Destroy() 37 | { 38 | API::Entity::Destroy(Entity); 39 | Entity = -1; 40 | } 41 | 42 | const CVector3 GetPosition() 43 | { 44 | return API::Entity::GetPosition(Entity); 45 | } 46 | 47 | void SetPosition(const CVector3 position) 48 | { 49 | API::Entity::SetPosition(Entity, position); 50 | } 51 | 52 | const CVector3 GetRotation() 53 | { 54 | return API::Entity::GetRotation(Entity); 55 | } 56 | 57 | void SetRotation(const CVector3 position) 58 | { 59 | API::Entity::SetRotation(Entity, position); 60 | } 61 | 62 | const PedComponent GetPedComponent(const int componentid) 63 | { 64 | return API::Entity::GetPedComponent(Entity, componentid); 65 | } 66 | 67 | void SetPedComponent(const int componentid, const PedComponent component) 68 | { 69 | API::Entity::SetPedComponent(Entity, componentid, component); 70 | } 71 | 72 | const PedHeadBlend GetPedHeadBlend() 73 | { 74 | return API::Entity::GetPedHeadBlend(Entity); 75 | } 76 | 77 | void SetPedHeadBlend(const PedHeadBlend headblend) 78 | { 79 | API::Entity::SetPedHeadBlend(Entity, headblend); 80 | } 81 | 82 | const PedHeadOverlay GetPedHeadOverlay(const int overlayid) 83 | { 84 | return API::Entity::GetPedHeadOverlay(Entity, overlayid); 85 | } 86 | 87 | void SetPedHeadOverlay(const int overlayid, const PedHeadOverlay overlay) 88 | { 89 | API::Entity::SetPedHeadOverlay(Entity, overlayid, overlay); 90 | } 91 | 92 | const PedProp GetPedProp(const int compotentid) 93 | { 94 | return API::Entity::GetPedProp(Entity, compotentid); 95 | } 96 | 97 | void SetPedProp(const int compotentid, const PedProp prop) 98 | { 99 | API::Entity::SetPedProp(Entity, compotentid, prop); 100 | } 101 | 102 | const float GetPedFaceFeature(const int index) 103 | { 104 | return API::Entity::GetPedFaceFeature(Entity, index); 105 | } 106 | 107 | void SetPedFaceFeature(const int index, const float scale) 108 | { 109 | API::Entity::SetPedFaceFeature(Entity, index, scale); 110 | } 111 | 112 | const float GetViewDistance() 113 | { 114 | return API::Entity::GetViewDistance(Entity); 115 | } 116 | 117 | void SetViewDistance(const float distance) 118 | { 119 | API::Entity::SetViewDistance(Entity, distance); 120 | } 121 | 122 | }; -------------------------------------------------------------------------------- /sdk/APIObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | namespace API 7 | { 8 | class Object 9 | { 10 | public: 11 | /// 12 | /// Creates a object of a desired model at the position defined 13 | /// 14 | /// The model of the object you wish to create 15 | /// The position you wish to create the object at 16 | /// The rotation you wish to create the object with 17 | /// If the object should be dynamic or not. (has physics or not) 18 | /// The objects server entity id 19 | DLL_PUBLIC_I static const int Create(const std::wstring model, const CVector3 position, const CVector3 rotation, const bool dynamic); 20 | 21 | 22 | /// 23 | /// Creates a object of a desired hash of a model name at the position defined 24 | /// 25 | /// The hash of the model name of the object you wish to create 26 | /// The position you wish to create the object at 27 | /// The rotation you wish to create the object with 28 | /// If the object should be dynamic or not. (has physics or not) 29 | /// The objects server entity id 30 | DLL_PUBLIC_I static const int Create(const int hash, const CVector3 position, const CVector3 rotation, const bool dynamic); 31 | 32 | /// 33 | /// Gets the texture variation of the object entity. 34 | /// 35 | /// The enity of the objetc you wish to get the texture variation of 36 | DLL_PUBLIC_I static const int GetTextureVariation(const int entity); 37 | 38 | /// 39 | /// Sets the texture variation of the object entity. 40 | /// 41 | /// The enity of the objetc you wish to set the texture variation of 42 | /// The texture id/index 43 | DLL_PUBLIC_I static void SetTextureVariation(const int entity, const int textureindex); 44 | }; 45 | } 46 | #ifdef __cplusplus 47 | } 48 | #endif 49 | 50 | class Object { 51 | private: 52 | int Entity; 53 | public: 54 | const int GetEntity() { return Entity; } 55 | 56 | void Create(const std::wstring model, const CVector3 position, const CVector3 rotation, const bool dynamic) 57 | { 58 | Entity = API::Object::Create(model, position, rotation, dynamic); 59 | } 60 | 61 | void Create(const int hash, const CVector3 position, const CVector3 rotation, const bool dynamic) 62 | { 63 | Entity = API::Object::Create(hash, position, rotation, dynamic); 64 | } 65 | 66 | void Destroy() 67 | { 68 | API::Entity::Destroy(Entity); 69 | Entity = -1; 70 | } 71 | 72 | const CVector3 GetPosition() 73 | { 74 | return API::Entity::GetPosition(Entity); 75 | } 76 | 77 | void SetPosition(const CVector3 position) 78 | { 79 | API::Entity::SetPosition(Entity, position); 80 | } 81 | 82 | const CVector3 GetRotation() 83 | { 84 | return API::Entity::GetRotation(Entity); 85 | } 86 | 87 | void SetRotation(const CVector3 position) 88 | { 89 | API::Entity::SetRotation(Entity, position); 90 | } 91 | 92 | const float GetViewDistance() 93 | { 94 | return API::Entity::GetViewDistance(Entity); 95 | } 96 | 97 | void SetViewDistance(const float distance) 98 | { 99 | API::Entity::SetViewDistance(Entity, distance); 100 | } 101 | 102 | const int GetTextureVariation() 103 | { 104 | return API::Object::GetTextureVariation(Entity); 105 | } 106 | 107 | void SetTextureVariation(const int textureindex) 108 | { 109 | API::Object::SetTextureVariation(Entity, textureindex); 110 | } 111 | 112 | }; -------------------------------------------------------------------------------- /sdk/CVector2.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | File: 3 | CVector2.cpp 4 | 5 | Author: 6 | Ethem Kurt (BigETI) 7 | */ 8 | 9 | #include "../stdafx.h" 10 | 11 | const CVector2 CVector2::unit(1.0f, 1.0f); 12 | const CVector2 CVector2::null(0.0f, 0.0f); 13 | const CVector2 CVector2::up(0.0f, 1.0f); 14 | const CVector2 CVector2::down(0.0f, -1.0f); 15 | const CVector2 CVector2::left(-1.0f, 0.0f); 16 | const CVector2 CVector2::right(1.0f, 0.0f); 17 | 18 | CVector2::CVector2() : x(0.0f), y(0.0f) 19 | { 20 | // 21 | } 22 | 23 | CVector2::CVector2(const CVector2 & v) : x(v.x), y(v.y) 24 | { 25 | // 26 | } 27 | 28 | CVector2::CVector2(float_t _x, float_t _y) : x(_x), y(_y) 29 | { 30 | // 31 | } 32 | 33 | CVector2::~CVector2() 34 | { 35 | // 36 | } 37 | 38 | CVector2 & CVector2::operator=(const CVector2 & v) 39 | { 40 | x = v.x; 41 | y = v.y; 42 | return (*this); 43 | } 44 | 45 | CVector2 & CVector2::operator+=(const CVector2 & v) 46 | { 47 | x += v.x; 48 | y += v.y; 49 | return (*this); 50 | } 51 | 52 | CVector2 & CVector2::operator-=(const CVector2 & v) 53 | { 54 | x -= v.x; 55 | y -= v.y; 56 | return (*this); 57 | } 58 | 59 | CVector2 & CVector2::operator*=(float_t s) 60 | { 61 | x *= s; 62 | y *= s; 63 | return (*this); 64 | } 65 | 66 | CVector2 & CVector2::operator/=(float_t s) 67 | { 68 | if (IS_FLOAT_ZERO(s)) 69 | throw std::overflow_error("Division by zero"); 70 | x /= s; 71 | y /= s; 72 | return (*this); 73 | } 74 | 75 | CVector2 CVector2::operator+(const CVector2 & v) 76 | { 77 | return CVector2(*this) += v; 78 | } 79 | 80 | CVector2 CVector2::operator-(const CVector2 & v) 81 | { 82 | return CVector2(*this) -= v; 83 | } 84 | 85 | float_t CVector2::operator*(const CVector2 & v) 86 | { 87 | return (x * v.x) + (y * v.y); 88 | } 89 | 90 | CVector2 CVector2::operator*(float_t s) 91 | { 92 | return CVector2(*this) *= s; 93 | } 94 | 95 | CVector2 CVector2::operator/(float_t s) 96 | { 97 | return CVector2(*this) /= s; 98 | } 99 | 100 | bool CVector2::IsNull() 101 | { 102 | return (IS_FLOAT_ZERO(x) && IS_FLOAT_ZERO(y)); 103 | } 104 | 105 | float_t CVector2::MagnitudeSquared() 106 | { 107 | return (x * x) + (y * y); 108 | } 109 | 110 | float_t CVector2::Magnitude() 111 | { 112 | return SQRT(MagnitudeSquared()); 113 | } 114 | 115 | void CVector2::SetMagnitude(float_t m) 116 | { 117 | if (IsNull()) 118 | throw std::overflow_error("Vector is null"); 119 | else 120 | { 121 | float_t mag(Magnitude()); 122 | x = (x * m) / mag; 123 | y = (x * m) / mag; 124 | } 125 | } 126 | 127 | CVector2 CVector2::WithMagnitude(float_t m) 128 | { 129 | CVector2 ret(*this); 130 | ret.SetMagnitude(m); 131 | return ret; 132 | } 133 | 134 | bool CVector2::IsInRange(const CVector2 & p, float_t range) 135 | { 136 | return MagnitudeSquared() <= (range * range); 137 | } 138 | 139 | CVector2 CVector2::SquareAngle() 140 | { 141 | return CVector2(-y, x); 142 | } 143 | 144 | float_t CVector2::GetAngle(const CVector2 & v) 145 | { 146 | return atan2(v.y, v.x) - atan2(x, y); 147 | } 148 | 149 | float_t CVector2::GetAngleDegrees(const CVector2 & v) 150 | { 151 | return (GetAngle(v) * 180.0f) / PI; 152 | } 153 | 154 | void CVector2::Rotate(float_t radians) 155 | { 156 | float_t cr(cos(radians)), sr(sin(radians)); 157 | (*this) = CVector2((x * cr) - (y * sr), (x * sr) + (y * cr)); 158 | } 159 | 160 | CVector2 CVector2::CreateRotated(float_t radians) 161 | { 162 | CVector2 ret(*this); 163 | ret.Rotate(radians); 164 | return ret; 165 | } 166 | 167 | void CVector2::RotateDegrees(float_t degrees) 168 | { 169 | Rotate((degrees * PI) / 180.0f); 170 | } 171 | 172 | CVector2 CVector2::CreateRotatedDegrees(float_t degrees) 173 | { 174 | CVector2 ret(*this); 175 | ret.RotateDegrees(degrees); 176 | return ret; 177 | } 178 | 179 | void CVector2::Negate() 180 | { 181 | x = -x; 182 | y = -y; 183 | } 184 | 185 | CVector2 CVector2::CreateNegated() 186 | { 187 | CVector2 ret(*this); 188 | ret.Negate(); 189 | return ret; 190 | } 191 | -------------------------------------------------------------------------------- /sdk/Quaternion.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | File: 3 | Quaternion.cpp 4 | 5 | Author: 6 | Ethem Kurt (BigETI) 7 | */ 8 | 9 | #include "../stdafx.h" 10 | 11 | const Quaternion Quaternion::identity(CVector3::null, 1.0f); 12 | 13 | Quaternion::Quaternion() : vp(CVector3::null), w(1.0f) 14 | { 15 | // 16 | } 17 | 18 | Quaternion::Quaternion(const Quaternion & q) : vp(q.vp), w(q.w) 19 | { 20 | // 21 | } 22 | 23 | Quaternion::Quaternion(const CVector3 & _vp, float_t _w) : vp(_vp), w(_w) 24 | { 25 | // 26 | } 27 | 28 | Quaternion::Quaternion(float_t x, float_t y, float_t z, float_t _w) : vp(x, y, z), w(_w) 29 | { 30 | // 31 | } 32 | 33 | Quaternion::~Quaternion() 34 | { 35 | // 36 | } 37 | 38 | Quaternion Quaternion::FromEuler(const CVector3 & euler) 39 | { 40 | float_t xh = euler.x * 0.5f, 41 | yh = euler.y * 0.5f, 42 | zh = euler.z * 0.5f, 43 | sxh = sin(xh), cxh = cos(xh), 44 | syh = sin(yh), cyh = cos(yh), 45 | szh = sin(zh), czh = cos(zh); 46 | return Quaternion(((czh * syh) * cxh) + ((szh * cyh) * sxh), ((szh * cyh) * cxh) - ((czh * syh) * sxh), ((czh * cyh) * sxh) - ((szh * syh) * cxh), ((czh * cyh) * cxh) + ((szh * syh) * sxh)); 47 | } 48 | 49 | Quaternion Quaternion::FromEulerDegrees(const CVector3 & euler_degrees) 50 | { 51 | CVector3 e(euler_degrees); 52 | e *= PI; 53 | e /= 180.0f; 54 | return FromEuler(e); 55 | } 56 | 57 | Quaternion & Quaternion::operator=(const Quaternion & q) 58 | { 59 | vp = q.vp; 60 | w = q.w; 61 | } 62 | 63 | Quaternion & Quaternion::operator*=(const Quaternion & q) 64 | { 65 | Quaternion t(((vp.x * q.w) + (q.vp.x * w)) + ((vp.y * q.vp.z) - (vp.z * q.vp.y)), 66 | ((vp.y * q.w) + (q.vp.y * w)) + ((vp.z * q.vp.x) - (vp.x * q.vp.z)), 67 | ((vp.z * q.w) + (q.vp.z * w)) + ((vp.x * q.vp.y) - (vp.y * q.vp.x)), 68 | (w * q.w) - (((vp.x * q.vp.x) + (vp.y * q.vp.y)) + (vp.z * q.vp.z))); 69 | (*this) = t; 70 | return (*this); 71 | } 72 | 73 | Quaternion & Quaternion::operator/=(const Quaternion & q) 74 | { 75 | float_t _1_ms = 1.0f / ((((q.vp.x * q.vp.x) + (q.vp.y * q.vp.y)) + (q.vp.z * q.vp.z)) + (q.w * q.w)); 76 | CVector3 _1_ms_nqvp(-q.vp.x * _1_ms, -q.vp.y * _1_ms, -q.vp.z * _1_ms); 77 | float_t _1_ms_w = q.w * _1_ms; 78 | Quaternion t(((vp.x * _1_ms_w) + (_1_ms_nqvp.x * w)) + ((vp.y * _1_ms_nqvp.z) - (vp.z * _1_ms_nqvp.y)), 79 | ((vp.y * _1_ms_w) + (_1_ms_nqvp.y * w)) + ((vp.z * _1_ms_nqvp.x) - (vp.x * _1_ms_nqvp.z)), 80 | ((vp.z * _1_ms_w) + (_1_ms_nqvp.z * w)) + ((vp.x * _1_ms_nqvp.y) - (vp.y * _1_ms_nqvp.x)), 81 | (w * _1_ms_w) - (((vp.x * _1_ms_nqvp.x) + (vp.y * _1_ms_nqvp.y)) + (vp.z * _1_ms_nqvp.z))); 82 | (*this) = t; 83 | return (*this); 84 | 85 | } 86 | 87 | Quaternion & Quaternion::operator*(const Quaternion & q) 88 | { 89 | return Quaternion(*this) * q; 90 | } 91 | 92 | Quaternion & Quaternion::operator/(const Quaternion & q) 93 | { 94 | return Quaternion(*this) / q; 95 | } 96 | 97 | void Quaternion::Conjugate() 98 | { 99 | vp.Negate(); 100 | } 101 | 102 | Quaternion Quaternion::CreateConjugated() 103 | { 104 | Quaternion ret(*this); 105 | ret.Conjugate(); 106 | return ret; 107 | } 108 | 109 | void Quaternion::Negate() 110 | { 111 | vp.Negate(); 112 | w = -w; 113 | } 114 | 115 | Quaternion Quaternion::CreateNegated() 116 | { 117 | Quaternion ret(*this); 118 | ret.Negate(); 119 | return ret; 120 | } 121 | 122 | void Quaternion::Inverse() 123 | { 124 | float_t _1_ms = 1.0f / (vp.MagnitudeSquared() + (w * w)); 125 | Quaternion t(-vp.x * _1_ms, 126 | -vp.y * _1_ms, 127 | -vp.z * _1_ms, 128 | w * _1_ms); 129 | (*this) = t; 130 | } 131 | 132 | Quaternion Quaternion::CreateInversed() 133 | { 134 | Quaternion ret(*this); 135 | ret.Inverse(); 136 | return ret; 137 | } 138 | 139 | CVector3 Quaternion::ToEuler() 140 | { 141 | float_t ys = vp.y * vp.y, 142 | ysin = 2.0f * ((w * vp.y) - (vp.z * vp.x)); 143 | ysin = ysin > 1.0f ? 1.0f : (ysin < -1.0f ? -1.0f : ysin); 144 | return CVector3(atan2(2.0f * ((w * vp.x) + (vp.y * vp.z)), 1.0f - (2.0f * ((vp.x * vp.x) + ys))), 145 | asin(ysin), 146 | atan2(2.0f * (w * vp.z + vp.x * vp.y), 1.0f - (2.0f * (ys + vp.z * vp.z)))); 147 | } 148 | 149 | CVector3 Quaternion::ToEulerDegrees() 150 | { 151 | return (ToEuler() * 180.0f) / PI; 152 | } 153 | -------------------------------------------------------------------------------- /sdk/Quaternion.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// Quaternion class 3 | /// By Ethem Kurt (BigETI) 4 | /// 5 | class Quaternion 6 | { 7 | private: 8 | /// 9 | /// Vector part 10 | /// 11 | CVector3 vp; 12 | 13 | /// 14 | /// Scalar part 15 | /// 16 | float_t w; 17 | 18 | public: 19 | 20 | /// 21 | /// Identity quaternion 22 | /// 23 | static const Quaternion identity; 24 | 25 | /// 26 | /// Default constructor 27 | /// 28 | Quaternion(); 29 | 30 | /// 31 | /// Copy constructor 32 | /// 33 | /// Quaternion to assign from 34 | Quaternion(const Quaternion &q); 35 | 36 | /// 37 | /// Constructor 38 | /// 39 | /// Vector part 40 | /// W component 41 | Quaternion(const CVector3 &_vp, float_t _w); 42 | 43 | /// 44 | /// Constructor 45 | /// 46 | /// Vector part X 47 | /// Vector part Y 48 | /// Vector part Z 49 | /// W component 50 | Quaternion(float_t x, float_t y, float_t z, float_t _w); 51 | 52 | /// 53 | /// Destructor 54 | /// 55 | ~Quaternion(); 56 | 57 | /// 58 | /// Create quaternion from euler angles (radians) 59 | /// 60 | /// Euler angles (radians) 61 | /// Quaternion 62 | static Quaternion FromEuler(const CVector3 &euler); 63 | 64 | /// 65 | /// Create quaternion from euler angles (degrees) 66 | /// 67 | /// Euler angles (degrees) 68 | /// Quaternion 69 | static Quaternion FromEulerDegrees(const CVector3 &euler_degrees); 70 | 71 | /// 72 | /// Assign quaternion 73 | /// 74 | /// Quaternion to assign from 75 | /// Itself 76 | Quaternion &operator=(const Quaternion &q); 77 | 78 | /// 79 | /// Multiply quaternion (This is used to stack rotations) 80 | /// 81 | /// Quaternion to multiply with and assign 82 | /// Itself 83 | Quaternion &operator*=(const Quaternion &q); 84 | 85 | /// 86 | /// Divide quaternion (This is used to revert rotation stacks) 87 | /// 88 | /// Quaternion to divide with and assign 89 | /// Itself 90 | Quaternion &operator/=(const Quaternion &q); 91 | 92 | /// 93 | /// Multiply quaternion (This is used to stack rotations) 94 | /// 95 | /// Quaternion to multiply with 96 | /// Result quaternion 97 | Quaternion &operator*(const Quaternion &q); 98 | 99 | /// 100 | /// Divide quaternion (This is used to revert rotation stacks) 101 | /// 102 | /// Quaternion to divide with 103 | /// Result quaternion 104 | Quaternion &operator/(const Quaternion &q); 105 | 106 | /// 107 | /// Conjugate quaternion 108 | /// 109 | void Conjugate(); 110 | 111 | /// 112 | /// Create conjugate quaternion 113 | /// 114 | /// Conjugated quaternion 115 | Quaternion CreateConjugated(); 116 | 117 | /// 118 | /// Negate quaternion 119 | /// 120 | void Negate(); 121 | 122 | /// 123 | /// Create negated quaternion 124 | /// 125 | /// Negated quaternion 126 | Quaternion CreateNegated(); 127 | 128 | /// 129 | /// Inverse quaternion 130 | /// 131 | void Inverse(); 132 | 133 | /// 134 | /// Create inversed quaternion 135 | /// 136 | /// Inversed quaternion 137 | Quaternion CreateInversed(); 138 | 139 | /// 140 | /// Get euler angles (radians) 141 | /// 142 | CVector3 ToEuler(); 143 | 144 | /// 145 | /// Get euler angles (degrees) 146 | /// 147 | CVector3 ToEulerDegrees(); 148 | }; -------------------------------------------------------------------------------- /sdk/CVector3.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | File: 3 | CVector3.cpp 4 | 5 | Author: 6 | Ethem Kurt (BigETI) 7 | */ 8 | 9 | #include "../stdafx.h" 10 | 11 | const CVector3 CVector3::unit(1.0f, 1.0f, 1.0f); 12 | const CVector3 CVector3::null(0.0f, 0.0f, 0.0f); 13 | const CVector3 CVector3::up(0.0f, 1.0f, 0.0f); 14 | const CVector3 CVector3::down(0.0f, -1.0f, 0.0f); 15 | const CVector3 CVector3::left(-1.0f, 0.0f, 0.0f); 16 | const CVector3 CVector3::right(1.0f, 0.0f, 0.0f); 17 | const CVector3 CVector3::front(0.0f, 0.0f, 1.0f); 18 | const CVector3 CVector3::back(0.0f, 0.0f, -1.0f); 19 | 20 | //atan2(crossproduct.length,scalarproduct) 21 | 22 | CVector3::CVector3() : x(0.0f), y(0.0f), z(0.0f) 23 | { 24 | // 25 | } 26 | 27 | CVector3::CVector3(const CVector3 & v) : x(v.x), y(v.y), z(v.z) 28 | { 29 | // 30 | } 31 | 32 | CVector3::CVector3(float_t _x, float_t _y, float_t _z) : x(_x), y(_y), z(_z) 33 | { 34 | // 35 | } 36 | 37 | CVector3::~CVector3() 38 | { 39 | // 40 | } 41 | 42 | CVector3 & CVector3::operator=(const CVector3 & v) 43 | { 44 | x = v.x; 45 | y = v.y; 46 | z = v.z; 47 | return (*this); 48 | } 49 | 50 | CVector3 & CVector3::operator+=(const CVector3 & v) 51 | { 52 | x += v.x; 53 | y += v.y; 54 | z += v.z; 55 | return (*this); 56 | } 57 | 58 | CVector3 & CVector3::operator-=(const CVector3 & v) 59 | { 60 | x -= v.x; 61 | y -= v.y; 62 | z -= v.z; 63 | return (*this); 64 | } 65 | 66 | CVector3 & CVector3::operator*=(float_t s) 67 | { 68 | x *= s; 69 | y *= s; 70 | z *= s; 71 | return (*this); 72 | } 73 | 74 | CVector3 & CVector3::operator/=(float_t s) 75 | { 76 | if (IS_FLOAT_ZERO(s)) 77 | throw std::overflow_error("Division by zero"); 78 | x /= s; 79 | y /= s; 80 | z /= s; 81 | return (*this); 82 | } 83 | 84 | CVector3 CVector3::operator+(const CVector3 & v) 85 | { 86 | return CVector3(*this) += v; 87 | } 88 | 89 | CVector3 CVector3::operator-(const CVector3 & v) 90 | { 91 | return CVector3(*this) -= v; 92 | } 93 | 94 | float_t CVector3::operator*(const CVector3 & v) 95 | { 96 | return (x * v.x) + (y * v.y) + (z * v.z); 97 | } 98 | 99 | CVector3 CVector3::operator*(float_t s) 100 | { 101 | return CVector3(*this) *= s; 102 | } 103 | 104 | CVector3 CVector3::operator/(float_t s) 105 | { 106 | return CVector3(*this) *= s; 107 | } 108 | 109 | bool CVector3::IsNull() 110 | { 111 | return (IS_FLOAT_ZERO(x) && IS_FLOAT_ZERO(y) && IS_FLOAT_ZERO(z)); 112 | } 113 | 114 | float_t CVector3::MagnitudeSquared() 115 | { 116 | return (x * x) + (y * y) + (z * z); 117 | } 118 | 119 | float_t CVector3::Magnitude() 120 | { 121 | return SQRT(MagnitudeSquared()); 122 | } 123 | 124 | void CVector3::SetMagnitude(float_t m) 125 | { 126 | if (IsNull()) 127 | throw std::overflow_error("Vector is null"); 128 | else 129 | { 130 | float_t mag(Magnitude()); 131 | x = (x * m) / mag; 132 | y = (y * m) / mag; 133 | z = (z * m) / mag; 134 | } 135 | } 136 | 137 | CVector3 CVector3::WithMagnitude(float_t m) 138 | { 139 | CVector3 ret(*this); 140 | ret.SetMagnitude(m); 141 | return ret; 142 | } 143 | 144 | bool CVector3::IsInRange(const CVector3 & p, float_t range) 145 | { 146 | return MagnitudeSquared() <= (range * range); 147 | } 148 | 149 | CVector3 CVector3::CrossProduct(const CVector3 & v) 150 | { 151 | return CVector3((y * v.z) - (z * v.y), (z * v.x) - (x * v.z), (x * v.y) - (y * v.x)); 152 | } 153 | 154 | float_t CVector3::GetAngle(const CVector3 & v) 155 | { 156 | return atan2(CrossProduct(v).Magnitude(), (*this) * v); 157 | } 158 | 159 | float_t CVector3::GetAngleDegrees(const CVector3 & v) 160 | { 161 | return (GetAngle(v) * 180.0f) / PI; 162 | } 163 | 164 | void CVector3::RotateAround(const CVector3 & n, float_t radians) 165 | { 166 | float_t cr(cos(radians)); 167 | CVector3 u(unit); 168 | (*this) = CVector3(((*this) * cr) + (u.CrossProduct(*this) * sin(radians)) + u * (u * (*this)) * (1 - cr)); 169 | } 170 | 171 | CVector3 CVector3::CreateRotatedAround(const CVector3 & n, float_t radians) 172 | { 173 | CVector3 ret(*this); 174 | ret.RotateAround(n, radians); 175 | return ret; 176 | } 177 | 178 | void CVector3::RotateAroundDegrees(const CVector3 & n, float_t degrees) 179 | { 180 | RotateAround(n, (degrees * PI) / 180.0f); 181 | } 182 | 183 | CVector3 CVector3::CreateRotatedAroundDegrees(const CVector3 & n, float_t degrees) 184 | { 185 | CVector3 ret(*this); 186 | ret.RotateAroundDegrees(n, degrees); 187 | return ret; 188 | } 189 | 190 | void CVector3::Negate() 191 | { 192 | x = -x; 193 | y = -y; 194 | z = -z; 195 | } 196 | 197 | CVector3 CVector3::CreateNegated() 198 | { 199 | CVector3 ret(*this); 200 | ret.Negate(); 201 | return ret; 202 | } 203 | -------------------------------------------------------------------------------- /sdk/APICheckpoint.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | namespace API 7 | { 8 | class Checkpoint 9 | { 10 | public: 11 | /// 12 | /// Creates a Checkpoint 13 | /// 14 | /// The you wish the checkpoint to be at. 15 | /// The position the checkpoint points too. 16 | /// The type of checkpoint, pastebin.com/raw/iG0NkEhF 17 | /// The radius of the checkpoint 18 | /// The color of the checkpoint 19 | /// The reserved type of checkpoint, pastebin.com/raw/iG0NkEhF 20 | /// The checkpoint server entity id 21 | DLL_PUBLIC_I static const int Create(const CVector3 position, const CVector3 pointto, const int type, const float radius, const Color color, const int reserved); 22 | 23 | /// 24 | /// Displays the checkpoint for a player 25 | /// 26 | /// The entity of the checkpoint you wish to display. 27 | /// The entity of the player you wish to display the checkpoint too. [Tip: -1 will display it too all connected players] 28 | DLL_PUBLIC_I static void Show(const int checkpointentity, const int playerentity); 29 | 30 | /// 31 | /// Hides the checkpoint for a player 32 | /// 33 | /// The entity of the checkpoint you wish to hide. 34 | /// The entity of the player you wish to hide the checkpoint from. [Tip: -1 will hide it from all connected players] 35 | DLL_PUBLIC_I static void Hide(const int checkpointentity, const int playerentity); 36 | 37 | /// 38 | /// Gets the checkpoints near height 39 | /// 40 | /// The entity of the checkpoint. 41 | /// The checkpoint near height 42 | DLL_PUBLIC_I static const float GetNearHeight(const int checkpointentity); 43 | 44 | /// 45 | /// Sets the checkpoints near distance height 46 | /// 47 | /// The entity of the checkpoint. 48 | /// The height 49 | DLL_PUBLIC_I static void SetNearHeight(const int checkpointentity, const float height); 50 | 51 | /// 52 | /// Gets the checkpoints far height 53 | /// 54 | /// The entity of the checkpoint. 55 | /// The checkpoint far height 56 | DLL_PUBLIC_I static const float GetFarHeight(const int checkpointentity); 57 | 58 | /// 59 | /// Sets the checkpoints far distance height 60 | /// 61 | /// The entity of the checkpoint. 62 | /// The height 63 | DLL_PUBLIC_I static void SetFarHeight(const int checkpointentity, const float height); 64 | }; 65 | } 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | class Checkpoint { 71 | private: 72 | int Entity; 73 | public: 74 | const int GetEntity() { return Entity; } 75 | 76 | void Create(const CVector3 position, const CVector3 pointto, const int type, const float radius, const Color color, const int reserved) 77 | { 78 | Entity = API::Checkpoint::Create(position, pointto, type, radius, color, reserved); 79 | } 80 | 81 | void Destroy() 82 | { 83 | API::Entity::Destroy(Entity); 84 | Entity = -1; 85 | } 86 | 87 | const CVector3 GetPosition() 88 | { 89 | return API::Entity::GetPosition(Entity); 90 | } 91 | 92 | void SetPosition(const CVector3 position) 93 | { 94 | API::Entity::SetPosition(Entity, position); 95 | } 96 | 97 | void Show(const int playerentity) 98 | { 99 | API::Checkpoint::Show(Entity, playerentity); 100 | } 101 | 102 | void Hide(const int playerentity) 103 | { 104 | API::Checkpoint::Hide(Entity, playerentity); 105 | } 106 | 107 | const float GetNearHeight() 108 | { 109 | return API::Checkpoint::GetNearHeight(Entity); 110 | } 111 | 112 | void SetFarHeight(const float height) 113 | { 114 | API::Checkpoint::SetFarHeight(Entity, height); 115 | } 116 | 117 | const float GetFarHeight() 118 | { 119 | return API::Checkpoint::GetFarHeight(Entity); 120 | } 121 | 122 | void SetNearHeight(const float height) 123 | { 124 | API::Checkpoint::SetNearHeight(Entity, height); 125 | } 126 | 127 | const float GetViewDistance() 128 | { 129 | return API::Entity::GetViewDistance(Entity); 130 | } 131 | 132 | void SetViewDistance(const float distance) 133 | { 134 | API::Entity::SetViewDistance(Entity, distance); 135 | } 136 | }; -------------------------------------------------------------------------------- /sdk/APIPlayer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | namespace API 7 | { 8 | class Player 9 | { 10 | public: 11 | /// 12 | /// Gets the model of the player entity. 13 | /// 14 | /// The entity of the player you wish to get the model of. 15 | /// The player model the player currently has. 16 | DLL_PUBLIC_I static const std::wstring GetModel(const int entity); 17 | 18 | /// 19 | /// Sets the model of the player entity. 20 | /// 21 | /// The entity of the player you wish to set the model of. 22 | /// The model you wish to set on the player. 23 | DLL_PUBLIC_I static void SetModel(const int entity, const std::wstring model); 24 | 25 | /// 26 | /// Gets the username of the player entity. 27 | /// 28 | /// The entity of the player to get the username of. 29 | DLL_PUBLIC_I static const std::string GetUsername(const int entity); 30 | 31 | /// 32 | /// Gets the players controls state. 33 | /// 34 | /// The entity of the player. 35 | /// The disabled controls state. 36 | DLL_PUBLIC_I static const bool IsControllable(const int entity); 37 | 38 | /// 39 | /// Set the players controls state. 40 | /// 41 | /// The entity of the player. 42 | /// The state to set the controls disabled state in. 43 | /// Wether the player should be frozen in place. 44 | DLL_PUBLIC_I static void SetControllable(const int entity, bool disablecontrols, bool frozen = true); 45 | 46 | }; 47 | } 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | class Player { 53 | private: 54 | int Entity; 55 | public: 56 | const int GetEntity() { return Entity; } 57 | void SetEntity(const int entity) { Entity = entity; } 58 | 59 | const CVector3 GetPosition() 60 | { 61 | return API::Entity::GetPosition(Entity); 62 | } 63 | 64 | void SetPosition(const CVector3 position) 65 | { 66 | API::Entity::SetPosition(Entity, position); 67 | } 68 | 69 | const CVector3 GetRotation() 70 | { 71 | return API::Entity::GetRotation(Entity); 72 | } 73 | 74 | void SetRotation(const CVector3 position) 75 | { 76 | API::Entity::SetRotation(Entity, position); 77 | } 78 | 79 | const PedComponent GetPedComponent(const int componentid) 80 | { 81 | return API::Entity::GetPedComponent(Entity, componentid); 82 | } 83 | 84 | void SetPedComponent(const int componentid, const PedComponent component) 85 | { 86 | API::Entity::SetPedComponent(Entity, componentid, component); 87 | } 88 | 89 | const PedHeadBlend GetPedHeadBlend() 90 | { 91 | return API::Entity::GetPedHeadBlend(Entity); 92 | } 93 | 94 | void SetPedHeadBlend(const PedHeadBlend headblend) 95 | { 96 | API::Entity::SetPedHeadBlend(Entity, headblend); 97 | } 98 | 99 | const PedHeadOverlay GetPedHeadOverlay(const int overlayid) 100 | { 101 | return API::Entity::GetPedHeadOverlay(Entity, overlayid); 102 | } 103 | 104 | void SetPedHeadOverlay(const int overlayid, const PedHeadOverlay overlay) 105 | { 106 | API::Entity::SetPedHeadOverlay(Entity, overlayid, overlay); 107 | } 108 | 109 | const PedProp GetPedProp(const int compotentid) 110 | { 111 | return API::Entity::GetPedProp(Entity, compotentid); 112 | } 113 | 114 | void SetPedProp(const int compotentid, const PedProp prop) 115 | { 116 | API::Entity::SetPedProp(Entity, compotentid, prop); 117 | } 118 | 119 | const float GetPedFaceFeature(const int index) 120 | { 121 | return API::Entity::GetPedFaceFeature(Entity, index); 122 | } 123 | 124 | void SetPedFaceFeature(const int index, const float scale) 125 | { 126 | API::Entity::SetPedFaceFeature(Entity, index, scale); 127 | } 128 | 129 | const float GetViewDistance() 130 | { 131 | return API::Entity::GetViewDistance(Entity); 132 | } 133 | 134 | void SetViewDistance(const float distance) 135 | { 136 | API::Entity::SetViewDistance(Entity, distance); 137 | } 138 | 139 | const std::wstring GetModel() 140 | { 141 | return API::Player::GetModel(Entity); 142 | } 143 | 144 | void SetModel(const std::wstring model) 145 | { 146 | API::Player::SetModel(Entity, model); 147 | } 148 | 149 | // Sends a Message above the map for this player. 150 | void ShowMessageAboveMap(const std::wstring message, const std::wstring pic, const int icontype, const std::wstring sender, const std::wstring subject) 151 | { 152 | API::Visual::ShowMessageAboveMapToPlayer(Entity, message, pic, icontype, sender, subject); 153 | } 154 | 155 | void SendChatMessage(const std::string message) 156 | { 157 | API::Visual::SendChatMessageToPlayer(Entity, message); 158 | } 159 | 160 | const std::string GetUsername() 161 | { 162 | API::Player::GetUsername(Entity); 163 | } 164 | 165 | void ShowCursor(const bool show) 166 | { 167 | API::Visual::ShowCursor(Entity, show); 168 | } 169 | 170 | void LoadURL(const std::string url, const std::string appcode = "", const bool remote = false) 171 | { 172 | API::CEF::LoadURL(Entity, url, appcode, remote); 173 | } 174 | 175 | void JavaScriptCall(std::string call) 176 | { 177 | API::CEF::JavaScriptCall(Entity, call); 178 | } 179 | 180 | const bool IsControllable() 181 | { 182 | return API::Player::IsControllable(Entity); 183 | } 184 | 185 | void SetControllable(bool disablecontrols, bool frozen = true) 186 | { 187 | API::Player::SetControllable(Entity, disablecontrols, frozen); 188 | } 189 | }; -------------------------------------------------------------------------------- /sdk/CMaths.h: -------------------------------------------------------------------------------- 1 | #define DOUBLE_PI (M_PI * 2) 2 | #define PI M_PI 3 | #define HALF_PI M_PI_2 4 | #define RADS_PER_DEG (PI / 180.0f) 5 | #define DEGS_PER_RAD (180.0f / PI) 6 | 7 | #define EULER M_E 8 | #define EPSILON std::numeric_limits::epsilon() 9 | #define IS_FLOAT_ZERO(_f) (((_f) <= EPSILON) && ((_f) >= (-EPSILON))) 10 | 11 | #ifdef FIVEMP_DOUBLE_PRECISION 12 | #define SQRT(_v) sqrt(_v) 13 | typedef double float_t; 14 | #else 15 | #define SQRT(_v) sqrtf(_v) 16 | typedef float float_t; 17 | #endif 18 | 19 | namespace Math 20 | { 21 | static float WrapAround(float fValue, float fHigh) 22 | { 23 | return fValue - (fHigh * floor((float)(fValue / fHigh))); 24 | } 25 | 26 | static float ConvertRadiansToDegrees(float fRotation) 27 | { 28 | return WrapAround((fRotation * 180.0f / PI + 360.0f), 360.0f); 29 | } 30 | 31 | static CVector3 ConvertRadiansToDegrees(const CVector3 &vecRotation) 32 | { 33 | return CVector3(ConvertRadiansToDegrees(vecRotation.x), 34 | ConvertRadiansToDegrees(vecRotation.y), 35 | ConvertRadiansToDegrees(vecRotation.z)); 36 | } 37 | 38 | static float ConvertDegreesToRadians(float fRotation) 39 | { 40 | return WrapAround((fRotation * PI / 180.0f + 2 * PI), DOUBLE_PI); 41 | } 42 | 43 | static CVector3 ConvertDegreesToRadians(const CVector3 &vecRotation) 44 | { 45 | return CVector3(ConvertDegreesToRadians(vecRotation.x), 46 | ConvertDegreesToRadians(vecRotation.y), 47 | ConvertDegreesToRadians(vecRotation.z)); 48 | } 49 | 50 | static float GetOffsetDegrees(float a, float b) 51 | { 52 | float c = (b > a) ? b - a : 0.0f - (a - b); 53 | 54 | if (c > 180.0f) 55 | c = 0.0f - (360.0f - c); 56 | else if (c <= -180.0f) 57 | c = (360.0f + c); 58 | 59 | return c; 60 | } 61 | 62 | static CVector3 GetOffsetDegrees(const CVector3& a, const CVector3& b) 63 | { 64 | return CVector3(GetOffsetDegrees(a.x, b.x), GetOffsetDegrees(a.y, b.y), GetOffsetDegrees(a.z, b.z)); 65 | } 66 | 67 | template 68 | static T Lerp(const T& start, float fAlpha, const T& end) 69 | { 70 | return (end - start) * fAlpha + start; 71 | } 72 | 73 | // Clamps a value between two other values 74 | template 75 | static T Clamp(const T& min, const T& a, const T& max) 76 | { 77 | if (a < min) 78 | return min; 79 | 80 | if (a > max) 81 | return max; 82 | 83 | return a; 84 | } 85 | 86 | // Find the relative position of fPos between fStart and fEnd 87 | static const float Unlerp(const double fStart, const double fPos, const double fEnd) 88 | { 89 | // Avoid dividing by 0 (results in INF values) 90 | if (fStart == fEnd) return 1.0f; 91 | 92 | return (float)((fPos - fStart) / (fEnd - fStart)); 93 | } 94 | 95 | // Find the relative position of fPos between fStart and fEnd 96 | // and clamp it between 0 and 1 avoiding extrapolation 97 | static const float UnlerpClamped(const double fStart, const double fPos, const double fEnd) 98 | { 99 | return Clamp(0.0f, Unlerp(fStart, fPos, fEnd), 1.0f); 100 | } 101 | 102 | // Find the distance between two 2D points 103 | static float GetDistanceBetweenPoints2D(float x, float y, float xx, float yy) 104 | { 105 | float newx = (xx - x); 106 | float newy = (yy - y); 107 | return sqrt(newx * newx + newy * newy); 108 | } 109 | 110 | // Find the distance between two 3D points 111 | static float GetDistanceBetweenPoints3D(float x, float y, float z, float xx, float yy, float zz) 112 | { 113 | float newx = (xx - x); 114 | float newy = (yy - y); 115 | float newz = (zz - z); 116 | return sqrt(newx * newx + newy * newy + newz * newz); 117 | } 118 | 119 | // Check if a 2D point is within the specified circle 120 | static bool IsPointInCircle(float circleX, float circleY, float circleDistance, float pointX, float pointY) 121 | { 122 | float distancebetween = GetDistanceBetweenPoints2D(circleX, circleY, pointX, pointY); 123 | 124 | if (distancebetween < circleDistance) 125 | return true; 126 | 127 | return false; 128 | } 129 | 130 | // Check if a 3D point is within the specified tube 131 | static bool IsPointInTube(float tubeX, float tubeY, float tubeZ, float tubeHeight, float tubeRadius, float pointX, float pointY, float pointZ) 132 | { 133 | float distancebetween = GetDistanceBetweenPoints2D(tubeX, tubeY, pointX, pointY); 134 | 135 | if (distancebetween < tubeRadius && pointZ < tubeZ + tubeHeight && pointZ >= tubeZ) 136 | return true; 137 | 138 | return false; 139 | } 140 | 141 | // Check if a 3D point is within the specified ball 142 | static bool IsPointInBall(float ballX, float ballY, float ballZ, float ballRadius, float pointX, float pointY, float pointZ) 143 | { 144 | float distancebetween = GetDistanceBetweenPoints3D(ballX, ballY, ballZ, pointX, pointY, pointZ); 145 | 146 | if (distancebetween < ballRadius) 147 | return true; 148 | 149 | return false; 150 | } 151 | 152 | // Check if a 2D point is within the specified 2D area 153 | static bool IsPointInArea(float areaX, float areaY, float areaX2, float areaY2, float pointX, float pointY) 154 | { 155 | if (pointX >= areaX && pointX <= areaX2 && pointY >= areaY && pointY <= areaY2) 156 | return true; 157 | 158 | return false; 159 | } 160 | 161 | // Check if a 3D point is within the specified 3D area 162 | static bool IsPointInArea(float fAreaX, float fAreaY, float fAreaZ, float fAreaX2, float fAreaY2, float fAreaZ2, float fPointX, float fPointY, float fPointZ) 163 | { 164 | if ((fPointX >= fAreaX && fPointX <= fAreaX2) && (fPointY >= fAreaY && fPointY <= fAreaY2) && (fPointZ >= fAreaZ && fPointZ <= fAreaZ2)) 165 | return true; 166 | 167 | return false; 168 | } 169 | 170 | // Check if a 3D point is within the specified cuboid 171 | static bool IsPointInCuboid(float areaX, float areaY, float areaZ, float areaX2, float areaY2, float areaZ2, float pointX, float pointY, float pointZ) 172 | { 173 | if (pointX >= areaX && pointX <= areaX2 && pointY >= areaY && pointY <= areaY2 && pointZ >= areaZ && pointZ <= areaZ2) 174 | return true; 175 | 176 | return false; 177 | } 178 | 179 | // polyX and polyY as arrays 180 | static bool IsPointInPolygon(int nvert, float *polyX, float *polyY, float pointX, float pointY) 181 | { 182 | bool bValid = false; 183 | 184 | for (int i = 0, j = (nvert - 1); i < nvert; j = i++) 185 | { 186 | if (((polyY[i] > pointY) != (polyY[j] > pointY)) && (pointX < (polyX[j] - polyX[i]) * (pointY - polyY[i]) / (polyY[j] - polyY[i]) + polyX[i])) 187 | bValid = !bValid; 188 | } 189 | 190 | return bValid; 191 | } 192 | }; -------------------------------------------------------------------------------- /sdk/CVector2.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// CVector2 class 3 | /// By Ethem Kurt (BigETI) 4 | /// 5 | class CVector2 6 | { 7 | public: 8 | /// 9 | /// X component 10 | /// 11 | float_t x; 12 | 13 | /// 14 | /// Y component 15 | /// 16 | float_t y; 17 | 18 | /// 19 | /// Unit vector 20 | /// 21 | static const CVector2 unit; 22 | 23 | /// 24 | /// Null vector 25 | /// 26 | static const CVector2 null; 27 | 28 | /// 29 | /// Up vector 30 | /// 31 | static const CVector2 up; 32 | 33 | /// 34 | /// Down vector 35 | /// 36 | static const CVector2 down; 37 | 38 | /// 39 | /// Left vector 40 | /// 41 | static const CVector2 left; 42 | 43 | /// 44 | /// Right vector 45 | /// 46 | static const CVector2 right; 47 | 48 | /// 49 | /// Default constructor 50 | /// 51 | CVector2(); 52 | 53 | /// 54 | /// Copy constructor 55 | /// 56 | /// Vector to assign from 57 | CVector2(const CVector2 &v); 58 | 59 | /// 60 | /// Constructor 61 | /// 62 | /// X component 63 | /// Y component 64 | CVector2(float_t _x, float_t _y); 65 | 66 | /// 67 | /// Destructor 68 | /// 69 | ~CVector2(); 70 | 71 | /// 72 | /// Assign vector 73 | /// 74 | /// Vector to assign from 75 | /// Itself 76 | CVector2 &operator=(const CVector2 &v); 77 | 78 | /// 79 | /// Add Vector 80 | /// 81 | /// Add from vector and assign result 82 | /// Itself 83 | CVector2 &operator+=(const CVector2 &v); 84 | 85 | /// 86 | /// Subtract vector 87 | /// 88 | /// Add from vector and assign result 89 | /// Itself 90 | CVector2 &operator-=(const CVector2 &v); 91 | 92 | /// 93 | /// Multiply vector 94 | /// 95 | /// Scalar to multiply with and assign result 96 | /// Itself 97 | CVector2 &operator*=(float_t s); 98 | 99 | /// 100 | /// Divide vector 101 | /// 102 | /// Scalar to divide with and assign result 103 | /// Itself 104 | CVector2 &operator/=(float_t s); 105 | 106 | /// 107 | /// Add vector 108 | /// 109 | /// Vector to add 110 | /// Result vector 111 | CVector2 operator+(const CVector2 &v); 112 | 113 | /// 114 | /// Subtract vector 115 | /// 116 | /// Vector to subtract 117 | /// Result vector 118 | CVector2 operator-(const CVector2 &v); 119 | 120 | /// 121 | /// Vector dot product 122 | /// 123 | /// Vector for dot product 124 | /// Dot product 125 | float_t operator*(const CVector2 &v); 126 | 127 | /// 128 | /// Add vector 129 | /// 130 | /// Scalar to multiply with 131 | /// Result vector 132 | CVector2 operator*(float_t s); 133 | 134 | /// 135 | /// Divide vector 136 | /// 137 | /// Scalar to divide with 138 | /// Result vector 139 | CVector2 operator/(float_t s); 140 | 141 | /// 142 | /// Is vector null 143 | /// 144 | /// If null then true, otherwise false 145 | bool IsNull(); 146 | 147 | /// 148 | /// Get magnitude of vector squared (faster than CVector2::Magnitude()) 149 | /// 150 | /// Magnitude squared 151 | float_t MagnitudeSquared(); 152 | 153 | /// 154 | /// Get magnitude of vector (slower than CVector2::MagnitudeSquared()) 155 | /// 156 | /// Magnitude 157 | float_t Magnitude(); 158 | 159 | /// 160 | /// Set magnitude of vector 161 | /// 162 | /// Magnitude 163 | void SetMagnitude(float_t m); 164 | 165 | /// 166 | /// Create vector with magnitude 167 | /// 168 | /// Magnitude 169 | /// Vector with set magnitude 170 | CVector2 WithMagnitude(float_t m); 171 | 172 | /// 173 | /// Is point in range 174 | /// 175 | /// Point to check 176 | /// Range for check 177 | /// If is point in range true, otherwise false 178 | bool IsInRange(const CVector2 &p, float_t range); 179 | 180 | /// 181 | /// Get square angled vector 182 | /// 183 | /// Square angeled vector 184 | CVector2 SquareAngle(); 185 | 186 | /// 187 | /// Get angle between two vectors (radians) 188 | /// 189 | /// Vector to get angle between 190 | /// Angle between 2 vectors (radians) 191 | float_t GetAngle(const CVector2 &v); 192 | 193 | /// 194 | /// Get angle between two vectors (degrees) 195 | /// 196 | /// Vector to get angle between 197 | /// Angle between 2 vectors (degrees) 198 | float_t GetAngleDegrees(const CVector2 &v); 199 | 200 | /// 201 | /// Rotate vector (radians) 202 | /// 203 | /// Radians to rotate 204 | void Rotate(float_t radians); 205 | 206 | /// 207 | /// Create rotated vector (radians) 208 | /// 209 | /// Radians to rotate 210 | /// Rotated vector 211 | CVector2 CreateRotated(float_t radians); 212 | 213 | /// 214 | /// Rotate vector (degrees) 215 | /// 216 | /// Degrees to rotate 217 | void RotateDegrees(float_t degrees); 218 | 219 | /// 220 | /// Create rotated vector (degrees) 221 | /// 222 | /// Degrees to rotate 223 | /// Rotated vector 224 | CVector2 CreateRotatedDegrees(float_t degrees); 225 | 226 | /// 227 | /// Negate vector 228 | /// 229 | void Negate(); 230 | 231 | /// 232 | /// Create negated vector 233 | /// 234 | /// Negated vector 235 | CVector2 CreateNegated(); 236 | 237 | }; -------------------------------------------------------------------------------- /sdk/APIEntity.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | namespace API 7 | { 8 | class Entity 9 | { 10 | public: 11 | /// 12 | /// Destroys/Removes a entity from the server 13 | /// 14 | /// The entity you wish to destroy. 15 | DLL_PUBLIC_I static void Destroy(const int entity); 16 | 17 | /// 18 | /// Gets the position of the entity. 19 | /// 20 | /// The entity you wish to get the position off. 21 | /// The CVector3 position of the entity 22 | DLL_PUBLIC_I static const CVector3 GetPosition(const int entity); 23 | 24 | /// 25 | /// Sets the position of the entity. 26 | /// 27 | /// The entity you wish to set the position off. 28 | /// The position you wish to set the entity at. 29 | /// 30 | DLL_PUBLIC_I static void SetPosition(const int entity, const CVector3 position); 31 | 32 | /// 33 | /// Gets the rotation of the entity. 34 | /// 35 | /// The entity you wish to get the rotation off. 36 | /// The CVector3 rotation of the entity 37 | DLL_PUBLIC_I static const CVector3 GetRotation(const int entity); 38 | 39 | /// 40 | /// Sets the rotation of the entity. 41 | /// 42 | /// The entity you wish to set the rotation off. 43 | /// The rotation you wish to set they entity at. 44 | /// 45 | DLL_PUBLIC_I static void SetRotation(const int entity, const CVector3 rotation); 46 | 47 | /// 48 | /// Gets the Ped Component data of the player or npc entity. 49 | /// 50 | /// The entity of the player or npc you wish to get their model Components. 51 | /// The componentid of the component you wish to get. 52 | /// The PlayerComponents of the desired player/npc and component 53 | DLL_PUBLIC_I static const PedComponent GetPedComponent(const int entity, const int componentid); 54 | 55 | /// 56 | /// Sets the Ped Component data of the player or npc entity. 57 | /// 58 | /// The entity of the player or npc you wish to set their model Components. 59 | /// The componentid of the component you wish to set. 60 | /// The component structure of the component you wish to set. 61 | DLL_PUBLIC_I static void SetPedComponent(const int entity, const int componentid, const PedComponent component); 62 | 63 | /// 64 | /// Gets the head blend data of the player or npc entity. 65 | /// 66 | /// The entity of the player or npc you wish to get their model headblend data. 67 | /// The headblend data of the players model 68 | DLL_PUBLIC_I static const PedHeadBlend GetPedHeadBlend(const int entity); 69 | 70 | /// 71 | /// Sets the head blend data of the player or npc entity. 72 | /// 73 | /// The entity of the player or npc you wish to set their model headblend. 74 | /// The headblend data. 75 | DLL_PUBLIC_I static void SetPedHeadBlend(const int entity, const PedHeadBlend headblend); 76 | 77 | /// 78 | /// Gets the headoverlay data of the player or npc entity. 79 | /// 80 | /// The entity of the player or npc you wish to get their model headoverlay data. 81 | /// The overlay id you wish to get the data off. 82 | /// The headoverlay data of the overlay id 83 | DLL_PUBLIC_I static const PedHeadOverlay GetPedHeadOverlay(const int entity, const int overlayid); 84 | 85 | /// 86 | /// Sets the headoverlay data of the player or npc entity. 87 | /// 88 | /// The entity of the player or npc you wish to set their model headoverlay data. 89 | /// The overlay id you wish to set the data off. 90 | /// The overlay data. 91 | DLL_PUBLIC_I static void SetPedHeadOverlay(const int entity, const int overlayid, const PedHeadOverlay overlay); 92 | 93 | /// 94 | /// Gets the prop data of the player or npc entity. 95 | /// 96 | /// The entity of the player or npc you wish to Get their model prop data. 97 | /// The compotent id you wish to get the data off. 98 | /// The prop data. 99 | DLL_PUBLIC_I static const PedProp GetPedProp(const int entity, const int compotentid); 100 | 101 | /// 102 | /// Sets the prop data of the player or npc entity. 103 | /// 104 | /// The entity of the player or npc you wish to set their model prop data. 105 | /// The compotent id you wish to set the data off. 106 | /// The prop data. 107 | DLL_PUBLIC_I static void SetPedProp(const int entity, const int compotentid, const PedProp prop); 108 | 109 | /// 110 | /// Gets the face feature data of the player or npc entity. 111 | /// 112 | /// The entity of the player or npc you wish to get their model face feature data. 113 | /// The index you wish to get the data off (Index can be 0 - 19). 114 | /// The face feature scale. (Scale ranges from -1.0 to 1.0) 115 | DLL_PUBLIC_I static const float GetPedFaceFeature(const int entity, const int feature); 116 | 117 | /// 118 | /// Sets the face feature data of the player or npc entity. 119 | /// 120 | /// The entity of the player or npc you wish to set their model face feature data. 121 | /// The feature you wish to set the data off (Index can be 0 - 19). 122 | /// The face feature scale. (Scale ranges from -1.0 to 1.0) 123 | DLL_PUBLIC_I static void SetPedFaceFeature(const int entity, const int feature, const float scale); 124 | 125 | /// 126 | /// Gets the view distance of the entity. 127 | /// 128 | /// The entity you want to get the view distance off. 129 | /// The view distance. 130 | DLL_PUBLIC static const float GetViewDistance(const int entity); 131 | 132 | /// 133 | /// Sets the view distance of the entity. 134 | /// 135 | /// The entity you want to set the view distance off. 136 | /// The distance. 137 | DLL_PUBLIC static void SetViewDistance(const int entity, const float distance); 138 | }; 139 | } 140 | #ifdef __cplusplus 141 | } 142 | #endif -------------------------------------------------------------------------------- /sdk/CVector3.h: -------------------------------------------------------------------------------- 1 | #ifndef __CVECTOR3_H__ 2 | #define __CVECTOR3_H__ 3 | /// 4 | /// CVector3 class 5 | /// By Ethem Kurt (BigETI) 6 | /// 7 | extern "C" { 8 | class CVector3 9 | { 10 | public: 11 | /// 12 | /// X component 13 | /// 14 | float_t x; 15 | 16 | /// 17 | /// Y component 18 | /// 19 | float_t y; 20 | 21 | /// 22 | /// Z component 23 | /// 24 | float_t z; 25 | 26 | /// 27 | /// Unit vector 28 | /// 29 | static const CVector3 unit; 30 | 31 | /// 32 | /// Null vector 33 | /// 34 | static const CVector3 null; 35 | 36 | /// 37 | /// Up vector 38 | /// 39 | static const CVector3 up; 40 | 41 | /// 42 | /// Down vector 43 | /// 44 | static const CVector3 down; 45 | 46 | /// 47 | /// Left vector 48 | /// 49 | static const CVector3 left; 50 | 51 | /// 52 | /// Right vector 53 | /// 54 | static const CVector3 right; 55 | 56 | /// 57 | /// Front vector 58 | /// 59 | static const CVector3 front; 60 | 61 | /// 62 | /// Back vector 63 | /// 64 | static const CVector3 back; 65 | 66 | /// 67 | /// Default constructor 68 | /// 69 | CVector3(); 70 | 71 | /// 72 | /// Copy constructor 73 | /// 74 | /// Vector to assign from 75 | CVector3(const CVector3 &v); 76 | 77 | /// 78 | /// Constructor 79 | /// 80 | /// X component 81 | /// Y component 82 | /// Z component 83 | CVector3(float_t _x, float_t _y, float_t _z); 84 | 85 | /// 86 | /// Destructor 87 | /// 88 | ~CVector3(); 89 | 90 | /// 91 | /// Assign Vector 92 | /// 93 | /// Vector to assign from 94 | /// Itself 95 | CVector3 &operator=(const CVector3 &v); 96 | 97 | /// 98 | /// Add Vector 99 | /// 100 | /// Add from vector and assign result 101 | /// Itself 102 | CVector3 &operator+=(const CVector3 &v); 103 | 104 | /// 105 | /// Subtract Vector 106 | /// 107 | /// Subtract from vector and assign result 108 | /// Itself 109 | CVector3 &operator-=(const CVector3 &v); 110 | 111 | /// 112 | /// Multiply Vector 113 | /// 114 | /// Scalar to multiply with and assign result 115 | /// Itself 116 | CVector3 &operator*=(float_t s); 117 | 118 | /// 119 | /// Divide Vector 120 | /// 121 | /// Scalar to divide with and assign result 122 | /// Itself 123 | CVector3 &operator/=(float_t s); 124 | 125 | /// 126 | /// Add Vector 127 | /// 128 | /// Add from vector 129 | /// Result vector 130 | CVector3 operator+(const CVector3 &v); 131 | 132 | /// 133 | /// Subtract Vector 134 | /// 135 | /// Subtract from vector 136 | /// Result vector 137 | CVector3 operator-(const CVector3 &v); 138 | 139 | /// 140 | /// Vector dot product 141 | /// 142 | /// Scalar to multiply with 143 | /// Result vector 144 | float_t operator*(const CVector3 &v); 145 | 146 | /// 147 | /// Multiply Vector 148 | /// 149 | /// Scalar to multiply with 150 | /// Result vector 151 | CVector3 operator*(float_t s); 152 | 153 | /// 154 | /// Multiply Vector 155 | /// 156 | /// Scalar to divide with 157 | /// Result vector 158 | CVector3 operator/(float_t s); 159 | 160 | /// 161 | /// Is vector null 162 | /// 163 | /// If null then true, otherwise false 164 | bool IsNull(); 165 | 166 | /// 167 | /// Get magnitude of vector squared (faster than CVector3::Magnitude()) 168 | /// 169 | /// Magnitude squared 170 | float_t MagnitudeSquared(); 171 | 172 | /// 173 | /// Get magnitude of vector (slower than CVector3::MagnitudeSquared()) 174 | /// 175 | /// Magnitude 176 | float_t Magnitude(); 177 | 178 | /// 179 | /// Set magnitude of vector 180 | /// 181 | /// Magnitude 182 | void SetMagnitude(float_t m); 183 | 184 | /// 185 | /// Create vector with magnitude 186 | /// 187 | /// Magnitude 188 | /// Vector with set magnitude 189 | CVector3 WithMagnitude(float_t m); 190 | 191 | /// 192 | /// Is point in range 193 | /// 194 | /// Point to check 195 | /// Range for check 196 | /// If is point in range true, otherwise false 197 | bool IsInRange(const CVector3 &p, float_t range); 198 | 199 | /// 200 | /// Get cross product from 2 vectors 201 | /// 202 | /// Vector to get cross product from 203 | /// Cross product from 2 vectors 204 | CVector3 CrossProduct(const CVector3 &v); 205 | 206 | /// 207 | /// Get angle between two vectors (radians) 208 | /// 209 | /// Vector to get angle between 210 | /// Angle between 2 vectors (radians) 211 | float_t GetAngle(const CVector3 &v); 212 | 213 | /// 214 | /// Get angle between two vectors (degrees) 215 | /// 216 | /// Vector to get angle between 217 | /// Angle between 2 vectors (degrees) 218 | float_t GetAngleDegrees(const CVector3 &v); 219 | 220 | /// 221 | /// Rotate around vector (radians) 222 | /// 223 | /// Normal vector to rotate around 224 | /// Radians to rotate 225 | void RotateAround(const CVector3 &n, float_t radians); 226 | 227 | /// 228 | /// Create vector rotated around vector (radians) 229 | /// 230 | /// Radians to rotate 231 | /// Vector rotated around vector 232 | CVector3 CreateRotatedAround(const CVector3 &n, float_t radians); 233 | 234 | /// 235 | /// Rotate around vector (degrees) 236 | /// 237 | /// Normal vector to rotate around 238 | /// Degrees to rotate 239 | void RotateAroundDegrees(const CVector3 &n, float_t degrees); 240 | 241 | /// 242 | /// Create vector rotated around vector (degrees) 243 | /// 244 | /// Degrees to rotate 245 | /// Vector rotated around vector 246 | CVector3 CreateRotatedAroundDegrees(const CVector3 &n, float_t degrees); 247 | 248 | /// 249 | /// Negate vector 250 | /// 251 | void Negate(); 252 | 253 | /// 254 | /// Create negated vector 255 | /// 256 | /// Negated vector 257 | CVector3 CreateNegated(); 258 | }; 259 | } 260 | #endif -------------------------------------------------------------------------------- /Base.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {62BEAF06-48E0-4B13-A40D-8CF54E308F22} 23 | Win32Proj 24 | Base 25 | 8.1 26 | My Plugin 27 | 28 | 29 | 30 | DynamicLibrary 31 | true 32 | v141 33 | Unicode 34 | 35 | 36 | DynamicLibrary 37 | false 38 | v141 39 | true 40 | Unicode 41 | 42 | 43 | DynamicLibrary 44 | true 45 | v141 46 | Unicode 47 | 48 | 49 | DynamicLibrary 50 | false 51 | v141 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | true 75 | $(SolutionDir)Server\32\plugin\ 76 | MyPlugin 77 | 78 | 79 | true 80 | $(SolutionDir)Server\plugin\ 81 | MyPlugin 82 | 83 | 84 | false 85 | $(SolutionDir)Server\32\plugin\ 86 | MyPlugin 87 | 88 | 89 | false 90 | $(SolutionDir)Server\plugin\ 91 | MyPlugin 92 | 93 | 94 | 95 | 96 | 97 | Level3 98 | Disabled 99 | WIN32;_DEBUG;_WINDOWS;_USRDLL;BASE_EXPORTS;%(PreprocessorDefinitions) 100 | MultiThreadedDebugDLL 101 | 102 | 103 | Windows 104 | true 105 | Server.Launcher.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) 106 | 107 | 108 | 109 | 110 | 111 | 112 | Level3 113 | Disabled 114 | _DEBUG;_WINDOWS;_USRDLL;BASE_EXPORTS;%(PreprocessorDefinitions) 115 | MultiThreadedDebugDLL 116 | 117 | 118 | Windows 119 | true 120 | Server.Launcher.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) 121 | 122 | 123 | 124 | 125 | Level3 126 | 127 | 128 | MaxSpeed 129 | true 130 | true 131 | WIN32;NDEBUG;_WINDOWS;_USRDLL;BASE_EXPORTS;%(PreprocessorDefinitions) 132 | MultiThreadedDLL 133 | 134 | 135 | Windows 136 | true 137 | true 138 | true 139 | Server.Launcher.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) 140 | 141 | 142 | 143 | 144 | Level3 145 | 146 | 147 | MaxSpeed 148 | true 149 | true 150 | NDEBUG;_WINDOWS;_USRDLL;BASE_EXPORTS;%(PreprocessorDefinitions) 151 | MultiThreadedDLL 152 | 153 | 154 | Windows 155 | true 156 | true 157 | true 158 | Server.Launcher.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | -------------------------------------------------------------------------------- /sdk/APIVehicle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | namespace API 7 | { 8 | class Vehicle 9 | { 10 | public: 11 | /// 12 | /// Creates a vehicle of a desired model at the position defined 13 | /// 14 | /// The model of the vehicle you wish to create 15 | /// The position you wish to create the vehicle at 16 | /// The direction you wish the vehicle to be facing 17 | /// The vehicles server entity id 18 | DLL_PUBLIC_I static const int Create(const std::wstring model, const CVector3 position, const float heading); 19 | 20 | /// 21 | /// Creates a vehicle of a desired model at the position defined 22 | /// 23 | /// The model of the vehicle you wish to create 24 | /// The position you wish to create the vehicle at 25 | /// The rotation you wish to set the vehicle at 26 | /// The vehicles server entity id 27 | DLL_PUBLIC_I static const int Create(const std::wstring model, const CVector3 position, const CVector3 rotation); 28 | 29 | /// 30 | /// Sets the vehicles color using the Games standard preset colors 31 | /// 32 | /// The entity of the vehicle 33 | /// The paint layer to change the color off (1 or 2) 34 | /// The type of paint ( 0: Normal - 1: Metallic - 2 : Pearl - 3 : Matte - 4 : Metal - 5 : Chrome ) 35 | /// The color preset to use 36 | DLL_PUBLIC_I static void SetColor(const int entity, const int layer, const int painttype, const int color); 37 | 38 | /// 39 | /// Sets the vehicles color using RGB colors 40 | /// 41 | /// The entity of the vehicle 42 | /// The paint layer to change the color off (1 or 2) 43 | /// The custom RGB color (alpha is not used) 44 | DLL_PUBLIC_I static void SetColor(const int entity, const int layer, const Color color); 45 | 46 | /// 47 | /// Gets the vehicles number plate 48 | /// 49 | /// The entity of the vehicle 50 | /// The vehicles number plate 51 | DLL_PUBLIC_I static const std::wstring GetNumberPlate(const int entity); 52 | 53 | /// 54 | /// Sets the vehicles number plate 55 | /// 56 | /// The entity of the vehicle 57 | /// The number plate text. (Must be 8 or less chars) 58 | DLL_PUBLIC_I static void SetNumberPlate(const int entity, const std::wstring plate); 59 | 60 | /// 61 | /// Gets the index of the modType on the vehicle being used 62 | /// 63 | /// The entity of the vehicle 64 | /// The mod type to get the modIndex for (pastebin.com/mL1MUmrf) 65 | /// The mod index installed on the vehicle of the mod type 66 | DLL_PUBLIC_I static const int GetMod(const int entity, const int modType); 67 | 68 | /// 69 | /// Sets the index of the modType on the vehicle 70 | /// 71 | /// The entity of the vehicle 72 | /// The mod type to set the index of (pastebin.com/mL1MUmrf) 73 | /// The mod index to use for the modType 74 | DLL_PUBLIC_I static void SetMod(const int entity, const int modType, const int modIndex); 75 | 76 | /// 77 | /// Gets the engine state of the vehicle 78 | /// 79 | /// The entity of the vehicle 80 | /// The engine state 81 | DLL_PUBLIC_I static const bool GetEngineState(const int entity); 82 | 83 | /// 84 | /// Set the engine state of the vehicle 85 | /// 86 | /// The entity of the vehicle 87 | /// The state to set the engine 88 | DLL_PUBLIC_I static void SetEngineState(const int entity, const bool state); 89 | 90 | /// 91 | /// Get the doors locked state of the vehicle 92 | /// 93 | /// The entity of the vehicle 94 | /// The locked state 95 | DLL_PUBLIC_I static const int GetDoorsLockState(const int entity); 96 | 97 | /// 98 | /// Set the doors locked state of the vehicle 99 | /// 100 | /// The entity of the vehicle 101 | /// The state to set the locks (0 - CARLOCK_NONE, 1 - CARLOCK_UNLOCKED, 2 - CARLOCK_LOCKED(locked), 3 - CARLOCK_LOCKOUT_PLAYER_ONLY, 4 - CARLOCK_LOCKED_PLAYER_INSIDE(can get in, can't leave)) 102 | DLL_PUBLIC_I static void SetDoorsLockState(const int entity, const int state); 103 | 104 | /// 105 | /// Set the doors locked state of the vehicle 106 | /// 107 | /// The entity of the vehicle 108 | /// The state to set the locks (0 - CARLOCK_NONE, 1 - CARLOCK_UNLOCKED, 2 - CARLOCK_LOCKED(locked), 3 - CARLOCK_LOCKOUT_PLAYER_ONLY, 4 - CARLOCK_LOCKED_PLAYER_INSIDE(can get in, can't leave)) 109 | /// The entity of the player you whish to check the vehicles lock state for. 110 | DLL_PUBLIC_I static void SetDoorsLockState(const int entity, const int state, const int player); 111 | 112 | /// 113 | /// Get the vehicles model 114 | /// 115 | /// The entity of the vehicle 116 | /// The model 117 | DLL_PUBLIC_I static const std::wstring GetModel(const int entity); 118 | 119 | /// 120 | /// Get the vehicles number plate style 121 | /// 122 | /// The entity of the vehicle 123 | /// The number plate style index 124 | DLL_PUBLIC_I static const int GetNumberPlateStyle(const int entity); 125 | 126 | /// 127 | /// Set the vehicles number plate style 128 | /// 129 | /// The entity of the vehicle 130 | /// The style index of the numberplate 131 | DLL_PUBLIC_I static void SetNumberPlateStyle(const int entity, const int style); 132 | 133 | /// 134 | /// Fetch if a vehicles extra is enabled or not. 135 | /// 136 | /// The entity of the vehicle 137 | /// The extra index (1-14) 138 | /// The extras toggle state 139 | DLL_PUBLIC_I static const bool GetExtra(const int entity, const int extra); 140 | 141 | /// 142 | /// Set the vehicles extra toggle 143 | /// 144 | /// The entity of the vehicle 145 | /// The style index of the numberplate 146 | /// The toggle state of the extra 147 | DLL_PUBLIC_I static void SetExtra(const int entity, const int extra, const bool toggle); 148 | }; 149 | } 150 | #ifdef __cplusplus 151 | } 152 | #endif 153 | 154 | class Vehicle { 155 | private: 156 | int Entity; 157 | public: 158 | const int GetEntity() { return Entity; } 159 | 160 | void Create(const std::wstring model, const CVector3 position, const float heading) 161 | { 162 | Entity = API::Vehicle::Create(model, position, heading); 163 | } 164 | 165 | void Create(const std::wstring model, const CVector3 position, const CVector3 rotation) 166 | { 167 | Entity = API::Vehicle::Create(model, position, rotation); 168 | } 169 | 170 | void Destroy() 171 | { 172 | API::Entity::Destroy(Entity); 173 | Entity = -1; 174 | } 175 | 176 | const CVector3 GetPosition() 177 | { 178 | return API::Entity::GetPosition(Entity); 179 | } 180 | 181 | void SetPosition(const CVector3 position) 182 | { 183 | API::Entity::SetPosition(Entity, position); 184 | } 185 | 186 | const CVector3 GetRotation() 187 | { 188 | return API::Entity::GetRotation(Entity); 189 | } 190 | 191 | void SetRotation(const CVector3 position) 192 | { 193 | API::Entity::SetRotation(Entity, position); 194 | } 195 | 196 | const float GetViewDistance() 197 | { 198 | return API::Entity::GetViewDistance(Entity); 199 | } 200 | 201 | void SetViewDistance(const float distance) 202 | { 203 | API::Entity::SetViewDistance(Entity, distance); 204 | } 205 | 206 | void SetColor(const int layer, const int painttype, const int color) 207 | { 208 | API::Vehicle::SetColor(Entity, layer, painttype, color); 209 | } 210 | 211 | void SetColor(const int layer, const Color color) 212 | { 213 | API::Vehicle::SetColor(Entity, layer, color); 214 | } 215 | 216 | const std::wstring GetNumberPlate() 217 | { 218 | return API::Vehicle::GetNumberPlate(Entity); 219 | } 220 | 221 | void SetNumberPlate(const std::wstring plate) 222 | { 223 | API::Vehicle::SetNumberPlate(Entity, plate); 224 | } 225 | 226 | const int GetMod(const int modType) 227 | { 228 | return API::Vehicle::GetMod(Entity, modType); 229 | } 230 | 231 | void SetMod(const int modType, const int modIndex) 232 | { 233 | API::Vehicle::SetMod(Entity, modType, modIndex); 234 | } 235 | 236 | const bool GetEngineState() 237 | { 238 | return API::Vehicle::GetEngineState(Entity); 239 | } 240 | 241 | void SetEngineState(const bool state) 242 | { 243 | API::Vehicle::SetEngineState(Entity, state); 244 | } 245 | 246 | const int GetDoorsLockState() 247 | { 248 | return API::Vehicle::GetDoorsLockState(Entity); 249 | } 250 | 251 | void SetDoorsLockState(const int state) 252 | { 253 | API::Vehicle::SetDoorsLockState(Entity, state); 254 | } 255 | 256 | void SetDoorsLockState(const int state, const int player) 257 | { 258 | API::Vehicle::SetDoorsLockState(Entity, state, player); 259 | } 260 | 261 | const std::wstring GetModel() 262 | { 263 | return API::Vehicle::GetModel(Entity); 264 | } 265 | 266 | const int GetNumberPlateStyle() 267 | { 268 | return API::Vehicle::GetNumberPlateStyle(Entity); 269 | } 270 | 271 | void SetNumberPlateStyle(const int style) 272 | { 273 | API::Vehicle::SetNumberPlateStyle(Entity, style); 274 | } 275 | 276 | const bool GetExtra(const int extra) 277 | { 278 | return API::Vehicle::GetExtra(Entity, extra); 279 | } 280 | 281 | void GetExtra(const int extra, const bool toggle) 282 | { 283 | return API::Vehicle::SetExtra(Entity, extra, toggle); 284 | } 285 | }; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------