├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ ├── feature_request.md │ └── function_request.md ├── LICENSE ├── README.md ├── amx-deps ├── amxdeploy.exe ├── amxdeploy.pl ├── meta.xml └── src │ ├── .gitignore │ ├── CFunctions.cpp │ ├── CFunctions.h │ ├── Common.h │ ├── Makefile │ ├── StdInc.cpp │ ├── StdInc.h │ ├── UTF8.h │ ├── amx │ ├── CMakeLists.txt │ ├── amx.c │ ├── amx.h │ ├── amxDGram.def │ ├── amxDGram.rc │ ├── amxFile.rc │ ├── amxFixed.def │ ├── amxFixed.rc │ ├── amxFloat.def │ ├── amxFloat.rc │ ├── amxProcess.def │ ├── amxProcess.rc │ ├── amxargs.c │ ├── amxargs.def │ ├── amxargs.rc │ ├── amxaux.c │ ├── amxaux.h │ ├── amxcons.c │ ├── amxcons.h │ ├── amxcore.c │ ├── amxdbg.c │ ├── amxdbg.h │ ├── amxdef.asm │ ├── amxdefn.asm │ ├── amxdgram.c │ ├── amxexec.asm │ ├── amxexecn.asm │ ├── amxfile.c │ ├── amxfile.def │ ├── amxfloat.c │ ├── amxgc.c │ ├── amxgc.h │ ├── amxjitr.asm │ ├── amxjits.asm │ ├── amxjitsn.asm │ ├── amxprocess.c │ ├── amxstring.c │ ├── amxstring.def │ ├── amxstring.rc │ ├── amxtime.c │ ├── amxtime.def │ ├── amxtime.rc │ ├── dllmain.c │ ├── fixed.c │ ├── fpattern.c │ ├── fpattern.h │ ├── minGlue.h │ ├── minIni.c │ ├── minIni.h │ ├── osdefs.h │ ├── pawndbg.c │ ├── pawnrun.c │ ├── premake5.lua │ ├── term_ga.c │ ├── term_ga.h │ ├── termwin.c │ └── termwin.h │ ├── include │ ├── ILuaModuleManager.h │ ├── lapi.h │ ├── lauxlib.h │ ├── lcode.h │ ├── ldebug.h │ ├── ldo.h │ ├── lfunc.h │ ├── lgc.h │ ├── llex.h │ ├── llimits.h │ ├── lmem.h │ ├── lobject.h │ ├── lopcodes.h │ ├── lparser.h │ ├── lstate.h │ ├── lstring.h │ ├── ltable.h │ ├── ltm.h │ ├── lua.h │ ├── lua.hpp │ ├── luaconf.h │ ├── lualib.h │ ├── lundump.h │ ├── lvm.h │ ├── lzio.h │ └── sqlite3.h │ ├── king.rc │ ├── lib │ ├── lua5.1.exp │ ├── lua5.1.lib │ ├── lua5.1.so │ ├── sqlite3.exp │ └── sqlite3.lib │ ├── linux │ ├── binreloc.c │ ├── binreloc.h │ ├── getch.c │ ├── getch.h │ └── sclinux.h │ ├── ml_base.cpp │ ├── ml_base.h │ ├── premake5.lua │ ├── resource.h │ ├── syscalls.cpp │ ├── util.cpp │ └── util.h ├── amx-fs-test ├── meta.xml ├── testfs.amx └── testfs.pwn ├── amx-test ├── meta.xml ├── pawno │ ├── include │ │ ├── a_actor.inc │ │ ├── a_amx.inc │ │ ├── a_http.inc │ │ ├── a_npc.inc │ │ ├── a_objects.inc │ │ ├── a_players.inc │ │ ├── a_samp.inc │ │ ├── a_sampdb.inc │ │ ├── a_vehicles.inc │ │ ├── core.inc │ │ ├── datagram.inc │ │ ├── file.inc │ │ ├── float.inc │ │ ├── string.inc │ │ └── time.inc │ ├── libpawnc.dll │ ├── new.pwn │ ├── pawn.ico │ ├── pawnc.dll │ ├── pawncc.exe │ ├── pawno.exe │ └── settings.ini ├── testgm.amx └── testgm.pwn └── amx ├── client ├── anim.lua ├── arrowmarkers.lua ├── bone_attach_c.lua ├── bone_pos_rot.lua ├── client.lua ├── garages.lua ├── map_waypoint.lua ├── mouselook.lua ├── samp_nametags.lua └── util.lua ├── images ├── closebtn.png ├── closebtn_hover.png └── logo_small.png ├── meta.xml ├── scriptfiles ├── properties │ ├── banks.txt │ ├── businesses.txt │ ├── houses.txt │ ├── interiors.txt │ └── police.txt └── vehicles │ ├── bone.txt │ ├── flint.txt │ ├── ls_airport.txt │ ├── ls_gen_inner.txt │ ├── ls_gen_outer.txt │ ├── ls_law.txt │ ├── lv_airport.txt │ ├── lv_gen.txt │ ├── lv_law.txt │ ├── pilots.txt │ ├── red_county.txt │ ├── sf_airport.txt │ ├── sf_gen.txt │ ├── sf_law.txt │ ├── sf_train.txt │ ├── tierra.txt │ ├── trains.txt │ ├── trains_platform.txt │ └── whetstone.txt ├── server ├── _triggerqueue.lua ├── amx.lua ├── defines.lua ├── events.lua ├── natives │ ├── a_actors.lua │ ├── a_http.lua │ ├── a_mta.lua │ ├── a_npc.lua │ ├── a_objects.lua │ ├── a_players.lua │ ├── a_samp.lua │ ├── a_sampdb.lua │ └── a_vehicles.lua ├── rcon.lua ├── syscalls.lua └── util.lua └── shared ├── anim_define.lua ├── attach_func.lua ├── bone_attach.lua ├── ped_anim.lua ├── sound_offset.lua └── vehicle_info.lua /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | labels: bug 5 | 6 | --- 7 | 8 | **Describe the bug** 9 | 10 | 11 | **To reproduce** 12 | 21 | 22 | **Expected behaviour** 23 | 24 | 25 | **Screenshots** 26 | 30 | 31 | **Version** 32 | 38 | 39 | **Additional context** 40 | 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | labels: enhancement 5 | 6 | --- 7 | 8 | **Is your feature request related to a problem? Please describe.** 9 | 10 | 11 | **Describe the solution you'd like** 12 | 13 | 14 | **Describe alternatives you've considered** 15 | 16 | 17 | **Additional context** 18 | 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/function_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Function request 3 | about: Tell us about a function that does not work here, but works in SA-MP 4 | labels: function 5 | 6 | --- 7 | 8 | **Function name** 9 | 10 | 11 | **Describe the function** 12 | 13 | 14 | **Examples of using of the function** 15 | 16 | 17 | **Equivalent in MTA** 18 | 19 | 20 | **Additional information** 21 | 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2008 Multi Theft Auto and amx contributors 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | excluding commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 16 | 2. Altered source versions must be plainly marked as such, and must not be 17 | misrepresented as being the original software. 18 | 19 | 3. This notice may not be removed or altered from any source 20 | distribution. 21 | -------------------------------------------------------------------------------- /amx-deps/amxdeploy.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-deps/amxdeploy.exe -------------------------------------------------------------------------------- /amx-deps/meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /amx-deps/src/CFunctions.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-deps/src/CFunctions.h -------------------------------------------------------------------------------- /amx-deps/src/Common.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-deps/src/Common.h -------------------------------------------------------------------------------- /amx-deps/src/Makefile: -------------------------------------------------------------------------------- 1 | #### Start of system configuration section #### 2 | 3 | ASM = nasm 4 | CC = gcc 5 | LD = gcc 6 | PROG = king.so 7 | CXX = gcc 8 | CPP = gcc 9 | 10 | # Compiler flags 11 | # NOTE: add -g for debug, remove for release! 12 | ASMFLAGS = -O1 -f elf -I./amx/ 13 | CPPFLAGS = -MD -O2 -Wall -I./ -I/usr/local/include/boost-1_35 -I./amx -I./include -I./linux -DAMX_DONT_RELOCATE -DFLOATPOINT 14 | LDFLAGS = -fPIC -s -shared -Wl,-soname,$(PROG).1,-R./ 15 | LIBS = -lpthread -lstdc++ -llua5.1 -lsqlite3 -lboost_filesystem-gcc41-mt-s -lboost_system-gcc41-mt-s 16 | 17 | #### End of system configuration section #### 18 | 19 | #### Source and object files 20 | 21 | SRC_AMXASM = ./amx/amxexecn.asm 22 | OBJ_AMXASM = $(patsubst %.asm,%.o,$(SRC_AMXASM)) 23 | 24 | SRC_AMX = ./amx/amx.c ./amx/amxaux.c ./amx/amxcons.c ./amx/amxcore.c ./amx/amxfile.c ./amx/amxstring.c ./amx/amxtime.c ./amx/float.c 25 | OBJ_AMX = $(patsubst %.c,%.o,$(SRC_AMX)) 26 | 27 | SRC_LOCAL = $(wildcard ./*.cpp) $(wildcard ./linux/*.c) 28 | OBJ_LOCAL = $(patsubst %.cpp,%.o,$(patsubst %.c,%.o,$(SRC_LOCAL))) 29 | 30 | CPPSRCS = $(SRC_LOCAL) $(SRC_AMX) 31 | CPPOBJS = $(OBJ_AMX) $(OBJ_LOCAL) 32 | ASMSRCS = $(SRC_AMXASM) 33 | ASMOBJS = $(OBJ_AMXASM) 34 | DEPS = $(patsubst %.o,%.d,$(OBJS)) 35 | 36 | #### Make rules 37 | 38 | all : kingasm king 39 | 40 | kingasm : 41 | $(ASM) $(ASMFLAGS) $(ASMSRCS) 42 | 43 | king : $(CPPOBJS) 44 | $(CC) $(CPPFLAGS) $(LDFLAGS) -o $(PROG) $(CPPOBJS) $(ASMOBJS) $(LIBS) 45 | 46 | clean : 47 | -rm *.d 48 | -rm *.o 49 | -rm ./amx/*.o 50 | -rm ./amx/*.d 51 | -rm ./linux/*.o 52 | -rm ./linux/*.d 53 | -rm $(PROG) 54 | 55 | -include $(DEPS) 56 | -------------------------------------------------------------------------------- /amx-deps/src/StdInc.cpp: -------------------------------------------------------------------------------- 1 | #include "StdInc.h" 2 | -------------------------------------------------------------------------------- /amx-deps/src/StdInc.h: -------------------------------------------------------------------------------- 1 | #ifndef _STDINC_H 2 | #define _STDINC_H 3 | 4 | #ifdef WIN32 5 | #define WIN32_LEAN_AND_MEAN 6 | #include 7 | #else 8 | #include 9 | #endif 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "Common.h" 21 | #include "include/ILuaModuleManager.h" 22 | #include "include/sqlite3.h" 23 | 24 | extern "C" 25 | { 26 | #include "amx/amx.h" 27 | #include "amx/amxaux.h" 28 | 29 | int AMXEXPORT amx_CoreInit(AMX *amx); 30 | int AMXEXPORT amx_ConsoleInit(AMX *amx); 31 | int AMXEXPORT amx_FloatInit(AMX *amx); 32 | int AMXEXPORT amx_StringInit(AMX *amx); 33 | int AMXEXPORT amx_TimeInit(AMX *amx); 34 | int AMXEXPORT amx_FileInit(AMX *amx); 35 | 36 | #include "include/lua.h" 37 | #include "include/lualib.h" 38 | #include "include/lauxlib.h" 39 | #include "include/lobject.h" 40 | }; 41 | 42 | #include "ml_base.h" 43 | #include "util.h" 44 | #include "CFunctions.h" 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxDGram.def: -------------------------------------------------------------------------------- 1 | NAME amxDGram 2 | DESCRIPTION 'Pawn AMX: network datagram' 3 | 4 | EXPORTS 5 | amx_DGramInit 6 | amx_DGramCleanup 7 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxDGram.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #if defined WIN32 || defined _WIN32 || defined __WIN32__ 3 | # include 4 | #else 5 | # include 6 | #endif 7 | 8 | /* Version information 9 | * 10 | * All strings MUST have an explicit \0. See the Windows SDK documentation 11 | * for details on version information and the VERSIONINFO structure. 12 | */ 13 | #define VERSION 1 14 | #define REVISION 0 15 | #define BUILD 0 16 | #define VERSIONSTR "1.0.0\0" 17 | #define VERSIONNAME "amxDGram.dll\0" 18 | #define VERSIONDESCRIPTION "Pawn AMX: network datagram\0" 19 | #define VERSIONCOMPANYNAME "ITB CompuPhase\0" 20 | #define VERSIONPRODUCTNAME "amxDGram\0" 21 | #define VERSIONCOPYRIGHT "Copyright \251 2006 ITB CompuPhase\0" 22 | 23 | VS_VERSION_INFO VERSIONINFO 24 | FILEVERSION VERSION, REVISION, BUILD, 0 25 | PRODUCTVERSION VERSION, REVISION, BUILD, 0 26 | FILEFLAGSMASK 0x0000003FL 27 | FILEFLAGS 0 28 | #if defined(WIN32) 29 | FILEOS VOS__WINDOWS32 30 | #else 31 | FILEOS VOS__WINDOWS16 32 | #endif 33 | FILETYPE VFT_DLL 34 | BEGIN 35 | BLOCK "StringFileInfo" 36 | BEGIN 37 | BLOCK "040904E4" 38 | BEGIN 39 | VALUE "CompanyName", VERSIONCOMPANYNAME 40 | VALUE "FileDescription", VERSIONDESCRIPTION 41 | VALUE "FileVersion", VERSIONSTR 42 | VALUE "InternalName", VERSIONNAME 43 | VALUE "LegalCopyright", VERSIONCOPYRIGHT 44 | VALUE "OriginalFilename", VERSIONNAME 45 | VALUE "ProductName", VERSIONPRODUCTNAME 46 | VALUE "ProductVersion", VERSIONSTR 47 | END 48 | END 49 | 50 | BLOCK "VarFileInfo" 51 | BEGIN 52 | VALUE "Translation", 0x409, 1252 53 | END 54 | END 55 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxFile.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #if defined WIN32 || defined _WIN32 || defined __WIN32__ 3 | # include 4 | #else 5 | # include 6 | #endif 7 | 8 | /* Version information 9 | * 10 | * All strings MUST have an explicit \0. See the Windows SDK documentation 11 | * for details on version information and the VERSIONINFO structure. 12 | */ 13 | #define VERSION 4 14 | #define REVISION 0 15 | #define BUILD 0 16 | #define VERSIONSTR "4.0.0\0" 17 | #define VERSIONNAME "amxFile.dll\0" 18 | #define VERSIONDESCRIPTION "Pawn AMX: File I/O support\0" 19 | #define VERSIONCOMPANYNAME "ITB CompuPhase\0" 20 | #define VERSIONPRODUCTNAME "amxFile\0" 21 | #define VERSIONCOPYRIGHT "Copyright \251 2004-2016 ITB CompuPhase\0" 22 | 23 | VS_VERSION_INFO VERSIONINFO 24 | FILEVERSION VERSION, REVISION, BUILD, 0 25 | PRODUCTVERSION VERSION, REVISION, BUILD, 0 26 | FILEFLAGSMASK 0x0000003FL 27 | FILEFLAGS 0 28 | #if defined(WIN32) 29 | FILEOS VOS__WINDOWS32 30 | #else 31 | FILEOS VOS__WINDOWS16 32 | #endif 33 | FILETYPE VFT_DLL 34 | BEGIN 35 | BLOCK "StringFileInfo" 36 | BEGIN 37 | BLOCK "040904E4" 38 | BEGIN 39 | VALUE "CompanyName", VERSIONCOMPANYNAME 40 | VALUE "FileDescription", VERSIONDESCRIPTION 41 | VALUE "FileVersion", VERSIONSTR 42 | VALUE "InternalName", VERSIONNAME 43 | VALUE "LegalCopyright", VERSIONCOPYRIGHT 44 | VALUE "OriginalFilename", VERSIONNAME 45 | VALUE "ProductName", VERSIONPRODUCTNAME 46 | VALUE "ProductVersion", VERSIONSTR 47 | END 48 | END 49 | 50 | BLOCK "VarFileInfo" 51 | BEGIN 52 | VALUE "Translation", 0x409, 1252 53 | END 54 | END 55 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxFixed.def: -------------------------------------------------------------------------------- 1 | NAME amxFixed 2 | DESCRIPTION 'Pawn AMX: fixed-point arithmetic' 3 | 4 | EXPORTS 5 | amx_FixedInit 6 | amx_FixedCleanup 7 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxFixed.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #if defined WIN32 || defined _WIN32 || defined __WIN32__ 3 | # include 4 | #else 5 | # include 6 | #endif 7 | 8 | /* Version information 9 | * 10 | * All strings MUST have an explicit \0. See the Windows SDK documentation 11 | * for details on version information and the VERSIONINFO structure. 12 | */ 13 | #define VERSION 1 14 | #define REVISION 0 15 | #define BUILD 0 16 | #define VERSIONSTR "1.0.0\0" 17 | #define VERSIONNAME "amxFixed.dll\0" 18 | #define VERSIONDESCRIPTION "Pawn AMX: Fixed Point support\0" 19 | #define VERSIONCOMPANYNAME "ITB CompuPhase\0" 20 | #define VERSIONPRODUCTNAME "amxFixed\0" 21 | #define VERSIONCOPYRIGHT "Copyright \251 2003-2006 ITB CompuPhase\0" 22 | 23 | VS_VERSION_INFO VERSIONINFO 24 | FILEVERSION VERSION, REVISION, BUILD, 0 25 | PRODUCTVERSION VERSION, REVISION, BUILD, 0 26 | FILEFLAGSMASK 0x0000003FL 27 | FILEFLAGS 0 28 | #if defined(WIN32) 29 | FILEOS VOS__WINDOWS32 30 | #else 31 | FILEOS VOS__WINDOWS16 32 | #endif 33 | FILETYPE VFT_DLL 34 | BEGIN 35 | BLOCK "StringFileInfo" 36 | BEGIN 37 | BLOCK "040904E4" 38 | BEGIN 39 | VALUE "CompanyName", VERSIONCOMPANYNAME 40 | VALUE "FileDescription", VERSIONDESCRIPTION 41 | VALUE "FileVersion", VERSIONSTR 42 | VALUE "InternalName", VERSIONNAME 43 | VALUE "LegalCopyright", VERSIONCOPYRIGHT 44 | VALUE "OriginalFilename", VERSIONNAME 45 | VALUE "ProductName", VERSIONPRODUCTNAME 46 | VALUE "ProductVersion", VERSIONSTR 47 | END 48 | END 49 | 50 | BLOCK "VarFileInfo" 51 | BEGIN 52 | VALUE "Translation", 0x409, 1252 53 | END 54 | END 55 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxFloat.def: -------------------------------------------------------------------------------- 1 | NAME amxFloat 2 | DESCRIPTION 'Pawn AMX: floating-point arithmetic' 3 | 4 | EXPORTS 5 | amx_FloatInit 6 | amx_FloatCleanup 7 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxFloat.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #if defined WIN32 || defined _WIN32 || defined __WIN32__ 3 | # include 4 | #else 5 | # include 6 | #endif 7 | 8 | /* Version information 9 | * 10 | * All strings MUST have an explicit \0. See the Windows SDK documentation 11 | * for details on version information and the VERSIONINFO structure. 12 | */ 13 | #define VERSION 4 14 | #define REVISION 0 15 | #define BUILD 0 16 | #define VERSIONSTR "4.0.0\0" 17 | #define VERSIONNAME "amxFloat.dll\0" 18 | #define VERSIONDESCRIPTION "Pawn AMX: Floating Point support\0" 19 | #define VERSIONCOMPANYNAME "ITB CompuPhase\0" 20 | #define VERSIONPRODUCTNAME "amxFloat\0" 21 | #define VERSIONCOPYRIGHT "Copyright \251 2003-2013 ITB CompuPhase\0" 22 | 23 | VS_VERSION_INFO VERSIONINFO 24 | FILEVERSION VERSION, REVISION, BUILD, 0 25 | PRODUCTVERSION VERSION, REVISION, BUILD, 0 26 | FILEFLAGSMASK 0x0000003FL 27 | FILEFLAGS 0 28 | #if defined(WIN32) 29 | FILEOS VOS__WINDOWS32 30 | #else 31 | FILEOS VOS__WINDOWS16 32 | #endif 33 | FILETYPE VFT_DLL 34 | BEGIN 35 | BLOCK "StringFileInfo" 36 | BEGIN 37 | BLOCK "040904E4" 38 | BEGIN 39 | VALUE "CompanyName", VERSIONCOMPANYNAME 40 | VALUE "FileDescription", VERSIONDESCRIPTION 41 | VALUE "FileVersion", VERSIONSTR 42 | VALUE "InternalName", VERSIONNAME 43 | VALUE "LegalCopyright", VERSIONCOPYRIGHT 44 | VALUE "OriginalFilename", VERSIONNAME 45 | VALUE "ProductName", VERSIONPRODUCTNAME 46 | VALUE "ProductVersion", VERSIONSTR 47 | END 48 | END 49 | 50 | BLOCK "VarFileInfo" 51 | BEGIN 52 | VALUE "Translation", 0x409, 1252 53 | END 54 | END 55 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxProcess.def: -------------------------------------------------------------------------------- 1 | NAME amxProcess 2 | DESCRIPTION 'Pawn AMX: process control and foreign function interface' 3 | 4 | EXPORTS 5 | amx_ProcessInit 6 | amx_ProcessCleanup 7 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxProcess.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #if defined WIN32 || defined _WIN32 || defined __WIN32__ 3 | # include 4 | #else 5 | # include 6 | #endif 7 | 8 | /* Version information 9 | * 10 | * All strings MUST have an explicit \0. See the Windows SDK documentation 11 | * for details on version information and the VERSIONINFO structure. 12 | */ 13 | #define VERSION 1 14 | #define REVISION 0 15 | #define BUILD 0 16 | #define VERSIONSTR "1.0.0\0" 17 | #define VERSIONNAME "amxProcess.dll\0" 18 | #define VERSIONDESCRIPTION "Pawn AMX: process control and foreign function interface\0" 19 | #define VERSIONCOMPANYNAME "ITB CompuPhase\0" 20 | #define VERSIONPRODUCTNAME "amxProcess\0" 21 | #define VERSIONCOPYRIGHT "Copyright \251 2005-2006 ITB CompuPhase\0" 22 | 23 | VS_VERSION_INFO VERSIONINFO 24 | FILEVERSION VERSION, REVISION, BUILD, 0 25 | PRODUCTVERSION VERSION, REVISION, BUILD, 0 26 | FILEFLAGSMASK 0x0000003FL 27 | FILEFLAGS 0 28 | #if defined(WIN32) 29 | FILEOS VOS__WINDOWS32 30 | #else 31 | FILEOS VOS__WINDOWS16 32 | #endif 33 | FILETYPE VFT_DLL 34 | BEGIN 35 | BLOCK "StringFileInfo" 36 | BEGIN 37 | BLOCK "040904E4" 38 | BEGIN 39 | VALUE "CompanyName", VERSIONCOMPANYNAME 40 | VALUE "FileDescription", VERSIONDESCRIPTION 41 | VALUE "FileVersion", VERSIONSTR 42 | VALUE "InternalName", VERSIONNAME 43 | VALUE "LegalCopyright", VERSIONCOPYRIGHT 44 | VALUE "OriginalFilename", VERSIONNAME 45 | VALUE "ProductName", VERSIONPRODUCTNAME 46 | VALUE "ProductVersion", VERSIONSTR 47 | END 48 | END 49 | 50 | BLOCK "VarFileInfo" 51 | BEGIN 52 | VALUE "Translation", 0x409, 1252 53 | END 54 | END 55 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxargs.def: -------------------------------------------------------------------------------- 1 | NAME amxArgs 2 | DESCRIPTION 'Pawn AMX: Script Arguments support' 3 | 4 | EXPORTS 5 | amx_ArgsInit 6 | amx_ArgsCleanup 7 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxargs.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #if defined WIN32 || defined _WIN32 || defined __WIN32__ 3 | # include 4 | #else 5 | # include 6 | #endif 7 | 8 | /* Version information 9 | * 10 | * All strings MUST have an explicit \0. See the Windows SDK documentation 11 | * for details on version information and the VERSIONINFO structure. 12 | */ 13 | #define VERSION 4 14 | #define REVISION 0 15 | #define BUILD 0 16 | #define VERSIONSTR "4.0.0\0" 17 | #define VERSIONNAME "amxArgs.dll\0" 18 | #define VERSIONDESCRIPTION "Pawn AMX: Script Arguments support\0" 19 | #define VERSIONCOMPANYNAME "ITB CompuPhase\0" 20 | #define VERSIONPRODUCTNAME "amxArgs\0" 21 | #define VERSIONCOPYRIGHT "Copyright \251 2005-2016 ITB CompuPhase\0" 22 | 23 | VS_VERSION_INFO VERSIONINFO 24 | FILEVERSION VERSION, REVISION, BUILD, 0 25 | PRODUCTVERSION VERSION, REVISION, BUILD, 0 26 | FILEFLAGSMASK 0x0000003FL 27 | FILEFLAGS 0 28 | #if defined(WIN32) 29 | FILEOS VOS__WINDOWS32 30 | #else 31 | FILEOS VOS__WINDOWS16 32 | #endif 33 | FILETYPE VFT_DLL 34 | BEGIN 35 | BLOCK "StringFileInfo" 36 | BEGIN 37 | BLOCK "040904E4" 38 | BEGIN 39 | VALUE "CompanyName", VERSIONCOMPANYNAME 40 | VALUE "FileDescription", VERSIONDESCRIPTION 41 | VALUE "FileVersion", VERSIONSTR 42 | VALUE "InternalName", VERSIONNAME 43 | VALUE "LegalCopyright", VERSIONCOPYRIGHT 44 | VALUE "OriginalFilename", VERSIONNAME 45 | VALUE "ProductName", VERSIONPRODUCTNAME 46 | VALUE "ProductVersion", VERSIONSTR 47 | END 48 | END 49 | 50 | BLOCK "VarFileInfo" 51 | BEGIN 52 | VALUE "Translation", 0x409, 1252 53 | END 54 | END 55 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxaux.c: -------------------------------------------------------------------------------- 1 | /* Support routines for the Pawn Abstract Machine 2 | * 3 | * Copyright (c) ITB CompuPhase, 2003-2006 4 | * 5 | * This software is provided "as-is", without any express or implied warranty. 6 | * In no event will the authors be held liable for any damages arising from 7 | * the use of this software. 8 | * 9 | * Permission is granted to anyone to use this software for any purpose, 10 | * including commercial applications, and to alter it and redistribute it 11 | * freely, subject to the following restrictions: 12 | * 13 | * 1. The origin of this software must not be misrepresented; you must not 14 | * claim that you wrote the original software. If you use this software in 15 | * a product, an acknowledgment in the product documentation would be 16 | * appreciated but is not required. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * Version: $Id: amxaux.c 3612 2006-07-22 09:59:46Z thiadmer $ 22 | */ 23 | 24 | #include 25 | #include 26 | #include 27 | #include "amx.h" 28 | #include "amxaux.h" 29 | 30 | size_t AMXAPI aux_ProgramSize(char *filename) 31 | { 32 | FILE *fp; 33 | size_t size; 34 | AMX_HEADER hdr; 35 | 36 | if ((fp=fopen(filename,"rb")) == NULL) 37 | return 0; 38 | size = fread(&hdr, sizeof hdr, 1, fp); 39 | fclose(fp); 40 | if (size < 1) 41 | return 0; 42 | 43 | amx_Align16(&hdr.magic); 44 | amx_Align32((uint32_t *)&hdr.stp); 45 | return (hdr.magic==AMX_MAGIC) ? (size_t)hdr.stp : 0; 46 | } 47 | 48 | int AMXAPI aux_LoadProgram(AMX *amx, char *filename, void *memblock) 49 | { 50 | FILE *fp; 51 | size_t size; 52 | AMX_HEADER hdr; 53 | int result, didalloc; 54 | 55 | /* open the file, read and check the header */ 56 | if ((fp = fopen(filename, "rb")) == NULL) 57 | return AMX_ERR_NOTFOUND; 58 | size = fread(&hdr, sizeof hdr, 1, fp); 59 | if (size < 1) { 60 | fclose(fp); 61 | return AMX_ERR_FORMAT; 62 | } /* if */ 63 | amx_Align16(&hdr.magic); 64 | amx_Align32((uint32_t *)&hdr.size); 65 | amx_Align32((uint32_t *)&hdr.stp); 66 | if (hdr.magic != AMX_MAGIC) { 67 | fclose(fp); 68 | return AMX_ERR_FORMAT; 69 | } /* if */ 70 | 71 | /* allocate the memblock if it is NULL */ 72 | didalloc = 0; 73 | if (memblock == NULL) { 74 | if ((memblock = malloc(hdr.stp)) == NULL) { 75 | fclose(fp); 76 | return AMX_ERR_MEMORY; 77 | } /* if */ 78 | didalloc = 1; 79 | /* after amx_Init(), amx->base points to the memory block */ 80 | } /* if */ 81 | 82 | /* read in the file */ 83 | rewind(fp); 84 | size = fread(memblock, 1, (size_t)hdr.size, fp); 85 | fclose(fp); 86 | if (size < (size_t)hdr.size) 87 | return AMX_ERR_FORMAT; 88 | 89 | /* initialize the abstract machine */ 90 | memset(amx, 0, sizeof *amx); 91 | result = amx_Init(amx, memblock); 92 | 93 | /* free the memory block on error, if it was allocated here */ 94 | if (result != AMX_ERR_NONE && didalloc) { 95 | free(memblock); 96 | amx->base = NULL; /* avoid a double free */ 97 | } /* if */ 98 | 99 | return result; 100 | } 101 | 102 | int AMXAPI aux_FreeProgram(AMX *amx) 103 | { 104 | if (amx->base!=NULL) { 105 | amx_Cleanup(amx); 106 | free(amx->base); 107 | memset(amx,0,sizeof(AMX)); 108 | } /* if */ 109 | return AMX_ERR_NONE; 110 | } 111 | 112 | char * AMXAPI aux_StrError(int errnum) 113 | { 114 | static char *messages[] = { 115 | /* AMX_ERR_NONE */ "(none)", 116 | /* AMX_ERR_EXIT */ "Forced exit", 117 | /* AMX_ERR_ASSERT */ "Assertion failed", 118 | /* AMX_ERR_STACKERR */ "Stack/heap collision (insufficient stack size)", 119 | /* AMX_ERR_BOUNDS */ "Array index out of bounds", 120 | /* AMX_ERR_MEMACCESS */ "Invalid memory access", 121 | /* AMX_ERR_INVINSTR */ "Invalid instruction", 122 | /* AMX_ERR_STACKLOW */ "Stack underflow", 123 | /* AMX_ERR_HEAPLOW */ "Heap underflow", 124 | /* AMX_ERR_CALLBACK */ "No (valid) native function callback", 125 | /* AMX_ERR_NATIVE */ "Native function failed", 126 | /* AMX_ERR_DIVIDE */ "Divide by zero", 127 | /* AMX_ERR_SLEEP */ "(sleep mode)", 128 | /* 13 */ "(reserved)", 129 | /* 14 */ "(reserved)", 130 | /* 15 */ "(reserved)", 131 | /* AMX_ERR_MEMORY */ "Out of memory", 132 | /* AMX_ERR_FORMAT */ "Invalid/unsupported P-code file format", 133 | /* AMX_ERR_VERSION */ "File is for a newer version of the AMX", 134 | /* AMX_ERR_NOTFOUND */ "File or function is not found", 135 | /* AMX_ERR_INDEX */ "Invalid index parameter (bad entry point)", 136 | /* AMX_ERR_DEBUG */ "Debugger cannot run", 137 | /* AMX_ERR_INIT */ "AMX not initialized (or doubly initialized)", 138 | /* AMX_ERR_USERDATA */ "Unable to set user data field (table full)", 139 | /* AMX_ERR_INIT_JIT */ "Cannot initialize the JIT", 140 | /* AMX_ERR_PARAMS */ "Parameter error", 141 | /* AMX_ERR_DOMAIN */ "Domain error, expression result does not fit in range", 142 | /* AMX_ERR_GENERAL */ "General error (unknown or unspecific error)", 143 | }; 144 | if (errnum < 0 || errnum >= sizeof messages / sizeof messages[0]) 145 | return "(unknown)"; 146 | return messages[errnum]; 147 | } 148 | 149 | int AMXAPI aux_GetSection(AMX *amx, int section, cell **start, size_t *size) 150 | { 151 | AMX_HEADER *hdr; 152 | 153 | if (amx == NULL || start == NULL || size == NULL) 154 | return AMX_ERR_PARAMS; 155 | 156 | hdr = (AMX_HEADER*)amx->base; 157 | switch(section) { 158 | case CODE_SECTION: 159 | *start = (cell *)(amx->base + hdr->cod); 160 | *size = hdr->dat - hdr->cod; 161 | break; 162 | case DATA_SECTION: 163 | *start = (cell *)(amx->data); 164 | *size = hdr->hea - hdr->dat; 165 | break; 166 | case HEAP_SECTION: 167 | *start = (cell *)(amx->data + hdr->hea); 168 | *size = amx->hea - hdr->hea; 169 | break; 170 | case STACK_SECTION: 171 | *start = (cell *)(amx->data + amx->stk); 172 | *size = amx->stp - amx->stk; 173 | break; 174 | default: 175 | return AMX_ERR_PARAMS; 176 | } /* switch */ 177 | return AMX_ERR_NONE; 178 | } 179 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxaux.h: -------------------------------------------------------------------------------- 1 | /* Support routines for the Pawn Abstract Machine 2 | * 3 | * Copyright (c) ITB CompuPhase, 2003-2006 4 | * 5 | * This software is provided "as-is", without any express or implied warranty. 6 | * In no event will the authors be held liable for any damages arising from 7 | * the use of this software. 8 | * 9 | * Permission is granted to anyone to use this software for any purpose, 10 | * including commercial applications, and to alter it and redistribute it 11 | * freely, subject to the following restrictions: 12 | * 13 | * 1. The origin of this software must not be misrepresented; you must not 14 | * claim that you wrote the original software. If you use this software in 15 | * a product, an acknowledgment in the product documentation would be 16 | * appreciated but is not required. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * Version: $Id: amxaux.h 3612 2006-07-22 09:59:46Z thiadmer $ 22 | */ 23 | 24 | #ifndef AMXAUX_H_INCLUDED 25 | #define AMXAUX_H_INCLUDED 26 | 27 | #include "amx.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif 32 | 33 | /* loading and freeing programs */ 34 | size_t AMXAPI aux_ProgramSize(char *filename); 35 | int AMXAPI aux_LoadProgram(AMX *amx, char *filename, void *memblock); 36 | int AMXAPI aux_FreeProgram(AMX *amx); 37 | 38 | /* a readable error message from an error code */ 39 | char * AMXAPI aux_StrError(int errnum); 40 | 41 | enum { 42 | CODE_SECTION, 43 | DATA_SECTION, 44 | HEAP_SECTION, 45 | STACK_SECTION, 46 | /* ----- */ 47 | NUM_SECTIONS 48 | }; 49 | int AMXAPI aux_GetSection(AMX *amx, int section, cell **start, size_t *size); 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif /* AMXAUX_H_INCLUDED */ 56 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxcons.h: -------------------------------------------------------------------------------- 1 | #ifndef AMXCONS_H_INCLUDED 2 | #define AMXCONS_H_INCLUDED 3 | 4 | typedef struct tagFMTINFO { 5 | const cell *params; 6 | int numparams; 7 | int skip; /* number of characters to skip from the beginning */ 8 | int length; /* number of characters to print */ 9 | /* helper functions */ 10 | int (*f_putstr)(void *dest,const TCHAR *); 11 | int (*f_putchar)(void *dest,TCHAR); 12 | void *user; /* user data */ 13 | } AMX_FMTINFO; 14 | 15 | int amx_printstring(AMX *amx,cell *cstr,AMX_FMTINFO *info); 16 | 17 | #endif /* AMXCONS_H_INCLUDED */ 18 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxdef.asm: -------------------------------------------------------------------------------- 1 | ; Definition of the AMX structure for assembler syntax (MASM/TASM/WASM) 2 | 3 | amx_s STRUC 4 | _base DD ? 5 | _dataseg DD ? 6 | _callback DD ? 7 | _debug DD ? 8 | _cip DD ? 9 | _frm DD ? 10 | _hea DD ? 11 | _hlw DD ? 12 | _stk DD ? 13 | _stp DD ? 14 | _flags DD ? 15 | _usertags DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h) 16 | _userdata DD 4 DUP (?) ; 4 = AMX_USERNUM (#define'd in amx.h) 17 | _error DD ? 18 | _paramcount DD ? 19 | _pri DD ? 20 | _alt DD ? 21 | _reset_stk DD ? 22 | _reset_hea DD ? 23 | _syscall_d DD ? 24 | IFDEF JIT 25 | ; the two fields below are for the JIT; they do not exist in 26 | ; the non-JIT version of the abstract machine 27 | _reloc_size DD ? ; memory block for relocations 28 | _code_size DD ? ; memory size of the native code 29 | ENDIF 30 | amx_s ENDS 31 | 32 | amxhead_s STRUC 33 | _size DD ? ; size of the "file" 34 | _magic DW ? ; signature 35 | _file_version DB ? ;file format version 36 | _amx_version DB ? ; required version of the AMX 37 | _h_flags DW ? 38 | _defsize DW ? ; size of one public/native function entry 39 | _cod DD ? ; initial value of COD - code block 40 | _dat DD ? ; initial value of DAT - data block 41 | _h_hea DD ? ; initial value of HEA - start of the heap 42 | _h_stp DD ? ; initial value of STP - stack top 43 | _h_cip DD ? ; initial value of CIP - the instruction pointer 44 | _publics DD ? ; offset to the "public functions" table 45 | _natives DD ? ; offset to the "native functions" table 46 | _libraries DD ? ; offset to the "library" table 47 | _pubvars DD ? ; offset to the "public variables" table 48 | _tags DD ? ; offset to the "public tagnames" table 49 | _nametable DD ? ; offset to the name table, file version 7 only 50 | amxhead_s ENDS 51 | 52 | 53 | AMX_ERR_NONE EQU 0 54 | AMX_ERR_EXIT EQU 1 55 | AMX_ERR_ASSERT EQU 2 56 | AMX_ERR_STACKERR EQU 3 57 | AMX_ERR_BOUNDS EQU 4 58 | AMX_ERR_MEMACCESS EQU 5 59 | AMX_ERR_INVINSTR EQU 6 60 | AMX_ERR_STACKLOW EQU 7 61 | AMX_ERR_HEAPLOW EQU 8 62 | AMX_ERR_CALLBACK EQU 9 63 | AMX_ERR_NATIVE EQU 10 64 | AMX_ERR_DIVIDE EQU 11 ; for catching divide errors 65 | AMX_ERR_SLEEP EQU 12 66 | 67 | AMX_ERR_MEMORY EQU 16 68 | AMX_ERR_FORMAT EQU 17 69 | AMX_ERR_VERSION EQU 18 70 | AMX_ERR_NOTFOUND EQU 19 71 | AMX_ERR_INDEX EQU 20 72 | AMX_ERR_DEBUG EQU 21 73 | AMX_ERR_INIT EQU 22 74 | AMX_ERR_USERDATA EQU 23 75 | AMX_ERR_INIT_JIT EQU 24 76 | AMX_ERR_PARAMS EQU 25 77 | AMX_ERR_DOMAIN EQU 26 78 | AMX_ERR_GENERAL EQU 27 79 | 80 | AMX_FLAG_DEBUG EQU 0002h ; symbolic info. available 81 | AMX_FLAG_COMPACT EQU 0004h 82 | AMX_FLAG_BYTEOPC EQU 0008h 83 | AMX_FLAG_NOCHECKS EQU 0010h 84 | AMX_FLAG_BROWSE EQU 4000h 85 | AMX_FLAG_RELOC EQU 8000h ; jump/call addresses relocated 86 | 87 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxdefn.asm: -------------------------------------------------------------------------------- 1 | ; Definition of the AMX structure for assembler syntax (NASM) 2 | 3 | struc amx_s 4 | _base: resd 1 5 | _dataseg: resd 1 6 | _callback: resd 1 7 | _debug: resd 1 8 | _cip: resd 1 9 | _frm: resd 1 10 | _hea: resd 1 11 | _hlw: resd 1 12 | _stk: resd 1 13 | _stp: resd 1 14 | _flags: resd 1 15 | _usertags: resd 4 ; 4 = AMX_USERNUM (#define'd in amx.h) 16 | _userdata: resd 4 ; 4 = AMX_USERNUM (#define'd in amx.h) 17 | _error: resd 1 18 | _paramcount: resd 1 19 | _pri: resd 1 20 | _alt: resd 1 21 | _reset_stk: resd 1 22 | _reset_hea: resd 1 23 | _syscall_d: resd 1 24 | %ifdef JIT 25 | ; the two fields below are for the JIT; they do not exist in 26 | ; the non-JIT version of the abstract machine 27 | _reloc_size: resd 1 ; memory block for relocations 28 | _code_size: resd 1 ; memory size of the native code 29 | %endif 30 | endstruc 31 | 32 | struc amxhead_s 33 | _size: resd 1 ; size of the "file" 34 | _magic: resw 1 ; signature 35 | _file_version: resb 1; file format version 36 | _amx_version: resb 1 ; required version of the AMX 37 | _h_flags: resw 1 38 | _defsize: resw 1 ; size of one public/native function entry 39 | _cod: resd 1 ; initial value of COD - code block 40 | _dat: resd 1 ; initial value of DAT - data block 41 | _h_hea: resd 1 ; initial value of HEA - start of the heap 42 | _h_stp: resd 1 ; initial value of STP - stack top 43 | _h_cip: resd 1 ; initial value of CIP - the instruction pointer 44 | _publics: resd 1 ; offset to the "public functions" table 45 | _natives: resd 1 ; offset to the "native functions" table 46 | _libraries: resd 1 ; offset to the "library" table 47 | _pubvars: resd 1 ; offset to the "public variables" table 48 | _tags: resd 1 ; offset to the "public tagnames" table 49 | _nametable: resd 1 ; offset to the name table, file version 7 only 50 | endstruc 51 | 52 | 53 | AMX_ERR_NONE EQU 0 54 | AMX_ERR_EXIT EQU 1 55 | AMX_ERR_ASSERT EQU 2 56 | AMX_ERR_STACKERR EQU 3 57 | AMX_ERR_BOUNDS EQU 4 58 | AMX_ERR_MEMACCESS EQU 5 59 | AMX_ERR_INVINSTR EQU 6 60 | AMX_ERR_STACKLOW EQU 7 61 | AMX_ERR_HEAPLOW EQU 8 62 | AMX_ERR_CALLBACK EQU 9 63 | AMX_ERR_NATIVE EQU 10 64 | AMX_ERR_DIVIDE EQU 11 ; for catching divide errors 65 | AMX_ERR_SLEEP EQU 12 66 | 67 | AMX_ERR_MEMORY EQU 16 68 | AMX_ERR_FORMAT EQU 17 69 | AMX_ERR_VERSION EQU 18 70 | AMX_ERR_NOTFOUND EQU 19 71 | AMX_ERR_INDEX EQU 20 72 | AMX_ERR_DEBUG EQU 21 73 | AMX_ERR_INIT EQU 22 74 | AMX_ERR_USERDATA EQU 23 75 | AMX_ERR_INIT_JIT EQU 24 76 | AMX_ERR_PARAMS EQU 25 77 | AMX_ERR_DOMAIN EQU 26 78 | AMX_ERR_GENERAL EQU 27 79 | 80 | AMX_FLAG_DEBUG EQU 0002h ; symbolic info. available 81 | AMX_FLAG_COMPACT EQU 0004h 82 | AMX_FLAG_BYTEOPC EQU 0008h 83 | AMX_FLAG_NOCHECKS EQU 0010h 84 | AMX_FLAG_BROWSE EQU 4000h 85 | AMX_FLAG_RELOC EQU 8000h ; jump/call addresses relocated 86 | 87 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxfile.def: -------------------------------------------------------------------------------- 1 | NAME amxFile 2 | DESCRIPTION 'File I/O support library' 3 | 4 | EXPORTS 5 | amx_FileInit 6 | amx_FileCleanup 7 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxgc.h: -------------------------------------------------------------------------------- 1 | /* Simple garbage collector for the Pawn Abstract Machine 2 | * 3 | * Copyright (c) ITB CompuPhase, 2004-2006 4 | * 5 | * This software is provided "as-is", without any express or implied warranty. 6 | * In no event will the authors be held liable for any damages arising from 7 | * the use of this software. 8 | * 9 | * Permission is granted to anyone to use this software for any purpose, 10 | * including commercial applications, and to alter it and redistribute it 11 | * freely, subject to the following restrictions: 12 | * 13 | * 1. The origin of this software must not be misrepresented; you must not 14 | * claim that you wrote the original software. If you use this software in 15 | * a product, an acknowledgment in the product documentation would be 16 | * appreciated but is not required. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * Version: $Id: amxgc.h 3612 2006-07-22 09:59:46Z thiadmer $ 22 | */ 23 | 24 | #ifndef AMXGC_H 25 | #define AMXGC_H 26 | 27 | typedef void _FAR (* GC_FREE)(cell unreferenced); 28 | enum { 29 | GC_ERR_NONE, 30 | GC_ERR_CALLBACK, /* no callback, or invalid callback */ 31 | GC_ERR_INIT, /* garbage collector not initialized (no table size) */ 32 | GC_ERR_MEMORY, /* insufficient memory to set/resize the table */ 33 | GC_ERR_PARAMS, /* parameter error */ 34 | GC_ERR_TABLEFULL, /* domain error, expression result does not fit in range */ 35 | GC_ERR_DUPLICATE, /* item is already in the table */ 36 | }; 37 | 38 | /* flags */ 39 | #define GC_AUTOGROW 1 /* gc_mark() may grow the hash table when it fills up */ 40 | 41 | int gc_setcallback(GC_FREE callback); 42 | 43 | int gc_settable(int exponent,int flags); 44 | int gc_tablestat(int *exponent,int *percentage); 45 | /* Upon return, "exponent" will hold the values passed to gc_settable(); 46 | * "percentage" is the level (in percent) that the hash table is filled 47 | * up. Either parameter may be set to NULL. 48 | */ 49 | 50 | int gc_mark(cell value); 51 | int gc_scan(AMX *amx); 52 | int gc_clean(void); 53 | 54 | #endif /* AMXGC_H */ 55 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxstring.def: -------------------------------------------------------------------------------- 1 | NAME amxString 2 | DESCRIPTION 'Pawn AMX: string manipulation routines' 3 | 4 | EXPORTS 5 | amx_StringInit 6 | amx_StringCleanup 7 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxstring.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #if defined WIN32 || defined _WIN32 || defined __WIN32__ 3 | # include 4 | #else 5 | # include 6 | #endif 7 | 8 | /* Version information 9 | * 10 | * All strings MUST have an explicit \0. See the Windows SDK documentation 11 | * for details on version information and the VERSIONINFO structure. 12 | */ 13 | #define VERSION 4 14 | #define REVISION 0 15 | #define BUILD 0 16 | #define VERSIONSTR "4.0.0\0" 17 | #define VERSIONNAME "amxString.dll\0" 18 | #define VERSIONDESCRIPTION "Pawn AMX: String manipulation routines\0" 19 | #define VERSIONCOMPANYNAME "ITB CompuPhase\0" 20 | #define VERSIONPRODUCTNAME "amxString\0" 21 | #define VERSIONCOPYRIGHT "Copyright \251 2005-2016 ITB CompuPhase\0" 22 | 23 | VS_VERSION_INFO VERSIONINFO 24 | FILEVERSION VERSION, REVISION, BUILD, 0 25 | PRODUCTVERSION VERSION, REVISION, BUILD, 0 26 | FILEFLAGSMASK 0x0000003FL 27 | FILEFLAGS 0 28 | #if defined(WIN32) 29 | FILEOS VOS__WINDOWS32 30 | #else 31 | FILEOS VOS__WINDOWS16 32 | #endif 33 | FILETYPE VFT_DLL 34 | BEGIN 35 | BLOCK "StringFileInfo" 36 | BEGIN 37 | BLOCK "040904E4" 38 | BEGIN 39 | VALUE "CompanyName", VERSIONCOMPANYNAME 40 | VALUE "FileDescription", VERSIONDESCRIPTION 41 | VALUE "FileVersion", VERSIONSTR 42 | VALUE "InternalName", VERSIONNAME 43 | VALUE "LegalCopyright", VERSIONCOPYRIGHT 44 | VALUE "OriginalFilename", VERSIONNAME 45 | VALUE "ProductName", VERSIONPRODUCTNAME 46 | VALUE "ProductVersion", VERSIONSTR 47 | END 48 | END 49 | 50 | BLOCK "VarFileInfo" 51 | BEGIN 52 | VALUE "Translation", 0x409, 1252 53 | END 54 | END 55 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxtime.def: -------------------------------------------------------------------------------- 1 | NAME amxTime 2 | DESCRIPTION 'Pawn AMX: time routines' 3 | 4 | EXPORTS 5 | amx_TimeInit 6 | amx_TimeCleanup 7 | -------------------------------------------------------------------------------- /amx-deps/src/amx/amxtime.rc: -------------------------------------------------------------------------------- 1 | #include 2 | #if defined WIN32 || defined _WIN32 || defined __WIN32__ 3 | # include 4 | #else 5 | # include 6 | #endif 7 | 8 | /* Version information 9 | * 10 | * All strings MUST have an explicit \0. See the Windows SDK documentation 11 | * for details on version information and the VERSIONINFO structure. 12 | */ 13 | #define VERSION 4 14 | #define REVISION 0 15 | #define BUILD 0 16 | #define VERSIONSTR "4.0.0\0" 17 | #define VERSIONNAME "amxTime.dll\0" 18 | #define VERSIONDESCRIPTION "Pawn AMX: time routines\0" 19 | #define VERSIONCOMPANYNAME "ITB CompuPhase\0" 20 | #define VERSIONPRODUCTNAME "amxTime\0" 21 | #define VERSIONCOPYRIGHT "Copyright \251 2005-2016 ITB CompuPhase\0" 22 | 23 | VS_VERSION_INFO VERSIONINFO 24 | FILEVERSION VERSION, REVISION, BUILD, 0 25 | PRODUCTVERSION VERSION, REVISION, BUILD, 0 26 | FILEFLAGSMASK 0x0000003FL 27 | FILEFLAGS 0 28 | #if defined(WIN32) 29 | FILEOS VOS__WINDOWS32 30 | #else 31 | FILEOS VOS__WINDOWS16 32 | #endif 33 | FILETYPE VFT_DLL 34 | BEGIN 35 | BLOCK "StringFileInfo" 36 | BEGIN 37 | BLOCK "040904E4" 38 | BEGIN 39 | VALUE "CompanyName", VERSIONCOMPANYNAME 40 | VALUE "FileDescription", VERSIONDESCRIPTION 41 | VALUE "FileVersion", VERSIONSTR 42 | VALUE "InternalName", VERSIONNAME 43 | VALUE "LegalCopyright", VERSIONCOPYRIGHT 44 | VALUE "OriginalFilename", VERSIONNAME 45 | VALUE "ProductName", VERSIONPRODUCTNAME 46 | VALUE "ProductVersion", VERSIONSTR 47 | END 48 | END 49 | 50 | BLOCK "VarFileInfo" 51 | BEGIN 52 | VALUE "Translation", 0x409, 1252 53 | END 54 | END 55 | -------------------------------------------------------------------------------- /amx-deps/src/amx/dllmain.c: -------------------------------------------------------------------------------- 1 | /* DLL support functions for dynamically loadable extension libraries. 2 | * 3 | * Copyright (c) ITB CompuPhase, 2004-2005 4 | * 5 | * This software is provided "as-is", without any express or implied warranty. 6 | * In no event will the authors be held liable for any damages arising from 7 | * the use of this software. 8 | * 9 | * Permission is granted to anyone to use this software for any purpose, 10 | * including commercial applications, and to alter it and redistribute it 11 | * freely, subject to the following restrictions: 12 | * 13 | * 1. The origin of this software must not be misrepresented; you must not 14 | * claim that you wrote the original software. If you use this software in 15 | * a product, an acknowledgment in the product documentation would be 16 | * appreciated but is not required. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * Version: $Id: dllmain.c 3363 2005-07-23 09:03:29Z thiadmer $ 22 | */ 23 | 24 | #if defined _UNICODE || defined __UNICODE__ || defined UNICODE 25 | # if !defined UNICODE /* for Windows */ 26 | # define UNICODE 27 | # endif 28 | # if !defined _UNICODE /* for C library */ 29 | # define _UNICODE 30 | # endif 31 | #endif 32 | 33 | #include 34 | #include 35 | 36 | #if !defined UNUSED_PARAM 37 | #define UNUSED_PARAM(p) ((void)(p)) 38 | #endif 39 | 40 | HINSTANCE hinstDLL; 41 | 42 | /* Especially Watcom C/C++ does not like DLLs that do not have a LibMain() 43 | * set. Apparently, the start address is not set well, and some required 44 | * initializations are not done. 45 | */ 46 | #if defined __WIN32__ || defined _WIN32 || defined WIN32 47 | 48 | BOOL WINAPI DllMain(HINSTANCE hinst, DWORD dwReason, LPVOID lpRes) 49 | { 50 | UNUSED_PARAM(lpRes); 51 | switch (dwReason) { 52 | case DLL_PROCESS_ATTACH: 53 | hinstDLL=hinst; 54 | break; 55 | case DLL_PROCESS_DETACH: 56 | break; 57 | } /* switch */ 58 | return TRUE; 59 | } 60 | 61 | #else 62 | 63 | int FAR PASCAL LibMain(HINSTANCE hinst, WORD wDataSeg, WORD wHeapSize, LPSTR lpszCmdLine) 64 | { 65 | UNUSED_PARAM(wDataSeg); 66 | UNUSED_PARAM(wHeapSize); 67 | UNUSED_PARAM(lpszCmdLine); 68 | hinstDLL=hinst; 69 | return 1; 70 | } 71 | 72 | int FAR PASCAL _export WEP(int param) 73 | { 74 | UNUSED_PARAM(param); 75 | return 1; 76 | } 77 | 78 | #endif /* __WIN32__ */ 79 | 80 | -------------------------------------------------------------------------------- /amx-deps/src/amx/fpattern.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-deps/src/amx/fpattern.h -------------------------------------------------------------------------------- /amx-deps/src/amx/minGlue.h: -------------------------------------------------------------------------------- 1 | /* Glue functions for the minIni library, based on the C/C++ stdio library 2 | * 3 | * Or better said: this file contains macros that maps the function interface 4 | * used by minIni to the standard C/C++ file I/O functions. 5 | * 6 | * By CompuPhase, 2008-2014 7 | * This "glue file" is in the public domain. It is distributed without 8 | * warranties or conditions of any kind, either express or implied. 9 | */ 10 | 11 | /* map required file I/O types and functions to the standard C library */ 12 | #include 13 | 14 | #define INI_FILETYPE FILE* 15 | #define ini_openread(filename,file) ((*(file) = fopen((filename),"rb")) != NULL) 16 | #define ini_openwrite(filename,file) ((*(file) = fopen((filename),"wb")) != NULL) 17 | #define ini_openrewrite(filename,file) ((*(file) = fopen((filename),"r+b")) != NULL) 18 | #define ini_close(file) (fclose(*(file)) == 0) 19 | #define ini_read(buffer,size,file) (fgets((buffer),(size),*(file)) != NULL) 20 | #define ini_write(buffer,file) (fputs((buffer),*(file)) >= 0) 21 | #define ini_rename(source,dest) (rename((source), (dest)) == 0) 22 | #define ini_remove(filename) (remove(filename) == 0) 23 | 24 | #define INI_FILEPOS long int 25 | #define ini_tell(file,pos) (*(pos) = ftell(*(file))) 26 | #define ini_seek(file,pos) (fseek(*(file), *(pos), SEEK_SET) == 0) 27 | 28 | /* for floating-point support, define additional types and functions */ 29 | #define INI_REAL float 30 | #define ini_ftoa(string,value) sprintf((string),"%f",(value)) 31 | #define ini_atof(string) (INI_REAL)strtod((string),NULL) 32 | -------------------------------------------------------------------------------- /amx-deps/src/amx/minIni.h: -------------------------------------------------------------------------------- 1 | /* minIni - Multi-Platform INI file parser, suitable for embedded systems 2 | * 3 | * Copyright (c) CompuPhase, 2008-2012 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | * use this file except in compliance with the License. You may obtain a copy 7 | * of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | * License for the specific language governing permissions and limitations 15 | * under the License. 16 | * 17 | * Version: $Id: minIni.h 5181 2015-01-21 09:44:28Z thiadmer $ 18 | */ 19 | #ifndef MININI_H 20 | #define MININI_H 21 | 22 | #include "minGlue.h" 23 | 24 | #if (defined _UNICODE || defined __UNICODE__ || defined UNICODE) && !defined INI_ANSIONLY 25 | #include 26 | #define mTCHAR TCHAR 27 | #else 28 | /* force TCHAR to be "char", but only for minIni */ 29 | #define mTCHAR char 30 | #endif 31 | 32 | #if !defined INI_BUFFERSIZE 33 | #define INI_BUFFERSIZE 512 34 | #endif 35 | 36 | #if defined __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | int ini_getbool(const mTCHAR *Section, const mTCHAR *Key, int DefValue, const mTCHAR *Filename); 41 | long ini_getl(const mTCHAR *Section, const mTCHAR *Key, long DefValue, const mTCHAR *Filename); 42 | int ini_gets(const mTCHAR *Section, const mTCHAR *Key, const mTCHAR *DefValue, mTCHAR *Buffer, int BufferSize, const mTCHAR *Filename); 43 | int ini_getsection(int idx, mTCHAR *Buffer, int BufferSize, const mTCHAR *Filename); 44 | int ini_getkey(const mTCHAR *Section, int idx, mTCHAR *Buffer, int BufferSize, const mTCHAR *Filename); 45 | 46 | #if defined INI_REAL 47 | INI_REAL ini_getf(const mTCHAR *Section, const mTCHAR *Key, INI_REAL DefValue, const mTCHAR *Filename); 48 | #endif 49 | 50 | #if !defined INI_READONLY 51 | int ini_putl(const mTCHAR *Section, const mTCHAR *Key, long Value, const mTCHAR *Filename); 52 | int ini_puts(const mTCHAR *Section, const mTCHAR *Key, const mTCHAR *Value, const mTCHAR *Filename); 53 | #if defined INI_REAL 54 | int ini_putf(const mTCHAR *Section, const mTCHAR *Key, INI_REAL Value, const mTCHAR *Filename); 55 | #endif 56 | #endif /* INI_READONLY */ 57 | 58 | #if !defined INI_NOBROWSE 59 | typedef int (*INI_CALLBACK)(const mTCHAR *Section, const mTCHAR *Key, const mTCHAR *Value, const void *UserData); 60 | int ini_browse(INI_CALLBACK Callback, const void *UserData, const mTCHAR *Filename); 61 | #endif /* INI_NOBROWSE */ 62 | 63 | #if defined __cplusplus 64 | } 65 | #endif 66 | 67 | 68 | #if defined __cplusplus 69 | 70 | #if defined __WXWINDOWS__ 71 | #include "wxMinIni.h" 72 | #else 73 | #include 74 | 75 | /* The C++ class in minIni.h was contributed by Steven Van Ingelgem. */ 76 | class minIni 77 | { 78 | public: 79 | minIni(const std::string& filename) : iniFilename(filename) 80 | { } 81 | 82 | bool getbool(const std::string& Section, const std::string& Key, bool DefValue=false) const 83 | { return ini_getbool(Section.c_str(), Key.c_str(), int(DefValue), iniFilename.c_str()) != 0; } 84 | 85 | long getl(const std::string& Section, const std::string& Key, long DefValue=0) const 86 | { return ini_getl(Section.c_str(), Key.c_str(), DefValue, iniFilename.c_str()); } 87 | 88 | int geti(const std::string& Section, const std::string& Key, int DefValue=0) const 89 | { return static_cast(this->getl(Section, Key, long(DefValue))); } 90 | 91 | std::string gets(const std::string& Section, const std::string& Key, const std::string& DefValue="") const 92 | { 93 | char buffer[INI_BUFFERSIZE]; 94 | ini_gets(Section.c_str(), Key.c_str(), DefValue.c_str(), buffer, INI_BUFFERSIZE, iniFilename.c_str()); 95 | return buffer; 96 | } 97 | 98 | std::string getsection(int idx) const 99 | { 100 | char buffer[INI_BUFFERSIZE]; 101 | ini_getsection(idx, buffer, INI_BUFFERSIZE, iniFilename.c_str()); 102 | return buffer; 103 | } 104 | 105 | std::string getkey(const std::string& Section, int idx) const 106 | { 107 | char buffer[INI_BUFFERSIZE]; 108 | ini_getkey(Section.c_str(), idx, buffer, INI_BUFFERSIZE, iniFilename.c_str()); 109 | return buffer; 110 | } 111 | 112 | #if defined INI_REAL 113 | INI_REAL getf(const std::string& Section, const std::string& Key, INI_REAL DefValue=0) const 114 | { return ini_getf(Section.c_str(), Key.c_str(), DefValue, iniFilename.c_str()); } 115 | #endif 116 | 117 | #if ! defined INI_READONLY 118 | bool put(const std::string& Section, const std::string& Key, long Value) const 119 | { return ini_putl(Section.c_str(), Key.c_str(), Value, iniFilename.c_str()) != 0; } 120 | 121 | bool put(const std::string& Section, const std::string& Key, int Value) const 122 | { return ini_putl(Section.c_str(), Key.c_str(), (long)Value, iniFilename.c_str()) != 0; } 123 | 124 | bool put(const std::string& Section, const std::string& Key, bool Value) const 125 | { return ini_putl(Section.c_str(), Key.c_str(), (long)Value, iniFilename.c_str()) != 0; } 126 | 127 | bool put(const std::string& Section, const std::string& Key, const std::string& Value) const 128 | { return ini_puts(Section.c_str(), Key.c_str(), Value.c_str(), iniFilename.c_str()) != 0; } 129 | 130 | bool put(const std::string& Section, const std::string& Key, const char* Value) const 131 | { return ini_puts(Section.c_str(), Key.c_str(), Value, iniFilename.c_str()) != 0; } 132 | 133 | #if defined INI_REAL 134 | bool put(const std::string& Section, const std::string& Key, INI_REAL Value) const 135 | { return ini_putf(Section.c_str(), Key.c_str(), Value, iniFilename.c_str()) != 0; } 136 | #endif 137 | 138 | bool del(const std::string& Section, const std::string& Key) const 139 | { return ini_puts(Section.c_str(), Key.c_str(), 0, iniFilename.c_str()) != 0; } 140 | 141 | bool del(const std::string& Section) const 142 | { return ini_puts(Section.c_str(), 0, 0, iniFilename.c_str()) != 0; } 143 | #endif 144 | 145 | private: 146 | std::string iniFilename; 147 | }; 148 | 149 | #endif /* __WXWINDOWS__ */ 150 | #endif /* __cplusplus */ 151 | 152 | #endif /* MININI_H */ 153 | -------------------------------------------------------------------------------- /amx-deps/src/amx/osdefs.h: -------------------------------------------------------------------------------- 1 | /* __MSDOS__ set when compiling for DOS (not Windows) 2 | * _Windows set when compiling for any version of Microsoft Windows 3 | * __WIN32__ set when compiling for Windows95 or WindowsNT (32 bit mode) 4 | * __32BIT__ set when compiling in 32-bit "flat" mode (DOS or Windows) 5 | * 6 | * Copyright 1998-2005, ITB CompuPhase, The Netherlands. 7 | * info@compuphase.com. 8 | */ 9 | 10 | #ifndef _OSDEFS_H 11 | #define _OSDEFS_H 12 | 13 | /* Every compiler uses different "default" macros to indicate the mode 14 | * it is in. Throughout the source, we use the Borland C++ macros, so 15 | * the macros of Watcom C/C++ and Microsoft Visual C/C++ are mapped to 16 | * those of Borland C++. 17 | */ 18 | #if defined(__WATCOMC__) 19 | # if defined(__WINDOWS__) || defined(__NT__) 20 | # define _Windows 1 21 | # endif 22 | # ifdef __386__ 23 | # define __32BIT__ 1 24 | # endif 25 | # if defined(_Windows) && defined(__32BIT__) 26 | # define __WIN32__ 1 27 | # endif 28 | #elif defined(_MSC_VER) 29 | # if defined(_WINDOWS) || defined(_WIN32) 30 | # define _Windows 1 31 | # endif 32 | # ifdef _WIN32 33 | # define __WIN32__ 1 34 | # define __32BIT__ 1 35 | # endif 36 | #endif 37 | 38 | #if defined __FreeBSD__ 39 | #include 40 | #elif defined __APPLE__ 41 | #include 42 | #elif defined LINUX 43 | #include 44 | #endif 45 | 46 | /* Linux NOW has these */ 47 | #if !defined BIG_ENDIAN 48 | #define BIG_ENDIAN 4321 49 | #endif 50 | #if !defined LITTLE_ENDIAN 51 | #define LITTLE_ENDIAN 1234 52 | #endif 53 | 54 | /* educated guess, BYTE_ORDER is undefined, i386 is common => little endian */ 55 | #if !defined BYTE_ORDER 56 | #if defined UCLINUX 57 | #define BYTE_ORDER BIG_ENDIAN 58 | #else 59 | #define BYTE_ORDER LITTLE_ENDIAN 60 | #endif 61 | #endif 62 | 63 | #if defined __MSDOS__ || defined __WIN32__ || defined _Windows 64 | #define DIRSEP_CHAR '\\' 65 | #elif defined macintosh 66 | #define DIRSEP_CHAR ':' 67 | #else 68 | #define DIRSEP_CHAR '/' /* directory separator character */ 69 | #endif 70 | 71 | /* _MAX_PATH is sometimes called differently and it may be in limits.h or 72 | * stdlib.h instead of stdio.h. 73 | */ 74 | #if !defined _MAX_PATH 75 | /* not defined, perhaps stdio.h was not included */ 76 | #if !defined PATH_MAX 77 | #include 78 | #endif 79 | #if !defined _MAX_PATH && !defined PATH_MAX 80 | /* no _MAX_PATH and no MAX_PATH, perhaps it is in limits.h */ 81 | #include 82 | #endif 83 | #if !defined _MAX_PATH && !defined PATH_MAX 84 | /* no _MAX_PATH and no MAX_PATH, perhaps it is in stdlib.h */ 85 | #include 86 | #endif 87 | /* if _MAX_PATH is undefined, try common alternative names */ 88 | #if !defined _MAX_PATH 89 | #if defined MAX_PATH 90 | #define _MAX_PATH MAX_PATH 91 | #elif defined _POSIX_PATH_MAX 92 | #define _MAX_PATH _POSIX_PATH_MAX 93 | #else 94 | /* everything failed, actually we have a problem here... */ 95 | #define _MAX_PATH 1024 96 | #endif 97 | #endif 98 | #endif 99 | 100 | #endif /* _OSDEFS_H */ 101 | -------------------------------------------------------------------------------- /amx-deps/src/amx/premake5.lua: -------------------------------------------------------------------------------- 1 | local amxfiles = { 2 | "amx.c", 3 | "amxaux.c", 4 | "amxcons.c", 5 | "amxcore.c", 6 | "amxfile.c", 7 | "amxstring.c", 8 | "amxtime.c", 9 | "amxfloat.c", 10 | } 11 | 12 | project "amx" 13 | language "C++" 14 | kind "StaticLib" 15 | 16 | defines { 17 | -- From original project, but causes crashes? 18 | -- "AMX_DONT_RELOCATE" 19 | "FLOATPOINT", 20 | } 21 | 22 | filter "system:windows" 23 | -- "__WIN32__" needed for amx 24 | defines { "__WIN32__" } 25 | 26 | vpaths { 27 | ["Headers/*"] = {"**.h", "../linux/**.h"}, 28 | ["Sources/*"] = amxfiles, 29 | } 30 | 31 | files { 32 | amxfiles, 33 | } 34 | 35 | filter "system:linux" 36 | files { "../linux/getch.c" } 37 | 38 | filter "system:linux" 39 | includedirs { "../linux" } 40 | 41 | filter "system:windows" 42 | links { "winmm" } -------------------------------------------------------------------------------- /amx-deps/src/amx/term_ga.h: -------------------------------------------------------------------------------- 1 | /* Simple terminal using GraphApp 2 | * 3 | * Copyright (c) ITB CompuPhase, 2004-2006 4 | * 5 | * This software is provided "as-is", without any express or implied warranty. 6 | * In no event will the authors be held liable for any damages arising from 7 | * the use of this software. 8 | * 9 | * Permission is granted to anyone to use this software for any purpose, 10 | * including commercial applications, and to alter it and redistribute it 11 | * freely, subject to the following restrictions: 12 | * 13 | * 1. The origin of this software must not be misrepresented; you must not 14 | * claim that you wrote the original software. If you use this software in 15 | * a product, an acknowledgment in the product documentation would be 16 | * appreciated but is not required. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * This file may be freely used. No warranties of any kind. 21 | * 22 | * Version: $Id: term_ga.h 3519 2006-02-17 17:57:04Z thiadmer $ 23 | */ 24 | 25 | #if !defined TERMGA_H_INCLUDED 26 | #define TERMGA_H_INCLUDED 27 | 28 | #if defined _UNICODE || defined __UNICODE__ || defined UNICODE 29 | # if !defined UNICODE /* for Windows */ 30 | # define UNICODE 31 | # endif 32 | # if !defined _UNICODE /* for C library */ 33 | # define _UNICODE 34 | # endif 35 | #endif 36 | 37 | #if defined _UNICODE 38 | # include 39 | #elif !defined __T 40 | typedef char TCHAR; 41 | # define __T(string) string 42 | # define _tcschr strchr 43 | # define _tcscpy strcpy 44 | # define _tcsdup strdup 45 | # define _tcslen strlen 46 | # define _stprintf sprintf 47 | # define _vstprintf vsprintf 48 | #endif 49 | 50 | #ifdef __cplusplus 51 | extern "C" { 52 | #endif 53 | 54 | int createconsole(int argc, char *argv[]); 55 | int deleteconsole(void); 56 | 57 | int amx_printf(const TCHAR*,...); 58 | int amx_putstr(const TCHAR*); 59 | int amx_putchar(int); 60 | int amx_fflush(void); 61 | int amx_kbhit(void); 62 | int amx_getch(void); 63 | TCHAR* amx_gets(TCHAR*,int); 64 | int amx_termctl(int,int); 65 | void amx_clrscr(void); 66 | void amx_clreol(void); 67 | void amx_gotoxy(int x,int y); 68 | void amx_wherexy(int *x,int *y); 69 | unsigned amx_setattr(int foregr,int backgr,int highlight); 70 | void amx_console(int columns, int lines, int flags); 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | 76 | #endif /* TERMGA_H_INCLUDED */ 77 | -------------------------------------------------------------------------------- /amx-deps/src/amx/termwin.h: -------------------------------------------------------------------------------- 1 | /* Simple terminal for Microsoft Windows 2 | * 3 | * Copyright (c) ITB CompuPhase, 2004-2006 4 | * 5 | * This software is provided "as-is", without any express or implied warranty. 6 | * In no event will the authors be held liable for any damages arising from 7 | * the use of this software. 8 | * 9 | * Permission is granted to anyone to use this software for any purpose, 10 | * including commercial applications, and to alter it and redistribute it 11 | * freely, subject to the following restrictions: 12 | * 13 | * 1. The origin of this software must not be misrepresented; you must not 14 | * claim that you wrote the original software. If you use this software in 15 | * a product, an acknowledgment in the product documentation would be 16 | * appreciated but is not required. 17 | * 2. Altered source versions must be plainly marked as such, and must not be 18 | * misrepresented as being the original software. 19 | * 3. This notice may not be removed or altered from any source distribution. 20 | * 21 | * Version: $Id: termwin.h 3519 2006-02-17 17:57:04Z thiadmer $ 22 | */ 23 | 24 | #if !defined TERMWIN_H_INCLUDED 25 | #define TERMWIN_H_INCLUDED 26 | 27 | #if defined _UNICODE || defined __UNICODE__ || defined UNICODE 28 | # if !defined UNICODE /* for Windows */ 29 | # define UNICODE 30 | # endif 31 | # if !defined _UNICODE /* for C library */ 32 | # define _UNICODE 33 | # endif 34 | #endif 35 | 36 | #if !defined WM_NULL 37 | # include 38 | #endif 39 | #if defined _UNICODE 40 | # include 41 | #elif !defined __T 42 | typedef char TCHAR; 43 | # define __T(string) string 44 | # define _tcschr strchr 45 | # define _tcscpy strcpy 46 | # define _tcsdup strdup 47 | # define _tcslen strlen 48 | # define _stprintf sprintf 49 | # define _vstprintf vsprintf 50 | #endif 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | HWND CreateConsole(HINSTANCE hinst,HWND hwndParent,int columns,int lines,int bufferlines,int fontsize,DWORD style); 57 | BOOL SetActiveConsole(HWND hconsole); 58 | BOOL DeleteConsole(HWND hconsole); 59 | HWND GetConsoleByIndex(int index); 60 | 61 | int amx_printf(const TCHAR*,...); 62 | int amx_putstr(const TCHAR*); 63 | int amx_putchar(int); 64 | int amx_fflush(void); 65 | int amx_kbhit(void); 66 | int amx_getch(void); 67 | TCHAR* amx_gets(TCHAR*,int); 68 | int amx_termctl(int,int); 69 | void amx_clrscr(void); 70 | void amx_clreol(void); 71 | void amx_gotoxy(int x,int y); 72 | void amx_wherexy(int *x,int *y); 73 | unsigned amx_setattr(int foregr,int backgr,int highlight); 74 | void amx_console(int columns, int lines, int flags); 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif /* TERMWIN_H_INCLUDED */ 81 | -------------------------------------------------------------------------------- /amx-deps/src/include/ILuaModuleManager.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * PROJECT: Multi Theft Auto v1.0 4 | * LICENSE: See LICENSE in the top level directory 5 | * FILE: publicsdk/include/ILuaModuleManager.h 6 | * PURPOSE: Lua dynamic module interface 7 | * 8 | * Multi Theft Auto is available from http://www.multitheftauto.com/ 9 | * 10 | *****************************************************************************/ 11 | 12 | // INTERFACE for Lua dynamic modules 13 | 14 | #pragma once 15 | 16 | #define MAX_INFO_LENGTH 128 17 | 18 | extern "C" 19 | { 20 | #include 21 | #include 22 | #include 23 | } 24 | #include 25 | 26 | #ifndef __CChecksum_H 27 | class CChecksum 28 | { 29 | public: 30 | unsigned long ulCRC; 31 | unsigned char mD5[16]; 32 | }; 33 | #endif 34 | 35 | /* Interface for modules until DP2.3 */ 36 | class ILuaModuleManager 37 | { 38 | public: 39 | virtual void ErrorPrintf(const char* szFormat, ...) = 0; 40 | virtual void DebugPrintf(lua_State* luaVM, const char* szFormat, ...) = 0; 41 | virtual void Printf(const char* szFormat, ...) = 0; 42 | 43 | virtual bool RegisterFunction(lua_State* luaVM, const char* szFunctionName, lua_CFunction Func) = 0; 44 | virtual bool GetResourceName( 45 | lua_State* luaVM, std::string& strName) = 0; // This function might not work if module and MTA were compiled with different compiler versions 46 | virtual CChecksum GetResourceMetaChecksum(lua_State* luaVM) = 0; 47 | virtual CChecksum GetResourceFileChecksum(lua_State* luaVM, const char* szFile) = 0; 48 | }; 49 | 50 | /* Interface for modules until 1.0 */ 51 | class ILuaModuleManager10 : public ILuaModuleManager 52 | { 53 | public: 54 | virtual unsigned long GetVersion() = 0; 55 | virtual const char* GetVersionString() = 0; 56 | virtual const char* GetVersionName() = 0; 57 | virtual unsigned long GetNetcodeVersion() = 0; 58 | virtual const char* GetOperatingSystemName() = 0; 59 | 60 | virtual lua_State* GetResourceFromName(const char* szResourceName) = 0; 61 | 62 | // GetResourceName above doesn't work if module and MTA were compiled with different compiler versions 63 | virtual bool GetResourceName(lua_State* luaVM, char* szName, size_t length) = 0; 64 | virtual bool GetResourceFilePath(lua_State* luaVM, const char* fileName, char* path, size_t length) = 0; 65 | }; 66 | -------------------------------------------------------------------------------- /amx-deps/src/include/lapi.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lapi.h,v 2.2.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions from Lua API 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lapi_h 8 | #define lapi_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /amx-deps/src/include/lcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Code generator for Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lcode_h 8 | #define lcode_h 9 | 10 | #include "llex.h" 11 | #include "lobject.h" 12 | #include "lopcodes.h" 13 | #include "lparser.h" 14 | 15 | 16 | /* 17 | ** Marks the end of a patch list. It is an invalid value both as an absolute 18 | ** address, and as a list link (would link an element to itself). 19 | */ 20 | #define NO_JUMP (-1) 21 | 22 | 23 | /* 24 | ** grep "ORDER OPR" if you change these enums 25 | */ 26 | typedef enum BinOpr { 27 | OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, 28 | OPR_CONCAT, 29 | OPR_NE, OPR_EQ, 30 | OPR_LT, OPR_LE, OPR_GT, OPR_GE, 31 | OPR_AND, OPR_OR, 32 | OPR_NOBINOPR 33 | } BinOpr; 34 | 35 | 36 | typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; 37 | 38 | 39 | #define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) 40 | 41 | #define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) 42 | 43 | #define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) 44 | 45 | LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); 46 | LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); 47 | LUAI_FUNC void luaK_fixline (FuncState *fs, int line); 48 | LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); 49 | LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); 50 | LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); 51 | LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); 52 | LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); 53 | LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); 54 | LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); 55 | LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); 56 | LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); 57 | LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); 58 | LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); 59 | LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); 60 | LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); 61 | LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); 62 | LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); 63 | LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); 64 | LUAI_FUNC int luaK_jump (FuncState *fs); 65 | LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); 66 | LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); 67 | LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); 68 | LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); 69 | LUAI_FUNC int luaK_getlabel (FuncState *fs); 70 | LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v); 71 | LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); 72 | LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2); 73 | LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); 74 | 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /amx-deps/src/include/ldebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions from Debug Interface module 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldebug_h 8 | #define ldebug_h 9 | 10 | 11 | #include "lstate.h" 12 | 13 | 14 | #define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) 15 | 16 | #define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) 17 | 18 | #define resethookcount(L) (L->hookcount = L->basehookcount) 19 | 20 | 21 | LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, 22 | const char *opname); 23 | LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); 24 | LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, 25 | const TValue *p2); 26 | LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, 27 | const TValue *p2); 28 | LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); 29 | LUAI_FUNC void luaG_errormsg (lua_State *L); 30 | LUAI_FUNC int luaG_checkcode (const Proto *pt); 31 | LUAI_FUNC int luaG_checkopenop (Instruction i); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /amx-deps/src/include/ldo.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ldo.h,v 2.7.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Stack and Call structure of Lua 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ldo_h 8 | #define ldo_h 9 | 10 | 11 | #include "lobject.h" 12 | #include "lstate.h" 13 | #include "lzio.h" 14 | 15 | 16 | #define luaD_checkstack(L,n) \ 17 | if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \ 18 | luaD_growstack(L, n); \ 19 | else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); 20 | 21 | 22 | #define incr_top(L) {luaD_checkstack(L,1); L->top++;} 23 | 24 | #define savestack(L,p) ((char *)(p) - (char *)L->stack) 25 | #define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) 26 | 27 | #define saveci(L,p) ((char *)(p) - (char *)L->base_ci) 28 | #define restoreci(L,n) ((CallInfo *)((char *)L->base_ci + (n))) 29 | 30 | 31 | /* results from luaD_precall */ 32 | #define PCRLUA 0 /* initiated a call to a Lua function */ 33 | #define PCRC 1 /* did a call to a C function */ 34 | #define PCRYIELD 2 /* C funtion yielded */ 35 | 36 | 37 | /* type of protected functions, to be ran by `runprotected' */ 38 | typedef void (*Pfunc) (lua_State *L, void *ud); 39 | 40 | LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); 41 | LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); 42 | LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); 43 | LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); 44 | LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, 45 | ptrdiff_t oldtop, ptrdiff_t ef); 46 | LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult); 47 | LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); 48 | LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); 49 | LUAI_FUNC void luaD_growstack (lua_State *L, int n); 50 | 51 | LUAI_FUNC void luaD_throw (lua_State *L, int errcode); 52 | LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); 53 | 54 | LUAI_FUNC void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop); 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /amx-deps/src/include/lfunc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lfunc.h,v 2.4.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Auxiliary functions to manipulate prototypes and closures 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lfunc_h 8 | #define lfunc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ 15 | cast(int, sizeof(TValue)*((n)-1))) 16 | 17 | #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ 18 | cast(int, sizeof(TValue *)*((n)-1))) 19 | 20 | 21 | LUAI_FUNC Proto *luaF_newproto (lua_State *L); 22 | LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); 23 | LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); 24 | LUAI_FUNC UpVal *luaF_newupval (lua_State *L); 25 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 26 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); 27 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 28 | LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); 29 | LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); 30 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 31 | int pc); 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /amx-deps/src/include/lgc.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Garbage Collector 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lgc_h 8 | #define lgc_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | /* 15 | ** Possible states of the Garbage Collector 16 | */ 17 | #define GCSpause 0 18 | #define GCSpropagate 1 19 | #define GCSsweepstring 2 20 | #define GCSsweep 3 21 | #define GCSfinalize 4 22 | 23 | 24 | /* 25 | ** some userful bit tricks 26 | */ 27 | #define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) 28 | #define setbits(x,m) ((x) |= (m)) 29 | #define testbits(x,m) ((x) & (m)) 30 | #define bitmask(b) (1<<(b)) 31 | #define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) 32 | #define l_setbit(x,b) setbits(x, bitmask(b)) 33 | #define resetbit(x,b) resetbits(x, bitmask(b)) 34 | #define testbit(x,b) testbits(x, bitmask(b)) 35 | #define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) 36 | #define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) 37 | #define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) 38 | 39 | 40 | 41 | /* 42 | ** Layout for bit use in `marked' field: 43 | ** bit 0 - object is white (type 0) 44 | ** bit 1 - object is white (type 1) 45 | ** bit 2 - object is black 46 | ** bit 3 - for userdata: has been finalized 47 | ** bit 3 - for tables: has weak keys 48 | ** bit 4 - for tables: has weak values 49 | ** bit 5 - object is fixed (should not be collected) 50 | ** bit 6 - object is "super" fixed (only the main thread) 51 | */ 52 | 53 | 54 | #define WHITE0BIT 0 55 | #define WHITE1BIT 1 56 | #define BLACKBIT 2 57 | #define FINALIZEDBIT 3 58 | #define KEYWEAKBIT 3 59 | #define VALUEWEAKBIT 4 60 | #define FIXEDBIT 5 61 | #define SFIXEDBIT 6 62 | #define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) 63 | 64 | 65 | #define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) 66 | #define isblack(x) testbit((x)->gch.marked, BLACKBIT) 67 | #define isgray(x) (!isblack(x) && !iswhite(x)) 68 | 69 | #define otherwhite(g) (g->currentwhite ^ WHITEBITS) 70 | #define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) 71 | 72 | #define changewhite(x) ((x)->gch.marked ^= WHITEBITS) 73 | #define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) 74 | 75 | #define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) 76 | 77 | #define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) 78 | 79 | 80 | #define luaC_checkGC(L) { \ 81 | condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ 82 | if (G(L)->totalbytes >= G(L)->GCthreshold) \ 83 | luaC_step(L); } 84 | 85 | 86 | #define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ 87 | luaC_barrierf(L,obj2gco(p),gcvalue(v)); } 88 | 89 | #define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ 90 | luaC_barrierback(L,t); } 91 | 92 | #define luaC_objbarrier(L,p,o) \ 93 | { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ 94 | luaC_barrierf(L,obj2gco(p),obj2gco(o)); } 95 | 96 | #define luaC_objbarriert(L,t,o) \ 97 | { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } 98 | 99 | LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); 100 | LUAI_FUNC void luaC_callGCTM (lua_State *L); 101 | LUAI_FUNC void luaC_freeall (lua_State *L); 102 | LUAI_FUNC void luaC_step (lua_State *L); 103 | LUAI_FUNC void luaC_fullgc (lua_State *L); 104 | LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); 105 | LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); 106 | LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); 107 | LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t); 108 | 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /amx-deps/src/include/llex.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: llex.h,v 1.58.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lexical Analyzer 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef llex_h 8 | #define llex_h 9 | 10 | #include "lobject.h" 11 | #include "lzio.h" 12 | 13 | 14 | #define FIRST_RESERVED 257 15 | 16 | /* maximum length of a reserved word */ 17 | #define TOKEN_LEN (sizeof("function")/sizeof(char)) 18 | 19 | 20 | /* 21 | * WARNING: if you change the order of this enumeration, 22 | * grep "ORDER RESERVED" 23 | */ 24 | enum RESERVED { 25 | /* terminal symbols denoted by reserved words */ 26 | TK_AND = FIRST_RESERVED, TK_BREAK, 27 | TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, 28 | TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, 29 | TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, 30 | /* other terminal symbols */ 31 | TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER, 32 | TK_NAME, TK_STRING, TK_EOS 33 | }; 34 | 35 | /* number of reserved words */ 36 | #define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) 37 | 38 | 39 | /* array with token `names' */ 40 | LUAI_DATA const char *const luaX_tokens []; 41 | 42 | 43 | typedef union { 44 | lua_Number r; 45 | TString *ts; 46 | } SemInfo; /* semantics information */ 47 | 48 | 49 | typedef struct Token { 50 | int token; 51 | SemInfo seminfo; 52 | } Token; 53 | 54 | 55 | typedef struct LexState { 56 | int current; /* current character (charint) */ 57 | int linenumber; /* input line counter */ 58 | int lastline; /* line of last token `consumed' */ 59 | Token t; /* current token */ 60 | Token lookahead; /* look ahead token */ 61 | struct FuncState *fs; /* `FuncState' is private to the parser */ 62 | struct lua_State *L; 63 | ZIO *z; /* input stream */ 64 | Mbuffer *buff; /* buffer for tokens */ 65 | TString *source; /* current source name */ 66 | char decpoint; /* locale decimal point */ 67 | } LexState; 68 | 69 | 70 | LUAI_FUNC void luaX_init (lua_State *L); 71 | LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, 72 | TString *source); 73 | LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); 74 | LUAI_FUNC void luaX_next (LexState *ls); 75 | LUAI_FUNC void luaX_lookahead (LexState *ls); 76 | LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); 77 | LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); 78 | LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); 79 | 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /amx-deps/src/include/llimits.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: llimits.h,v 1.69.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Limits, basic types, and some other `installation-dependent' definitions 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef llimits_h 8 | #define llimits_h 9 | 10 | 11 | #include 12 | #include 13 | 14 | 15 | #include "lua.h" 16 | 17 | 18 | typedef LUAI_UINT32 lu_int32; 19 | 20 | typedef LUAI_UMEM lu_mem; 21 | 22 | typedef LUAI_MEM l_mem; 23 | 24 | 25 | 26 | /* chars used as small naturals (so that `char' is reserved for characters) */ 27 | typedef unsigned char lu_byte; 28 | 29 | 30 | #define MAX_SIZET ((size_t)(~(size_t)0)-2) 31 | 32 | #define MAX_LUMEM ((lu_mem)(~(lu_mem)0)-2) 33 | 34 | 35 | #define MAX_INT (INT_MAX-2) /* maximum value of an int (-2 for safety) */ 36 | 37 | /* 38 | ** conversion of pointer to integer 39 | ** this is for hashing only; there is no problem if the integer 40 | ** cannot hold the whole pointer value 41 | */ 42 | #define IntPoint(p) ((unsigned int)(lu_mem)(p)) 43 | 44 | 45 | 46 | /* type to ensure maximum alignment */ 47 | typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; 48 | 49 | 50 | /* result of a `usual argument conversion' over lua_Number */ 51 | typedef LUAI_UACNUMBER l_uacNumber; 52 | 53 | 54 | /* internal assertions for in-house debugging */ 55 | #ifdef lua_assert 56 | 57 | #define check_exp(c,e) (lua_assert(c), (e)) 58 | #define api_check(l,e) lua_assert(e) 59 | 60 | #else 61 | 62 | #define lua_assert(c) ((void)0) 63 | #define check_exp(c,e) (e) 64 | #define api_check luai_apicheck 65 | 66 | #endif 67 | 68 | 69 | #ifndef UNUSED 70 | #define UNUSED(x) ((void)(x)) /* to avoid warnings */ 71 | #endif 72 | 73 | 74 | #ifndef cast 75 | #define cast(t, exp) ((t)(exp)) 76 | #endif 77 | 78 | #define cast_byte(i) cast(lu_byte, (i)) 79 | #define cast_num(i) cast(lua_Number, (i)) 80 | #define cast_int(i) cast(int, (i)) 81 | 82 | 83 | 84 | /* 85 | ** type for virtual-machine instructions 86 | ** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) 87 | */ 88 | typedef lu_int32 Instruction; 89 | 90 | 91 | 92 | /* maximum stack for a Lua function */ 93 | #define MAXSTACK 250 94 | 95 | 96 | 97 | /* minimum size for the string table (must be power of 2) */ 98 | #ifndef MINSTRTABSIZE 99 | #define MINSTRTABSIZE 32 100 | #endif 101 | 102 | 103 | /* minimum size for string buffer */ 104 | #ifndef LUA_MINBUFFER 105 | #define LUA_MINBUFFER 32 106 | #endif 107 | 108 | 109 | #ifndef lua_lock 110 | #define lua_lock(L) ((void) 0) 111 | #define lua_unlock(L) ((void) 0) 112 | #endif 113 | 114 | #ifndef luai_threadyield 115 | #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} 116 | #endif 117 | 118 | 119 | /* 120 | ** macro to control inclusion of some hard tests on stack reallocation 121 | */ 122 | #ifndef HARDSTACKTESTS 123 | #define condhardstacktests(x) ((void)0) 124 | #else 125 | #define condhardstacktests(x) x 126 | #endif 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /amx-deps/src/include/lmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Interface to Memory Manager 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lmem_h 8 | #define lmem_h 9 | 10 | 11 | #include 12 | 13 | #include "llimits.h" 14 | #include "lua.h" 15 | 16 | #define MEMERRMSG "not enough memory" 17 | 18 | 19 | #define luaM_reallocv(L,b,on,n,e) \ 20 | ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ 21 | luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ 22 | luaM_toobig(L)) 23 | 24 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) 25 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) 26 | #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) 27 | 28 | #define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) 29 | #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) 30 | #define luaM_newvector(L,n,t) \ 31 | cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) 32 | 33 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ 34 | if ((nelems)+1 > (size)) \ 35 | ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) 36 | 37 | #define luaM_reallocvector(L, v,oldn,n,t) \ 38 | ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) 39 | 40 | 41 | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, 42 | size_t size); 43 | LUAI_FUNC void *luaM_toobig (lua_State *L); 44 | LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, 45 | size_t size_elem, int limit, 46 | const char *errormsg); 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /amx-deps/src/include/lparser.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lparser.h,v 1.57.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua Parser 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lparser_h 8 | #define lparser_h 9 | 10 | #include "llimits.h" 11 | #include "lobject.h" 12 | #include "lzio.h" 13 | 14 | 15 | /* 16 | ** Expression descriptor 17 | */ 18 | 19 | typedef enum { 20 | VVOID, /* no value */ 21 | VNIL, 22 | VTRUE, 23 | VFALSE, 24 | VK, /* info = index of constant in `k' */ 25 | VKNUM, /* nval = numerical value */ 26 | VLOCAL, /* info = local register */ 27 | VUPVAL, /* info = index of upvalue in `upvalues' */ 28 | VGLOBAL, /* info = index of table; aux = index of global name in `k' */ 29 | VINDEXED, /* info = table register; aux = index register (or `k') */ 30 | VJMP, /* info = instruction pc */ 31 | VRELOCABLE, /* info = instruction pc */ 32 | VNONRELOC, /* info = result register */ 33 | VCALL, /* info = instruction pc */ 34 | VVARARG /* info = instruction pc */ 35 | } expkind; 36 | 37 | typedef struct expdesc { 38 | expkind k; 39 | union { 40 | struct { int info, aux; } s; 41 | lua_Number nval; 42 | } u; 43 | int t; /* patch list of `exit when true' */ 44 | int f; /* patch list of `exit when false' */ 45 | } expdesc; 46 | 47 | 48 | typedef struct upvaldesc { 49 | lu_byte k; 50 | lu_byte info; 51 | } upvaldesc; 52 | 53 | 54 | struct BlockCnt; /* defined in lparser.c */ 55 | 56 | 57 | /* state needed to generate code for a given function */ 58 | typedef struct FuncState { 59 | Proto *f; /* current function header */ 60 | Table *h; /* table to find (and reuse) elements in `k' */ 61 | struct FuncState *prev; /* enclosing function */ 62 | struct LexState *ls; /* lexical state */ 63 | struct lua_State *L; /* copy of the Lua state */ 64 | struct BlockCnt *bl; /* chain of current blocks */ 65 | int pc; /* next position to code (equivalent to `ncode') */ 66 | int lasttarget; /* `pc' of last `jump target' */ 67 | int jpc; /* list of pending jumps to `pc' */ 68 | int freereg; /* first free register */ 69 | int nk; /* number of elements in `k' */ 70 | int np; /* number of elements in `p' */ 71 | short nlocvars; /* number of elements in `locvars' */ 72 | lu_byte nactvar; /* number of active local variables */ 73 | upvaldesc upvalues[LUAI_MAXUPVALUES]; /* upvalues */ 74 | unsigned short actvar[LUAI_MAXVARS]; /* declared-variable stack */ 75 | } FuncState; 76 | 77 | 78 | LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, 79 | const char *name); 80 | 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /amx-deps/src/include/lstate.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $ 3 | ** Global State 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstate_h 8 | #define lstate_h 9 | 10 | #include "lua.h" 11 | 12 | #include "lobject.h" 13 | #include "ltm.h" 14 | #include "lzio.h" 15 | 16 | 17 | 18 | struct lua_longjmp; /* defined in ldo.c */ 19 | 20 | 21 | /* table of globals */ 22 | #define gt(L) (&L->l_gt) 23 | 24 | /* registry */ 25 | #define registry(L) (&G(L)->l_registry) 26 | 27 | 28 | /* extra stack space to handle TM calls and some other extras */ 29 | #define EXTRA_STACK 5 30 | 31 | 32 | #define BASIC_CI_SIZE 8 33 | 34 | #define BASIC_STACK_SIZE (2*LUA_MINSTACK) 35 | 36 | 37 | 38 | typedef struct stringtable { 39 | GCObject **hash; 40 | lu_int32 nuse; /* number of elements */ 41 | int size; 42 | } stringtable; 43 | 44 | 45 | /* 46 | ** informations about a call 47 | */ 48 | typedef struct CallInfo { 49 | StkId base; /* base for this function */ 50 | StkId func; /* function index in the stack */ 51 | StkId top; /* top for this function */ 52 | const Instruction *savedpc; 53 | int nresults; /* expected number of results from this function */ 54 | int tailcalls; /* number of tail calls lost under this entry */ 55 | } CallInfo; 56 | 57 | 58 | 59 | #define curr_func(L) (clvalue(L->ci->func)) 60 | #define ci_func(ci) (clvalue((ci)->func)) 61 | #define f_isLua(ci) (!ci_func(ci)->c.isC) 62 | #define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci)) 63 | 64 | 65 | /* 66 | ** `global state', shared by all threads of this state 67 | */ 68 | typedef struct global_State { 69 | stringtable strt; /* hash table for strings */ 70 | lua_Alloc frealloc; /* function to reallocate memory */ 71 | void *ud; /* auxiliary data to `frealloc' */ 72 | lu_byte currentwhite; 73 | lu_byte gcstate; /* state of garbage collector */ 74 | int sweepstrgc; /* position of sweep in `strt' */ 75 | GCObject *rootgc; /* list of all collectable objects */ 76 | GCObject **sweepgc; /* position of sweep in `rootgc' */ 77 | GCObject *gray; /* list of gray objects */ 78 | GCObject *grayagain; /* list of objects to be traversed atomically */ 79 | GCObject *weak; /* list of weak tables (to be cleared) */ 80 | GCObject *tmudata; /* last element of list of userdata to be GC */ 81 | Mbuffer buff; /* temporary buffer for string concatentation */ 82 | lu_mem GCthreshold; 83 | lu_mem totalbytes; /* number of bytes currently allocated */ 84 | lu_mem estimate; /* an estimate of number of bytes actually in use */ 85 | lu_mem gcdept; /* how much GC is `behind schedule' */ 86 | int gcpause; /* size of pause between successive GCs */ 87 | int gcstepmul; /* GC `granularity' */ 88 | lua_CFunction panic; /* to be called in unprotected errors */ 89 | TValue l_registry; 90 | struct lua_State *mainthread; 91 | UpVal uvhead; /* head of double-linked list of all open upvalues */ 92 | struct Table *mt[NUM_TAGS]; /* metatables for basic types */ 93 | TString *tmname[TM_N]; /* array with tag-method names */ 94 | } global_State; 95 | 96 | 97 | /* 98 | ** `per thread' state 99 | */ 100 | struct lua_State { 101 | CommonHeader; 102 | lu_byte status; 103 | StkId top; /* first free slot in the stack */ 104 | StkId base; /* base of current function */ 105 | global_State *l_G; 106 | CallInfo *ci; /* call info for current function */ 107 | const Instruction *savedpc; /* `savedpc' of current function */ 108 | StkId stack_last; /* last free slot in the stack */ 109 | StkId stack; /* stack base */ 110 | CallInfo *end_ci; /* points after end of ci array*/ 111 | CallInfo *base_ci; /* array of CallInfo's */ 112 | int stacksize; 113 | int size_ci; /* size of array `base_ci' */ 114 | unsigned short nCcalls; /* number of nested C calls */ 115 | unsigned short baseCcalls; /* nested C calls when resuming coroutine */ 116 | lu_byte hookmask; 117 | lu_byte allowhook; 118 | int basehookcount; 119 | int hookcount; 120 | lua_Hook hook; 121 | TValue l_gt; /* table of globals */ 122 | TValue env; /* temporary place for environments */ 123 | GCObject *openupval; /* list of open upvalues in this stack */ 124 | GCObject *gclist; 125 | struct lua_longjmp *errorJmp; /* current error recover point */ 126 | ptrdiff_t errfunc; /* current error handling function (stack index) */ 127 | }; 128 | 129 | 130 | #define G(L) (L->l_G) 131 | 132 | 133 | /* 134 | ** Union of all collectable objects 135 | */ 136 | union GCObject { 137 | GCheader gch; 138 | union TString ts; 139 | union Udata u; 140 | union Closure cl; 141 | struct Table h; 142 | struct Proto p; 143 | struct UpVal uv; 144 | struct lua_State th; /* thread */ 145 | }; 146 | 147 | 148 | /* macros to convert a GCObject into a specific value */ 149 | #define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) 150 | #define gco2ts(o) (&rawgco2ts(o)->tsv) 151 | #define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) 152 | #define gco2u(o) (&rawgco2u(o)->uv) 153 | #define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) 154 | #define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) 155 | #define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) 156 | #define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) 157 | #define ngcotouv(o) \ 158 | check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv)) 159 | #define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) 160 | 161 | /* macro to convert any Lua object into a GCObject */ 162 | #define obj2gco(v) (cast(GCObject *, (v))) 163 | 164 | 165 | LUAI_FUNC lua_State *luaE_newthread (lua_State *L); 166 | LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); 167 | 168 | #endif 169 | 170 | -------------------------------------------------------------------------------- /amx-deps/src/include/lstring.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lstring.h,v 1.43.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** String table (keep all strings handled by Lua) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lstring_h 8 | #define lstring_h 9 | 10 | 11 | #include "lgc.h" 12 | #include "lobject.h" 13 | #include "lstate.h" 14 | 15 | 16 | #define sizestring(s) (sizeof(union TString)+((s)->len+1)*sizeof(char)) 17 | 18 | #define sizeudata(u) (sizeof(union Udata)+(u)->len) 19 | 20 | #define luaS_new(L, s) (luaS_newlstr(L, s, strlen(s))) 21 | #define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ 22 | (sizeof(s)/sizeof(char))-1)) 23 | 24 | #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) 25 | 26 | LUAI_FUNC void luaS_resize (lua_State *L, int newsize); 27 | LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); 28 | LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /amx-deps/src/include/ltable.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltable.h,v 2.10.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua tables (hash) 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltable_h 8 | #define ltable_h 9 | 10 | #include "lobject.h" 11 | 12 | 13 | #define gnode(t,i) (&(t)->node[i]) 14 | #define gkey(n) (&(n)->i_key.nk) 15 | #define gval(n) (&(n)->i_val) 16 | #define gnext(n) ((n)->i_key.nk.next) 17 | 18 | #define key2tval(n) (&(n)->i_key.tvk) 19 | 20 | 21 | LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); 22 | LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); 23 | LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); 24 | LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); 25 | LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); 26 | LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); 27 | LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); 28 | LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); 29 | LUAI_FUNC void luaH_free (lua_State *L, Table *t); 30 | LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); 31 | LUAI_FUNC int luaH_getn (Table *t); 32 | 33 | 34 | #if defined(LUA_DEBUG) 35 | LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); 36 | LUAI_FUNC int luaH_isdummy (Node *n); 37 | #endif 38 | 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /amx-deps/src/include/ltm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Tag methods 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef ltm_h 8 | #define ltm_h 9 | 10 | 11 | #include "lobject.h" 12 | 13 | 14 | /* 15 | * WARNING: if you change the order of this enumeration, 16 | * grep "ORDER TM" 17 | */ 18 | typedef enum { 19 | TM_INDEX, 20 | TM_NEWINDEX, 21 | TM_GC, 22 | TM_MODE, 23 | TM_EQ, /* last tag method with `fast' access */ 24 | TM_ADD, 25 | TM_SUB, 26 | TM_MUL, 27 | TM_DIV, 28 | TM_MOD, 29 | TM_POW, 30 | TM_UNM, 31 | TM_LEN, 32 | TM_LT, 33 | TM_LE, 34 | TM_CONCAT, 35 | TM_CALL, 36 | TM_N /* number of elements in the enum */ 37 | } TMS; 38 | 39 | 40 | 41 | #define gfasttm(g,et,e) ((et) == NULL ? NULL : \ 42 | ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) 43 | 44 | #define fasttm(l,et,e) gfasttm(G(l), et, e) 45 | 46 | LUAI_DATA const char *const luaT_typenames[]; 47 | 48 | 49 | LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); 50 | LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, 51 | TMS event); 52 | LUAI_FUNC void luaT_init (lua_State *L); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /amx-deps/src/include/lua.hpp: -------------------------------------------------------------------------------- 1 | // lua.hpp 2 | // Lua header files for C++ 3 | // <> not supplied automatically because Lua also compiles as C++ 4 | 5 | extern "C" { 6 | #include "lua.h" 7 | #include "lualib.h" 8 | #include "lauxlib.h" 9 | } 10 | -------------------------------------------------------------------------------- /amx-deps/src/include/lualib.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lualib.h,v 1.36.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua standard libraries 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lualib_h 9 | #define lualib_h 10 | 11 | #include "lua.h" 12 | 13 | 14 | /* Key to file-handle type */ 15 | #define LUA_FILEHANDLE "FILE*" 16 | 17 | 18 | #define LUA_COLIBNAME "coroutine" 19 | LUALIB_API int (luaopen_base) (lua_State *L); 20 | 21 | #define LUA_TABLIBNAME "table" 22 | LUALIB_API int (luaopen_table) (lua_State *L); 23 | 24 | #define LUA_IOLIBNAME "io" 25 | LUALIB_API int (luaopen_io) (lua_State *L); 26 | 27 | #define LUA_OSLIBNAME "os" 28 | LUALIB_API int (luaopen_os) (lua_State *L); 29 | 30 | #define LUA_STRLIBNAME "string" 31 | LUALIB_API int (luaopen_string) (lua_State *L); 32 | 33 | #define LUA_MATHLIBNAME "math" 34 | LUALIB_API int (luaopen_math) (lua_State *L); 35 | 36 | #define LUA_DBLIBNAME "debug" 37 | LUALIB_API int (luaopen_debug) (lua_State *L); 38 | 39 | #define LUA_LOADLIBNAME "package" 40 | LUALIB_API int (luaopen_package) (lua_State *L); 41 | 42 | 43 | /* open all previous libraries */ 44 | LUALIB_API void (luaL_openlibs) (lua_State *L); 45 | 46 | /* Additional luautf8 library */ 47 | LUALIB_API int luaopen_utf8(lua_State *L); 48 | 49 | #ifndef lua_assert 50 | #define lua_assert(x) ((void)0) 51 | #endif 52 | 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /amx-deps/src/include/lundump.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lundump.h,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** load precompiled Lua chunks 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lundump_h 8 | #define lundump_h 9 | 10 | #include "lobject.h" 11 | #include "lzio.h" 12 | 13 | /* load one chunk; from lundump.c */ 14 | LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name); 15 | 16 | /* make header; from lundump.c */ 17 | LUAI_FUNC void luaU_header (char* h); 18 | 19 | /* dump one chunk; from ldump.c */ 20 | LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); 21 | 22 | #ifdef luac_c 23 | /* print one chunk; from print.c */ 24 | LUAI_FUNC void luaU_print (const Proto* f, int full); 25 | #endif 26 | 27 | /* for header of binary files -- this is Lua 5.1 */ 28 | #define LUAC_VERSION 0x51 29 | 30 | /* for header of binary files -- this is the official format */ 31 | #define LUAC_FORMAT 0 32 | 33 | /* size of header of binary files */ 34 | #define LUAC_HEADERSIZE 12 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /amx-deps/src/include/lvm.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lvm.h,v 2.5.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Lua virtual machine 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | #ifndef lvm_h 8 | #define lvm_h 9 | 10 | 11 | #include "ldo.h" 12 | #include "lobject.h" 13 | #include "ltm.h" 14 | 15 | 16 | #define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o))) 17 | 18 | #define tonumber(o,n) (ttype(o) == LUA_TNUMBER || \ 19 | (((o) = luaV_tonumber(o,n)) != NULL)) 20 | 21 | #define equalobj(L,o1,o2) \ 22 | (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) 23 | 24 | 25 | LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); 26 | LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); 27 | LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); 28 | LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); 29 | LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, 30 | StkId val); 31 | LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, 32 | StkId val); 33 | LUAI_FUNC void luaV_execute (lua_State *L, int nexeccalls); 34 | LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /amx-deps/src/include/lzio.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lzio.h,v 1.21.1.1 2007/12/27 13:02:25 roberto Exp $ 3 | ** Buffered streams 4 | ** See Copyright Notice in lua.h 5 | */ 6 | 7 | 8 | #ifndef lzio_h 9 | #define lzio_h 10 | 11 | #include "lua.h" 12 | 13 | #include "lmem.h" 14 | 15 | 16 | #define EOZ (-1) /* end of stream */ 17 | 18 | typedef struct Zio ZIO; 19 | 20 | #define char2int(c) cast(int, cast(unsigned char, (c))) 21 | 22 | #define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) 23 | 24 | typedef struct Mbuffer { 25 | char *buffer; 26 | size_t n; 27 | size_t buffsize; 28 | } Mbuffer; 29 | 30 | #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) 31 | 32 | #define luaZ_buffer(buff) ((buff)->buffer) 33 | #define luaZ_sizebuffer(buff) ((buff)->buffsize) 34 | #define luaZ_bufflen(buff) ((buff)->n) 35 | 36 | #define luaZ_resetbuffer(buff) ((buff)->n = 0) 37 | 38 | 39 | #define luaZ_resizebuffer(L, buff, size) \ 40 | (luaM_reallocvector(L, (buff)->buffer, (buff)->buffsize, size, char), \ 41 | (buff)->buffsize = size) 42 | 43 | #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) 44 | 45 | 46 | LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); 47 | LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, 48 | void *data); 49 | LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ 50 | LUAI_FUNC int luaZ_lookahead (ZIO *z); 51 | 52 | 53 | 54 | /* --------- Private Part ------------------ */ 55 | 56 | struct Zio { 57 | size_t n; /* bytes still unread */ 58 | const char *p; /* current position in buffer */ 59 | lua_Reader reader; 60 | void* data; /* additional data */ 61 | lua_State *L; /* Lua state (for reader) */ 62 | int eoz; /* true if reader has no more data */ 63 | }; 64 | 65 | 66 | LUAI_FUNC int luaZ_fill (ZIO *z); 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /amx-deps/src/king.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "afxres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE 31 | BEGIN 32 | "resource.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE 36 | BEGIN 37 | "#include ""afxres.h""\r\n" 38 | "\0" 39 | END 40 | 41 | 3 TEXTINCLUDE 42 | BEGIN 43 | "\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | #endif // English (U.S.) resources 50 | ///////////////////////////////////////////////////////////////////////////// 51 | 52 | 53 | ///////////////////////////////////////////////////////////////////////////// 54 | // English (U.K.) resources 55 | 56 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) 57 | #ifdef _WIN32 58 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK 59 | #pragma code_page(1252) 60 | #endif //_WIN32 61 | 62 | ///////////////////////////////////////////////////////////////////////////// 63 | // 64 | // Version 65 | // 66 | 67 | VS_VERSION_INFO VERSIONINFO 68 | FILEVERSION 1,0,0,0 69 | PRODUCTVERSION 1,0,0,0 70 | FILEFLAGSMASK 0x17L 71 | #ifdef _DEBUG 72 | FILEFLAGS 0x1L 73 | #else 74 | FILEFLAGS 0x0L 75 | #endif 76 | FILEOS 0x4L 77 | FILETYPE 0x2L 78 | FILESUBTYPE 0x0L 79 | BEGIN 80 | BLOCK "StringFileInfo" 81 | BEGIN 82 | BLOCK "080904b0" 83 | BEGIN 84 | VALUE "FileDescription", "AMX compatibility binary module" 85 | VALUE "FileVersion", "1, 0, 0, 0" 86 | VALUE "InternalName", "king" 87 | VALUE "LegalCopyright", "Copyright (C) 2008" 88 | VALUE "OriginalFilename", "king.dll" 89 | VALUE "ProductName", "AMX compatibility suite" 90 | VALUE "ProductVersion", "1, 0, 0, 0" 91 | END 92 | END 93 | BLOCK "VarFileInfo" 94 | BEGIN 95 | VALUE "Translation", 0x809, 1200 96 | END 97 | END 98 | 99 | #endif // English (U.K.) resources 100 | ///////////////////////////////////////////////////////////////////////////// 101 | 102 | 103 | 104 | #ifndef APSTUDIO_INVOKED 105 | ///////////////////////////////////////////////////////////////////////////// 106 | // 107 | // Generated from the TEXTINCLUDE 3 resource. 108 | // 109 | 110 | 111 | ///////////////////////////////////////////////////////////////////////////// 112 | #endif // not APSTUDIO_INVOKED 113 | 114 | -------------------------------------------------------------------------------- /amx-deps/src/lib/lua5.1.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-deps/src/lib/lua5.1.exp -------------------------------------------------------------------------------- /amx-deps/src/lib/lua5.1.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-deps/src/lib/lua5.1.lib -------------------------------------------------------------------------------- /amx-deps/src/lib/lua5.1.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-deps/src/lib/lua5.1.so -------------------------------------------------------------------------------- /amx-deps/src/lib/sqlite3.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-deps/src/lib/sqlite3.exp -------------------------------------------------------------------------------- /amx-deps/src/lib/sqlite3.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-deps/src/lib/sqlite3.lib -------------------------------------------------------------------------------- /amx-deps/src/linux/binreloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * BinReloc - a library for creating relocatable executables 3 | * Written by: Hongli Lai 4 | * http://autopackage.org/ 5 | * 6 | * This source code is public domain. You can relicense this code 7 | * under whatever license you want. 8 | * 9 | * See http://autopackage.org/docs/binreloc/ for 10 | * more information and how to use this. 11 | */ 12 | 13 | #ifndef __BINRELOC_H__ 14 | #define __BINRELOC_H__ 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif /* __cplusplus */ 19 | 20 | 21 | /** These error codes can be returned by br_init(), br_init_lib(), gbr_init() or gbr_init_lib(). */ 22 | typedef enum { 23 | /** Cannot allocate memory. */ 24 | BR_INIT_ERROR_NOMEM, 25 | /** Unable to open /proc/self/maps; see errno for details. */ 26 | BR_INIT_ERROR_OPEN_MAPS, 27 | /** Unable to read from /proc/self/maps; see errno for details. */ 28 | BR_INIT_ERROR_READ_MAPS, 29 | /** The file format of /proc/self/maps is invalid; kernel bug? */ 30 | BR_INIT_ERROR_INVALID_MAPS, 31 | /** BinReloc is disabled (the ENABLE_BINRELOC macro is not defined). */ 32 | BR_INIT_ERROR_DISABLED 33 | } BrInitError; 34 | 35 | 36 | #ifndef BINRELOC_RUNNING_DOXYGEN 37 | /* Mangle symbol names to avoid symbol collisions with other ELF objects. */ 38 | #define br_init SbCJ22537442193159_br_init 39 | #define br_init_lib SbCJ22537442193159_br_init_lib 40 | #define br_find_exe SbCJ22537442193159_br_find_exe 41 | #define br_find_exe_dir SbCJ22537442193159_br_find_exe_dir 42 | #define br_find_prefix SbCJ22537442193159_br_find_prefix 43 | #define br_find_bin_dir SbCJ22537442193159_br_find_bin_dir 44 | #define br_find_sbin_dir SbCJ22537442193159_br_find_sbin_dir 45 | #define br_find_data_dir SbCJ22537442193159_br_find_data_dir 46 | #define br_find_locale_dir SbCJ22537442193159_br_find_locale_dir 47 | #define br_find_lib_dir SbCJ22537442193159_br_find_lib_dir 48 | #define br_find_libexec_dir SbCJ22537442193159_br_find_libexec_dir 49 | #define br_find_etc_dir SbCJ22537442193159_br_find_etc_dir 50 | #define br_strcat SbCJ22537442193159_br_strcat 51 | #define br_build_path SbCJ22537442193159_br_build_path 52 | #define br_dirname SbCJ22537442193159_br_dirname 53 | 54 | 55 | #endif 56 | int br_init (BrInitError *error); 57 | int br_init_lib (BrInitError *error); 58 | 59 | char *br_find_exe (const char *default_exe); 60 | char *br_find_exe_dir (const char *default_dir); 61 | char *br_find_prefix (const char *default_prefix); 62 | char *br_find_bin_dir (const char *default_bin_dir); 63 | char *br_find_sbin_dir (const char *default_sbin_dir); 64 | char *br_find_data_dir (const char *default_data_dir); 65 | char *br_find_locale_dir (const char *default_locale_dir); 66 | char *br_find_lib_dir (const char *default_lib_dir); 67 | char *br_find_libexec_dir (const char *default_libexec_dir); 68 | char *br_find_etc_dir (const char *default_etc_dir); 69 | 70 | /* Utility functions */ 71 | char *br_strcat (const char *str1, const char *str2); 72 | char *br_build_path (const char *dir, const char *file); 73 | char *br_dirname (const char *path); 74 | 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif /* __cplusplus */ 79 | 80 | #endif /* __BINRELOC_H__ */ 81 | -------------------------------------------------------------------------------- /amx-deps/src/linux/getch.c: -------------------------------------------------------------------------------- 1 | /* Extremely inefficient but portable POSIX getch() */ 2 | 3 | #include 4 | #include 5 | #include /* for tcgetattr() and tcsetattr() */ 6 | #include /* for read() */ 7 | #include 8 | #include 9 | #include 10 | #include "getch.h" 11 | 12 | #ifndef STDIN_FILENO 13 | # define STDIN_FILENO 0 14 | #endif 15 | 16 | int 17 | getch (void) 18 | { 19 | struct termios save_termios; 20 | struct termios ios; 21 | int c = 0; 22 | 23 | if (!isatty (STDIN_FILENO)) 24 | return EOF; 25 | 26 | if (tcgetattr (STDIN_FILENO, &save_termios) < 0) 27 | return EOF; 28 | 29 | ios = save_termios; 30 | ios.c_lflag &= ~(ICANON | ECHO | ISIG); 31 | ios.c_cc[VMIN] = 1; /* read() will return with one char */ 32 | ios.c_cc[VTIME] = 0; /* read() blocks forever */ 33 | 34 | if (tcsetattr (STDIN_FILENO, TCSANOW, &ios) < 0) 35 | return EOF; 36 | 37 | if (read (STDIN_FILENO, &c, 1) != 1) 38 | c = EOF; 39 | 40 | tcsetattr (STDIN_FILENO, TCSANOW, &save_termios); 41 | 42 | return c; 43 | } 44 | 45 | int 46 | kbhit (void) 47 | { 48 | struct termios save_termios; 49 | struct termios ios; 50 | fd_set inp; 51 | struct timeval timeout = {0, 0}; 52 | int result; 53 | 54 | if (!isatty (STDIN_FILENO)) 55 | return 0; 56 | 57 | if (tcgetattr (STDIN_FILENO, &save_termios) < 0) 58 | return 0; 59 | 60 | ios = save_termios; 61 | ios.c_lflag &= ~(ICANON | ECHO | ISIG); 62 | ios.c_cc[VMIN] = 1; /* read() will return with one char */ 63 | ios.c_cc[VTIME] = 0; /* read() blocks forever */ 64 | 65 | if (tcsetattr (STDIN_FILENO, TCSANOW, &ios) < 0) 66 | return 0; 67 | 68 | /* set up select() args */ 69 | FD_ZERO(&inp); 70 | FD_SET(STDIN_FILENO, &inp); 71 | 72 | result = select (STDIN_FILENO+1, &inp, NULL, NULL, &timeout) == 1; 73 | 74 | tcsetattr (STDIN_FILENO, TCSANOW, &save_termios); 75 | 76 | return result; 77 | } 78 | 79 | #if defined TEST_GETCH 80 | int 81 | main () 82 | { 83 | int i; 84 | char c[4]; 85 | 86 | printf("Enter %d keys to continue: ", sizeof c - 1); 87 | fflush (stdout); 88 | 89 | memset(c, 0, sizeof c); 90 | for (i=0; i 30 | #endif 31 | 32 | /* 33 | * SC assumes that a computer is Little Endian unless told otherwise. It uses 34 | * (and defines) the macros BYTE_ORDER and BIG_ENDIAN. 35 | * For Linux, we must overrule these settings with those defined in glibc. 36 | */ 37 | #if !defined __BYTE_ORDER 38 | # include 39 | #endif 40 | 41 | #if defined __OpenBSD__ || defined __FreeBSD__ 42 | # define __BYTE_ORDER BYTE_ORDER 43 | # define __LITTLE_ENDIAN LITTLE_ENDIAN 44 | # define __BIG_ENDIAN BIG_ENDIAN 45 | #endif 46 | 47 | #if defined __APPLE__ 48 | # define __BYTE_ORDER BYTE_ORDER 49 | # define __LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN 50 | # define __BIG_ENDIAN __DARWIN_BIG_ENDIAN 51 | #endif 52 | 53 | #if !defined __BYTE_ORDER 54 | # error "Can't figure computer byte order (__BYTE_ORDER macro not found)" 55 | #endif 56 | 57 | #endif /* SCLINUX_H */ 58 | -------------------------------------------------------------------------------- /amx-deps/src/ml_base.h: -------------------------------------------------------------------------------- 1 | /********************************************************* 2 | * 3 | * Multi Theft Auto: San Andreas - Deathmatch 4 | * 5 | * ml_base, External lua add-on module 6 | * 7 | * Copyright © 2003-2008 MTA. All Rights Reserved. 8 | * 9 | * Grand Theft Auto is © 2002-2003 Rockstar North 10 | * 11 | * THE FOLLOWING SOURCES ARE PART OF THE MULTI THEFT 12 | * AUTO SOFTWARE DEVELOPMENT KIT AND ARE RELEASED AS 13 | * OPEN SOURCE FILES. THESE FILES MAY BE USED AS LONG 14 | * AS THE DEVELOPER AGREES TO THE LICENSE THAT IS 15 | * PROVIDED WITH THIS PACKAGE. 16 | * 17 | *********************************************************/ 18 | 19 | /** MODULE SPECIFIC INFORMATION **/ 20 | 21 | #ifndef MLBASE_H 22 | #define MLBASE_H 23 | 24 | #define MODULE_NAME "AMX compatibility layer" 25 | #define MODULE_AUTHOR "arc_" 26 | #define MODULE_VERSION 1.0 27 | #define MODULE_VERSIONSTRING "MTA AMX compatibility layer RC2" 28 | 29 | void logprintf(char *fmt, ...); 30 | int AMXCallPublicFilterScript(char *fnName); 31 | int AMXCallPublicGameMode(char *fnName); 32 | 33 | typedef struct { 34 | std::string filePath; 35 | std::string resourceName; 36 | lua_State *resourceVM; 37 | } AMXPROPS; 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /amx-deps/src/premake5.lua: -------------------------------------------------------------------------------- 1 | solution "king" 2 | configurations { "Debug", "Release" } 3 | platforms { "x86", "x64" } 4 | location ( "Build" ) 5 | targetdir "Bin" 6 | 7 | cppdialect "C++17" 8 | characterset "MBCS" 9 | pic "On" 10 | symbols "On" 11 | 12 | defines { 13 | "_CRT_SECURE_NO_WARNINGS", 14 | "HAVE_STDINT_H", 15 | } 16 | 17 | filter "system:windows" 18 | defines { "WINDOWS", "WIN32" } 19 | 20 | filter "configurations:Debug" 21 | defines { "DEBUG" } 22 | 23 | filter "configurations:Release" 24 | optimize "Speed" 25 | 26 | project "ml_base" 27 | language "C++" 28 | kind "SharedLib" 29 | targetname "king" 30 | 31 | includedirs { "include" } 32 | libdirs { "lib" } 33 | 34 | vpaths { 35 | ["Headers/*"] = {"*.h", "include/*.h", "linux/*.h"}, 36 | ["Sources/*"] = {"**.cpp"}, 37 | ["Resources/*"] = "king.rc", 38 | 39 | ["*"] = "premake5.lua", 40 | } 41 | 42 | files { 43 | "premake5.lua", 44 | "**.cpp", 45 | "*.h", 46 | "include/*.h", 47 | } 48 | 49 | filter "system:windows" 50 | files { "king.rc" } 51 | 52 | filter "system:linux" 53 | includedirs { "linux" } 54 | 55 | filter {"system:linux", "platforms:x86" } 56 | linkoptions { "-Wl,-rpath=mods/deathmatch" } 57 | 58 | filter {"system:linux", "platforms:x64" } 59 | linkoptions { "-Wl,-rpath=x64" } 60 | 61 | filter "system:linux" 62 | linkoptions { "-l:lua5.1.so" } 63 | 64 | filter "system:windows" 65 | links { "lua5.1", "sqlite3" } 66 | 67 | filter {} 68 | links "amx" 69 | 70 | include "amx" 71 | -------------------------------------------------------------------------------- /amx-deps/src/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by king.rc 4 | // 5 | 6 | // Next default values for new objects 7 | // 8 | #ifdef APSTUDIO_INVOKED 9 | #ifndef APSTUDIO_READONLY_SYMBOLS 10 | #define _APS_NO_MFC 1 11 | #define _APS_NEXT_RESOURCE_VALUE 101 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /amx-deps/src/util.h: -------------------------------------------------------------------------------- 1 | #ifndef UTIL_H 2 | #define UTIL_H 3 | 4 | // Cross compatibility 5 | #ifdef WIN32 6 | 7 | #define STDCALL __stdcall 8 | 9 | #define getProcAddr GetProcAddress 10 | #define loadLib LoadLibrary 11 | #define freeLib FreeLibrary 12 | #else 13 | 14 | #define HMODULE void* 15 | #define STDCALL 16 | 17 | void* getProcAddr ( HMODULE hModule, const char* szProcName ); 18 | #define loadLib(x) dlopen(x, RTLD_NOW) 19 | #define freeLib dlclose 20 | 21 | #endif 22 | 23 | #ifndef BYTE 24 | #define BYTE unsigned char 25 | #define WORD unsigned short 26 | #define DWORD unsigned long 27 | #endif 28 | 29 | 30 | // Util functions 31 | int setenv_portable(const char* name, const char* value, int overwrite); 32 | const char* getenv_portable(const char* name); 33 | std::string ToUTF8(const char * str); 34 | std::string ToOriginalCP(const char * str); 35 | void lua_pushamxstring(lua_State *luaVM, AMX *amx, cell addr); 36 | void lua_pushamxstring(lua_State *luaVM, AMX *amx, cell *physaddr); 37 | void lua_pushremotevalue(lua_State *localVM, lua_State *remoteVM, int index, bool toplevel = true); 38 | void lua_pushremotevalues(lua_State *localVM, lua_State *remoteVM, int num); 39 | std::vector getResourceAMXs(lua_State *luaVM); 40 | std::string getScriptFilePath(AMX *amx, const char *filename); 41 | extern "C" char* getScriptFilePath(AMX *amx, char *dest, const char *filename, size_t destsize); 42 | bool isSafePath(const char* path); 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /amx-fs-test/meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /amx-fs-test/testfs.amx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-fs-test/testfs.amx -------------------------------------------------------------------------------- /amx-fs-test/testfs.pwn: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | main() 4 | { 5 | print(" AMX test filterscript loaded"); 6 | } 7 | 8 | public OnFilterScriptInit() 9 | { 10 | print("This filterscript doesn't do anything."); 11 | print("It is simply an example of a filterscript resource."); 12 | return 1; 13 | } 14 | 15 | public OnFilterScriptExit() 16 | { 17 | return 1; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /amx-test/meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /amx-test/pawno/include/a_actor.inc: -------------------------------------------------------------------------------- 1 | /* SA-MP Actor Functions 2 | * 3 | * (c) Copyright 2015, SA-MP Team 4 | * 5 | */ 6 | 7 | #if defined _actor_included 8 | #endinput 9 | #endif 10 | #define _actor_included 11 | #pragma library actors 12 | 13 | native CreateActor(modelid, Float:X, Float:Y, Float:Z, Float:Rotation); 14 | native DestroyActor(actorid); 15 | 16 | native IsActorStreamedIn(actorid, forplayerid); 17 | 18 | native SetActorVirtualWorld(actorid, vworld); 19 | native GetActorVirtualWorld(actorid); 20 | 21 | native ApplyActorAnimation(actorid, animlib[], animname[], Float:fDelta, loop, lockx, locky, freeze, time); 22 | native ClearActorAnimations(actorid); 23 | 24 | native SetActorPos(actorid, Float:X, Float:Y, Float:Z); 25 | native GetActorPos(actorid, &Float:X, &Float:Y, &Float:Z); 26 | native SetActorFacingAngle(actorid, Float:ang); 27 | native GetActorFacingAngle(actorid, &Float:ang); 28 | 29 | native SetActorHealth(actorid, Float:health); 30 | native GetActorHealth(actorid, &Float:health); 31 | native SetActorInvulnerable(actorid, invulnerable = true); 32 | native IsActorInvulnerable(actorid); 33 | 34 | native IsValidActor(actorid); -------------------------------------------------------------------------------- /amx-test/pawno/include/a_http.inc: -------------------------------------------------------------------------------- 1 | /* SA-MP threaded HTTP/1.0 client for pawn 2 | * 3 | * (c) Copyright 2010, SA-MP Team 4 | * 5 | */ 6 | 7 | // HTTP requests 8 | #define HTTP_GET 1 9 | #define HTTP_POST 2 10 | #define HTTP_HEAD 3 11 | 12 | // HTTP error response codes 13 | // These codes compliment ordinary HTTP response codes returned in 'response_code' 14 | // (10x) (20x OK) (30x Moved) (40x Unauthorised) (50x Server Error) 15 | #define HTTP_ERROR_BAD_HOST 1 16 | #define HTTP_ERROR_NO_SOCKET 2 17 | #define HTTP_ERROR_CANT_CONNECT 3 18 | #define HTTP_ERROR_CANT_WRITE 4 19 | #define HTTP_ERROR_CONTENT_TOO_BIG 5 20 | #define HTTP_ERROR_MALFORMED_RESPONSE 6 21 | 22 | native HTTP(index, type, url[], data[], callback[]); 23 | 24 | // example HTTP callback: public MyHttpResponse(index, response_code, data[]) { ... } -------------------------------------------------------------------------------- /amx-test/pawno/include/a_objects.inc: -------------------------------------------------------------------------------- 1 | /* SA-MP Object Functions 2 | * 3 | * (c) Copyright 2005-2015, SA-MP Team 4 | * 5 | */ 6 | 7 | #if defined _objects_included 8 | #endinput 9 | #endif 10 | #define _objects_included 11 | #pragma library objects 12 | 13 | // Objects 14 | 15 | native CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance = 0.0); 16 | native AttachObjectToVehicle(objectid, vehicleid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ); 17 | native AttachObjectToObject(objectid, attachtoid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ, SyncRotation = 1); 18 | native AttachObjectToPlayer(objectid, playerid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ); 19 | native SetObjectPos(objectid, Float:X, Float:Y, Float:Z); 20 | native GetObjectPos(objectid, &Float:X, &Float:Y, &Float:Z); 21 | native SetObjectRot(objectid, Float:RotX, Float:RotY, Float:RotZ); 22 | native GetObjectRot(objectid, &Float:RotX, &Float:RotY, &Float:RotZ); 23 | native GetObjectModel(objectid); 24 | native SetObjectNoCameraCol(objectid); 25 | native IsValidObject(objectid); 26 | native DestroyObject(objectid); 27 | native MoveObject(objectid, Float:X, Float:Y, Float:Z, Float:Speed, Float:RotX = -1000.0, Float:RotY = -1000.0, Float:RotZ = -1000.0); 28 | native StopObject(objectid); 29 | native IsObjectMoving(objectid); 30 | native EditObject(playerid, objectid); 31 | native EditPlayerObject(playerid, objectid); 32 | native SelectObject(playerid); 33 | native CancelEdit(playerid); 34 | native CreatePlayerObject(playerid, modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance = 0.0); 35 | native AttachPlayerObjectToVehicle(playerid, objectid, vehicleid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:RotZ); 36 | native SetPlayerObjectPos(playerid, objectid, Float:X, Float:Y, Float:Z); 37 | native GetPlayerObjectPos(playerid, objectid, &Float:X, &Float:Y, &Float:Z); 38 | native SetPlayerObjectRot(playerid, objectid, Float:RotX, Float:RotY, Float:RotZ); 39 | native GetPlayerObjectRot(playerid, objectid, &Float:RotX, &Float:RotY, &Float:RotZ); 40 | native GetPlayerObjectModel(playerid, objectid); 41 | native SetPlayerObjectNoCameraCol(playerid, objectid); 42 | native IsValidPlayerObject(playerid, objectid); 43 | native DestroyPlayerObject(playerid, objectid); 44 | native MovePlayerObject(playerid, objectid, Float:X, Float:Y, Float:Z, Float:Speed, Float:RotX = -1000.0, Float:RotY = -1000.0, Float:RotZ = -1000.0); 45 | native StopPlayerObject(playerid, objectid); 46 | native IsPlayerObjectMoving(playerid, objectid); 47 | native AttachPlayerObjectToPlayer(objectplayer, objectid, attachplayer, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:rX, Float:rY, Float:rZ); 48 | 49 | #define OBJECT_MATERIAL_SIZE_32x32 10 50 | #define OBJECT_MATERIAL_SIZE_64x32 20 51 | #define OBJECT_MATERIAL_SIZE_64x64 30 52 | #define OBJECT_MATERIAL_SIZE_128x32 40 53 | #define OBJECT_MATERIAL_SIZE_128x64 50 54 | #define OBJECT_MATERIAL_SIZE_128x128 60 55 | #define OBJECT_MATERIAL_SIZE_256x32 70 56 | #define OBJECT_MATERIAL_SIZE_256x64 80 57 | #define OBJECT_MATERIAL_SIZE_256x128 90 58 | #define OBJECT_MATERIAL_SIZE_256x256 100 59 | #define OBJECT_MATERIAL_SIZE_512x64 110 60 | #define OBJECT_MATERIAL_SIZE_512x128 120 61 | #define OBJECT_MATERIAL_SIZE_512x256 130 62 | #define OBJECT_MATERIAL_SIZE_512x512 140 63 | 64 | #define OBJECT_MATERIAL_TEXT_ALIGN_LEFT 0 65 | #define OBJECT_MATERIAL_TEXT_ALIGN_CENTER 1 66 | #define OBJECT_MATERIAL_TEXT_ALIGN_RIGHT 2 67 | 68 | native SetObjectMaterial(objectid, materialindex, modelid, txdname[], texturename[], materialcolor=0); 69 | native SetPlayerObjectMaterial(playerid, objectid, materialindex, modelid, txdname[], texturename[], materialcolor=0); 70 | 71 | native SetObjectMaterialText(objectid, text[], materialindex = 0, materialsize = OBJECT_MATERIAL_SIZE_256x128, fontface[] = "Arial", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0); 72 | native SetPlayerObjectMaterialText(playerid, objectid, text[], materialindex = 0, materialsize = OBJECT_MATERIAL_SIZE_256x128, fontface[] = "Arial", fontsize = 24, bold = 1, fontcolor = 0xFFFFFFFF, backcolor = 0, textalignment = 0); 73 | 74 | native SetObjectsDefaultCameraCol(disable); -------------------------------------------------------------------------------- /amx-test/pawno/include/a_sampdb.inc: -------------------------------------------------------------------------------- 1 | // SA-MP Native SQLite Database Functions 2 | // 3 | // (c) Copyright 2015, SA-MP Team 4 | // 5 | 6 | #if defined _sampdb_included 7 | #endinput 8 | #endif 9 | #define _sampdb_included 10 | #pragma library sampdb 11 | 12 | native DB:db_open(name[]); 13 | native db_close(DB:db); 14 | native DBResult:db_query(DB:db, query[]); 15 | native db_free_result(DBResult:dbresult); 16 | native db_num_rows(DBResult:dbresult); 17 | native db_next_row(DBResult:dbresult); 18 | native db_num_fields(DBResult:dbresult); 19 | native db_field_name(DBResult:dbresult, field, result[], maxlength); 20 | native db_get_field(DBResult:dbresult, field, result[], maxlength); 21 | native db_get_field_int(DBResult:result, field = 0); 22 | native Float:db_get_field_float(DBResult:result, field = 0); 23 | native db_get_field_assoc(DBResult:dbresult, const field[], result[], maxlength); 24 | native db_get_field_assoc_int(DBResult:result, const field[]); 25 | native Float:db_get_field_assoc_float(DBResult:result, const field[]); 26 | native db_get_mem_handle(DB:db); 27 | native db_get_result_mem_handle(DBResult:result); 28 | 29 | native db_debug_openfiles(); 30 | native db_debug_openresults(); -------------------------------------------------------------------------------- /amx-test/pawno/include/a_vehicles.inc: -------------------------------------------------------------------------------- 1 | /* SA-MP Vehicle Functions 2 | * 3 | * (c) Copyright 2005-2012, SA-MP Team 4 | * 5 | */ 6 | 7 | #if defined _vehicles_included 8 | #endinput 9 | #endif 10 | #define _vehicles_included 11 | #pragma library vehicles 12 | 13 | #define CARMODTYPE_SPOILER 0 14 | #define CARMODTYPE_HOOD 1 15 | #define CARMODTYPE_ROOF 2 16 | #define CARMODTYPE_SIDESKIRT 3 17 | #define CARMODTYPE_LAMPS 4 18 | #define CARMODTYPE_NITRO 5 19 | #define CARMODTYPE_EXHAUST 6 20 | #define CARMODTYPE_WHEELS 7 21 | #define CARMODTYPE_STEREO 8 22 | #define CARMODTYPE_HYDRAULICS 9 23 | #define CARMODTYPE_FRONT_BUMPER 10 24 | #define CARMODTYPE_REAR_BUMPER 11 25 | #define CARMODTYPE_VENT_RIGHT 12 26 | #define CARMODTYPE_VENT_LEFT 13 27 | 28 | #define VEHICLE_PARAMS_UNSET -1 29 | #define VEHICLE_PARAMS_OFF 0 30 | #define VEHICLE_PARAMS_ON 1 31 | 32 | // Vehicle 33 | native CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren=0); 34 | native DestroyVehicle(vehicleid); 35 | native IsVehicleStreamedIn(vehicleid, forplayerid); 36 | native GetVehiclePos(vehicleid, &Float:x, &Float:y, &Float:z); 37 | native SetVehiclePos(vehicleid, Float:x, Float:y, Float:z); 38 | native GetVehicleZAngle(vehicleid, &Float:z_angle); 39 | native GetVehicleRotationQuat(vehicleid, &Float:w, &Float:x, &Float:y, &Float:z); 40 | native Float:GetVehicleDistanceFromPoint(vehicleid, Float:X, Float:Y, Float:Z); 41 | native SetVehicleZAngle(vehicleid, Float:z_angle); 42 | native SetVehicleParamsForPlayer(vehicleid,playerid,objective,doorslocked); 43 | native ManualVehicleEngineAndLights(); 44 | native SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); 45 | native GetVehicleParamsEx(vehicleid, &engine, &lights, &alarm, &doors, &bonnet, &boot, &objective); 46 | native GetVehicleParamsSirenState(vehicleid); 47 | native SetVehicleParamsCarDoors(vehicleid, driver, passenger, backleft, backright); 48 | native GetVehicleParamsCarDoors(vehicleid, &driver, &passenger, &backleft, &backright); 49 | native SetVehicleParamsCarWindows(vehicleid, driver, passenger, backleft, backright); 50 | native GetVehicleParamsCarWindows(vehicleid, &driver, &passenger, &backleft, &backright); 51 | native SetVehicleToRespawn(vehicleid); 52 | native LinkVehicleToInterior(vehicleid, interiorid); 53 | native AddVehicleComponent(vehicleid, componentid); 54 | native RemoveVehicleComponent(vehicleid, componentid); 55 | native ChangeVehicleColor(vehicleid, color1, color2); 56 | native ChangeVehiclePaintjob(vehicleid, paintjobid); 57 | native SetVehicleHealth(vehicleid, Float:health); 58 | native GetVehicleHealth(vehicleid, &Float:health); 59 | native AttachTrailerToVehicle(trailerid, vehicleid); 60 | native DetachTrailerFromVehicle(vehicleid); 61 | native IsTrailerAttachedToVehicle(vehicleid); 62 | native GetVehicleTrailer(vehicleid); 63 | native SetVehicleNumberPlate(vehicleid, numberplate[]); 64 | native GetVehicleModel(vehicleid); 65 | native GetVehicleComponentInSlot(vehicleid, slot); // There is 1 slot for each CARMODTYPE_* 66 | native GetVehicleComponentType(component); // Find CARMODTYPE_* for component id 67 | native RepairVehicle(vehicleid); // Repairs the damage model and resets the health 68 | native GetVehicleVelocity(vehicleid, &Float:X, &Float:Y, &Float:Z); 69 | native SetVehicleVelocity(vehicleid, Float:X, Float:Y, Float:Z); 70 | native SetVehicleAngularVelocity(vehicleid, Float:X, Float:Y, Float:Z); 71 | native GetVehicleDamageStatus(vehicleid, &panels, &doors, &lights, &tires); 72 | native UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires); 73 | 74 | #define VEHICLE_MODEL_INFO_SIZE 1 75 | #define VEHICLE_MODEL_INFO_FRONTSEAT 2 76 | #define VEHICLE_MODEL_INFO_REARSEAT 3 77 | #define VEHICLE_MODEL_INFO_PETROLCAP 4 78 | #define VEHICLE_MODEL_INFO_WHEELSFRONT 5 79 | #define VEHICLE_MODEL_INFO_WHEELSREAR 6 80 | #define VEHICLE_MODEL_INFO_WHEELSMID 7 81 | #define VEHICLE_MODEL_INFO_FRONT_BUMPER_Z 8 82 | #define VEHICLE_MODEL_INFO_REAR_BUMPER_Z 9 83 | 84 | native GetVehicleModelInfo(vehiclemodel, infotype, &Float:X, &Float:Y, &Float:Z); 85 | 86 | // Virtual Worlds 87 | native SetVehicleVirtualWorld(vehicleid, worldid); 88 | native GetVehicleVirtualWorld(vehicleid); -------------------------------------------------------------------------------- /amx-test/pawno/include/core.inc: -------------------------------------------------------------------------------- 1 | /* Core functions 2 | * 3 | * (c) Copyright 1998-2005, ITB CompuPhase 4 | * This file is provided as is (no warranties). 5 | */ 6 | #if defined _core_included 7 | #endinput 8 | #endif 9 | #define _core_included 10 | #pragma library Core 11 | 12 | native heapspace(); 13 | 14 | native funcidx(const name[]); 15 | 16 | native numargs(); 17 | native getarg(arg, index=0); 18 | native setarg(arg, index=0, value); 19 | 20 | native tolower(c); 21 | native toupper(c); 22 | native swapchars(c); 23 | 24 | native random(max); 25 | 26 | native min(value1, value2); 27 | native max(value1, value2); 28 | native clamp(value, min=cellmin, max=cellmax); 29 | 30 | native getproperty(id=0, const name[]="", value=cellmin, string[]=""); 31 | native setproperty(id=0, const name[]="", value=cellmin, const string[]=""); 32 | native deleteproperty(id=0, const name[]="", value=cellmin); 33 | native existproperty(id=0, const name[]="", value=cellmin); 34 | 35 | -------------------------------------------------------------------------------- /amx-test/pawno/include/datagram.inc: -------------------------------------------------------------------------------- 1 | /* Datagram sending/receiving 2 | * 3 | * (c) Copyright 2005, ITB CompuPhase 4 | * This file is provided as is (no warranties). 5 | */ 6 | #if defined _datagram_included 7 | #endinput 8 | #endif 9 | #define _datagram_included 10 | #pragma library DGram 11 | 12 | native sendstring(const message[], const destination[]=""); 13 | native sendpacket(const packet[], size, const destination[]=""); 14 | 15 | native listenport(port); 16 | 17 | forward @receivestring(const message[], const source[]); 18 | forward @receivepacket(const packet[], size, const source[]); 19 | -------------------------------------------------------------------------------- /amx-test/pawno/include/file.inc: -------------------------------------------------------------------------------- 1 | /* File input/output functions 2 | * 3 | * (c) Copyright 2004-2005, ITB CompuPhase 4 | * This file is provided as is (no warranties). 5 | */ 6 | #if defined _file_included 7 | #endinput 8 | #endif 9 | #define _file_included 10 | #pragma library File 11 | 12 | enum filemode 13 | { 14 | io_read, /* file must exist */ 15 | io_write, /* creates a new file */ 16 | io_readwrite, /* opens an existing file, or creates a new file */ 17 | io_append, /* appends to file (write-only) */ 18 | } 19 | 20 | enum seek_whence 21 | { 22 | seek_start, 23 | seek_current, 24 | seek_end, 25 | } 26 | 27 | const EOF = -1; 28 | 29 | native File:fopen(const name[], filemode: mode = io_readwrite); 30 | native bool:fclose(File: handle); 31 | native File:ftemp(); 32 | native bool:fremove(const name[]); 33 | 34 | native fwrite(File: handle, const string[]); 35 | native fread(File: handle, string[], size = sizeof string, bool: pack = false); 36 | native bool:fputchar(File: handle, value, bool: utf8 = true); 37 | native fgetchar(File: handle, value, bool: utf8 = true); 38 | native fblockwrite(File: handle, const buffer[], size = sizeof buffer); 39 | native fblockread(File: handle, buffer[], size = sizeof buffer); 40 | 41 | native fseek(File: handle, position = 0, seek_whence: whence = seek_start); 42 | native flength(File: handle); 43 | native fexist(const pattern[]); 44 | native bool:fmatch(name[], const pattern[], index = 0, size = sizeof name); 45 | -------------------------------------------------------------------------------- /amx-test/pawno/include/string.inc: -------------------------------------------------------------------------------- 1 | /* String functions 2 | * 3 | * (c) Copyright 2005, ITB CompuPhase 4 | * This file is provided as is (no warranties). 5 | */ 6 | #if defined _string_included 7 | #endinput 8 | #endif 9 | #define _string_included 10 | #pragma library String 11 | 12 | native strlen(const string[]); 13 | native strpack(dest[], const source[], maxlength=sizeof dest); 14 | native strunpack(dest[], const source[], maxlength=sizeof dest); 15 | native strcat(dest[], const source[], maxlength=sizeof dest); 16 | 17 | native strmid(dest[], const source[], start, end, maxlength=sizeof dest); 18 | native bool: strins(string[], const substr[], pos, maxlength=sizeof string); 19 | native bool: strdel(string[], start, end); 20 | 21 | native strcmp(const string1[], const string2[], bool:ignorecase=false, length=cellmax); 22 | native strfind(const string[], const sub[], bool:ignorecase=false, pos=0); 23 | 24 | native strval(const string[]); 25 | native valstr(dest[], value, bool:pack=false); 26 | native bool: ispacked(const string[]); 27 | 28 | native uudecode(dest[], const source[], maxlength=sizeof dest); 29 | native uuencode(dest[], const source[], numbytes, maxlength=sizeof dest); 30 | native memcpy(dest[], const source[], index=0, numbytes, maxlength=sizeof dest); 31 | -------------------------------------------------------------------------------- /amx-test/pawno/include/time.inc: -------------------------------------------------------------------------------- 1 | /* Date/time functions 2 | * 3 | * (c) Copyright 2001-2005, ITB CompuPhase 4 | * This file is provided as is (no warranties). 5 | */ 6 | #if defined _time_included 7 | #endinput 8 | #endif 9 | #define _time_included 10 | #pragma library Time 11 | 12 | native gettime(&hour=0, &minute=0, &second=0); 13 | native getdate(&year=0, &month=0, &day=0); 14 | native tickcount(&granularity=0); 15 | -------------------------------------------------------------------------------- /amx-test/pawno/libpawnc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-test/pawno/libpawnc.dll -------------------------------------------------------------------------------- /amx-test/pawno/new.pwn: -------------------------------------------------------------------------------- 1 | // This is a comment 2 | // uncomment the line below if you want to write a filterscript 3 | //#define FILTERSCRIPT 4 | 5 | #include 6 | 7 | #if defined FILTERSCRIPT 8 | 9 | public OnFilterScriptInit() 10 | { 11 | print("\n--------------------------------------"); 12 | print(" Blank Filterscript by your name here"); 13 | print("--------------------------------------\n"); 14 | return 1; 15 | } 16 | 17 | public OnFilterScriptExit() 18 | { 19 | return 1; 20 | } 21 | 22 | #else 23 | 24 | main() 25 | { 26 | print("\n----------------------------------"); 27 | print(" Blank Gamemode by your name here"); 28 | print("----------------------------------\n"); 29 | } 30 | 31 | #endif 32 | 33 | public OnGameModeInit() 34 | { 35 | // Don't use these lines if it's a filterscript 36 | SetGameModeText("Blank Script"); 37 | AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); 38 | return 1; 39 | } 40 | 41 | public OnGameModeExit() 42 | { 43 | return 1; 44 | } 45 | 46 | public OnPlayerRequestClass(playerid, classid) 47 | { 48 | SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); 49 | SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); 50 | SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); 51 | return 1; 52 | } 53 | 54 | public OnPlayerConnect(playerid) 55 | { 56 | return 1; 57 | } 58 | 59 | public OnPlayerDisconnect(playerid, reason) 60 | { 61 | return 1; 62 | } 63 | 64 | public OnPlayerSpawn(playerid) 65 | { 66 | return 1; 67 | } 68 | 69 | public OnPlayerDeath(playerid, killerid, reason) 70 | { 71 | return 1; 72 | } 73 | 74 | public OnVehicleSpawn(vehicleid) 75 | { 76 | return 1; 77 | } 78 | 79 | public OnVehicleDeath(vehicleid, killerid) 80 | { 81 | return 1; 82 | } 83 | 84 | public OnPlayerText(playerid, text[]) 85 | { 86 | return 1; 87 | } 88 | 89 | public OnPlayerCommandText(playerid, cmdtext[]) 90 | { 91 | if (strcmp("/mycommand", cmdtext, true, 10) == 0) 92 | { 93 | // Do something here 94 | return 1; 95 | } 96 | return 0; 97 | } 98 | 99 | public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) 100 | { 101 | return 1; 102 | } 103 | 104 | public OnPlayerExitVehicle(playerid, vehicleid) 105 | { 106 | return 1; 107 | } 108 | 109 | public OnPlayerStateChange(playerid, newstate, oldstate) 110 | { 111 | return 1; 112 | } 113 | 114 | public OnPlayerEnterCheckpoint(playerid) 115 | { 116 | return 1; 117 | } 118 | 119 | public OnPlayerLeaveCheckpoint(playerid) 120 | { 121 | return 1; 122 | } 123 | 124 | public OnPlayerEnterRaceCheckpoint(playerid) 125 | { 126 | return 1; 127 | } 128 | 129 | public OnPlayerLeaveRaceCheckpoint(playerid) 130 | { 131 | return 1; 132 | } 133 | 134 | public OnRconCommand(cmd[]) 135 | { 136 | return 1; 137 | } 138 | 139 | public OnPlayerRequestSpawn(playerid) 140 | { 141 | return 1; 142 | } 143 | 144 | public OnObjectMoved(objectid) 145 | { 146 | return 1; 147 | } 148 | 149 | public OnPlayerObjectMoved(playerid, objectid) 150 | { 151 | return 1; 152 | } 153 | 154 | public OnPlayerPickUpPickup(playerid, pickupid) 155 | { 156 | return 1; 157 | } 158 | 159 | public OnVehicleMod(playerid, vehicleid, componentid) 160 | { 161 | return 1; 162 | } 163 | 164 | public OnVehiclePaintjob(playerid, vehicleid, paintjobid) 165 | { 166 | return 1; 167 | } 168 | 169 | public OnVehicleRespray(playerid, vehicleid, color1, color2) 170 | { 171 | return 1; 172 | } 173 | 174 | public OnPlayerSelectedMenuRow(playerid, row) 175 | { 176 | return 1; 177 | } 178 | 179 | public OnPlayerExitedMenu(playerid) 180 | { 181 | return 1; 182 | } 183 | 184 | public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) 185 | { 186 | return 1; 187 | } 188 | 189 | public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) 190 | { 191 | return 1; 192 | } 193 | 194 | public OnRconLoginAttempt(ip[], password[], success) 195 | { 196 | return 1; 197 | } 198 | 199 | public OnPlayerUpdate(playerid) 200 | { 201 | return 1; 202 | } 203 | 204 | public OnPlayerStreamIn(playerid, forplayerid) 205 | { 206 | return 1; 207 | } 208 | 209 | public OnPlayerStreamOut(playerid, forplayerid) 210 | { 211 | return 1; 212 | } 213 | 214 | public OnVehicleStreamIn(vehicleid, forplayerid) 215 | { 216 | return 1; 217 | } 218 | 219 | public OnVehicleStreamOut(vehicleid, forplayerid) 220 | { 221 | return 1; 222 | } 223 | 224 | public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 225 | { 226 | return 1; 227 | } 228 | 229 | public OnPlayerClickPlayer(playerid, clickedplayerid, source) 230 | { 231 | return 1; 232 | } 233 | -------------------------------------------------------------------------------- /amx-test/pawno/pawn.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-test/pawno/pawn.ico -------------------------------------------------------------------------------- /amx-test/pawno/pawnc.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-test/pawno/pawnc.dll -------------------------------------------------------------------------------- /amx-test/pawno/pawncc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-test/pawno/pawncc.exe -------------------------------------------------------------------------------- /amx-test/pawno/pawno.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-test/pawno/pawno.exe -------------------------------------------------------------------------------- /amx-test/pawno/settings.ini: -------------------------------------------------------------------------------- 1 | [General] 2 | FileAssoc=1 3 | [Display] 4 | WindowMax=1 5 | WindowX=556 6 | WindowY=261 7 | WindowW=790 8 | WindowH=485 9 | Splitter=339 10 | Font_Name=Courier New 11 | Font_Size=10 12 | ShowFuncList=1 13 | [RunOpts] 14 | CopyDir=\ 15 | ExeFile=pawncc.exe 16 | Params=-r -w 203 17 | 18 | -------------------------------------------------------------------------------- /amx-test/testgm.amx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx-test/testgm.amx -------------------------------------------------------------------------------- /amx/client/arrowmarkers.lua: -------------------------------------------------------------------------------- 1 | -- makes any arrow markers move up and down like in single player 2 | 3 | local streamedMarkers = {} -- { marker = { (baseX, baseY, baseZ | offsetX, offsetY, offsetZ, attachedTo = elem), anim = anim } } 4 | local sin = math.sin 5 | 6 | local function setMarkerZ(marker, angle) 7 | local info = streamedMarkers[marker] 8 | if not info then 9 | return 10 | end 11 | local baseX, baseY, baseZ 12 | if info.attachedTo then 13 | baseX, baseY, baseZ = getElementPosition(info.attachedTo) 14 | baseX, baseY, baseZ = baseX + info[1], baseY + info[2], baseZ + info[3] 15 | else 16 | baseX, baseY, baseZ = unpack(info) 17 | end 18 | setElementPosition(marker, baseX, baseY, baseZ + sin(angle)) 19 | end 20 | 21 | addEventHandler('onClientElementStreamIn', root, 22 | function() 23 | if getElementType(source) ~= 'marker' or getMarkerType(source) ~= 'arrow' then 24 | return 25 | end 26 | local attachedTo = getElementAttachedTo(source) 27 | if attachedTo then 28 | local x, y, z = getElementPosition(source) 29 | local baseX, baseY, baseZ = getElementPosition(attachedTo) 30 | detachElements(source) 31 | streamedMarkers[source] = { x - baseX, y - baseY, z - baseZ, attachedTo = attachedTo } 32 | else 33 | streamedMarkers[source] = { getElementPosition(source) } 34 | end 35 | streamedMarkers[source].anim = Animation.createAndPlay(source, { from = 0, to = 2 * math.pi, time = 2000, repeats = 0, fn = setMarkerZ }) 36 | end 37 | ) 38 | 39 | addEventHandler('onClientElementStreamOut', root, 40 | function() 41 | if getElementType(source) ~= 'marker' or getMarkerType(source) ~= 'arrow' then 42 | return 43 | end 44 | local info = streamedMarkers[source] 45 | if info.attachedTo then 46 | attachElements(source, info.attachedTo, unpack(info)) 47 | else 48 | setElementPosition(source, unpack(info)) 49 | end 50 | info.anim:remove() 51 | streamedMarkers[source] = nil 52 | end 53 | ) 54 | -------------------------------------------------------------------------------- /amx/client/bone_attach_c.lua: -------------------------------------------------------------------------------- 1 | function sendReadyMessage() 2 | triggerServerEvent('boneAttach_requestAttachmentData', root) 3 | end 4 | addEventHandler('onClientResourceStart', resourceRoot, sendReadyMessage) 5 | 6 | function getAttachmentData(ped, bone, x, y, z, rx, ry, rz) 7 | for element, att_ped in pairs(ped) do 8 | setElementCollisionsEnabled(element, false) 9 | attached_ped[element] = att_ped 10 | attached_bone[element] = bone[element] 11 | attached_x[element] = x[element] 12 | attached_y[element] = y[element] 13 | attached_z[element] = z[element] 14 | attached_rx[element] = rx[element] 15 | attached_ry[element] = ry[element] 16 | attached_rz[element] = rz[element] 17 | end 18 | end 19 | addEvent('boneAttach_sendAttachmentData', true) 20 | addEventHandler('boneAttach_sendAttachmentData', root, getAttachmentData) 21 | 22 | function initAttach() 23 | addEvent('boneAttach_attach', true) 24 | addEvent('boneAttach_detach', true) 25 | addEventHandler('boneAttach_attach', root, attachElementToBone) 26 | addEventHandler('boneAttach_detach', root, detachElementFromBone) 27 | end 28 | addEventHandler('onClientResourceStart', resourceRoot, initAttach) 29 | 30 | bone_0, bone_t, bone_f = {}, {}, {} 31 | bone_0[1], bone_t[1], bone_f[1] = 5, nil, 6 -- head 32 | bone_0[2], bone_t[2], bone_f[2] = 4, 5, 8 -- neck 33 | bone_0[3], bone_t[3], bone_f[3] = 3, nil, 31 -- spine 34 | bone_0[4], bone_t[4], bone_f[4] = 1, 2, 3 -- pelvis 35 | bone_0[5], bone_t[5], bone_f[5] = 4, 32, 5 -- left clavicle 36 | bone_0[6], bone_t[6], bone_f[6] = 4, 22, 5 -- right clavicle 37 | bone_0[7], bone_t[7], bone_f[7] = 32, 33, 34 -- left shoulder 38 | bone_0[8], bone_t[8], bone_f[8] = 22, 23, 24 -- right shoulder 39 | bone_0[9], bone_t[9], bone_f[9] = 33, 34, 32 -- left elbow 40 | bone_0[10], bone_t[10], bone_f[10] = 23, 24, 22 -- right elbow 41 | bone_0[11], bone_t[11], bone_f[11] = 34, 35, 36 -- left hand 42 | bone_0[12], bone_t[12], bone_f[12] = 24, 25, 26 -- right hand 43 | bone_0[13], bone_t[13], bone_f[13] = 41, 42, 43 -- left hip 44 | bone_0[14], bone_t[14], bone_f[14] = 51, 52, 53 -- right hip 45 | bone_0[15], bone_t[15], bone_f[15] = 42, 43, 44 -- left knee 46 | bone_0[16], bone_t[16], bone_f[16] = 52, 53, 54 -- right knee 47 | bone_0[17], bone_t[17], bone_f[17] = 43, 42, 44 -- left ankle 48 | bone_0[18], bone_t[18], bone_f[18] = 53, 52, 54 -- right angle 49 | bone_0[19], bone_t[19], bone_f[19] = 44, 43, 42 -- left foot 50 | bone_0[20], bone_t[20], bone_f[20] = 54, 53, 52 -- right foot 51 | 52 | function putAttachedElementsOnBones() 53 | for element, ped in pairs(attached_ped) do 54 | if not isElement(element) then 55 | clearAttachmentData(element) 56 | elseif isElementStreamedIn(ped) then 57 | local bone = attached_bone[element] 58 | local x, y, z = getPedBonePosition(ped, bone_0[bone]) 59 | local xx, xy, xz, yx, yy, yz, zx, zy, zz = getBoneMatrix(ped,bone) 60 | local offx, offy, offz = attached_x[element], attached_y[element], attached_z[element] 61 | local offrx, offry, offrz = attached_rx[element], attached_ry[element], attached_rz[element] 62 | local objx = x + offx * xx + offy * yx + offz * zx 63 | local objy = y + offx * xy + offy * yy + offz * zy 64 | local objz = z + offx * xz + offy * yz + offz * zz 65 | local rxx, rxy, rxz, ryx, ryy, ryz, rzx, rzy, rzz = getMatrixFromEulerAngles(offrx, offry, offrz) 66 | 67 | local txx = rxx * xx + rxy * yx + rxz * zx 68 | local txy = rxx * xy + rxy * yy + rxz * zy 69 | local txz = rxx * xz + rxy * yz + rxz * zz 70 | local tyx = ryx * xx + ryy * yx + ryz * zx 71 | local tyy = ryx * xy + ryy * yy + ryz * zy 72 | local tyz = ryx * xz + ryy * yz + ryz * zz 73 | local tzx = rzx * xx + rzy * yx + rzz * zx 74 | local tzy = rzx * xy + rzy * yy + rzz * zy 75 | local tzz = rzx * xz + rzy * yz + rzz * zz 76 | offrx, offry, offrz = getEulerAnglesFromMatrix(txx, txy, txz, tyx, tyy, tyz, tzx, tzy, tzz) 77 | if (string.find(objx .. objy .. objz, 'a')) then 78 | setElementPosition(element, x, y, z) 79 | else 80 | setElementPosition(element, objx, objy, objz) 81 | end 82 | if (not string.find(offrx .. offry .. offrz, 'a')) then 83 | setElementRotation(element, offrx, offry, offrz, 'ZXY') 84 | else 85 | setElementPosition(element, getElementPosition(ped)) 86 | end 87 | end 88 | end 89 | end 90 | addEventHandler('onClientPreRender', root, putAttachedElementsOnBones) -------------------------------------------------------------------------------- /amx/client/bone_pos_rot.lua: -------------------------------------------------------------------------------- 1 | sx, sy, sz = 0, 0, 3 2 | tx, ty, tz = 0, 0, 4 3 | fx, fy, fz = 0, 1, 3 4 | 5 | function getMatrixFromPoints(x, y, z, x3, y3, z3, x2, y2, z2) 6 | x3 = x3 - x 7 | y3 = y3 - y 8 | z3 = z3 - z 9 | x2 = x2 - x 10 | y2 = y2 - y 11 | z2 = z2 - z 12 | local x1 = y2 * z3 - z2 * y3 13 | local y1 = z2 * x3 - x2 * z3 14 | local z1 = x2 * y3 - y2 * x3 15 | x2 = y3 * z1 - z3 * y1 16 | y2 = z3 * x1 - x3 * z1 17 | z2 = x3 * y1 - y3 * x1 18 | local len1 = 1 / math.sqrt(x1 * x1 + y1 * y1 + z1 * z1) 19 | local len2 = 1 / math.sqrt(x2 * x2 + y2 * y2 + z2 * z2) 20 | local len3 = 1 / math.sqrt(x3 * x3 + y3 * y3 + z3 * z3) 21 | x1 = x1 * len1 y1 = y1 * len1 z1 = z1 * len1 22 | x2 = x2 * len2 y2 = y2 * len2 z2 = z2 * len2 23 | x3 = x3 * len3 y3 = y3 * len3 z3 = z3 * len3 24 | return x1, y1, z1, x2, y2, z2, x3, y3, z3 25 | end 26 | 27 | function getEulerAnglesFromMatrix(x1, y1, z1, x2, y2, z2, x3, y3, z3) 28 | local nz1, nz2, nz3 29 | nz3 = math.sqrt(x2 * x2 + y2 * y2) 30 | nz1 = -x2 * z2 / nz3 31 | nz2 = -y2 * z2 / nz3 32 | local vx = nz1 * x1 + nz2 * y1 + nz3 * z1 33 | local vz = nz1 * x3 + nz2 * y3 + nz3 * z3 34 | return math.deg(math.asin(z2)), -math.deg(math.atan2(vx, vz)), -math.deg(math.atan2(x2, y2)) 35 | end 36 | 37 | function getMatrixFromEulerAngles(x, y, z) 38 | x, y, z = math.rad(x), math.rad(y), math.rad(z) 39 | local sinx, cosx, siny, cosy, sinz, cosz = math.sin(x), math.cos(x), math.sin(y), math.cos(y), math.sin(z), math.cos(z) 40 | return 41 | cosy * cosz - siny * sinx * sinz, cosy * sinz + siny * sinx * cosz, -siny * cosx, 42 | -cosx * sinz, cosx * cosz, sinx, 43 | siny * cosz + cosy * sinx * sinz, siny * sinz - cosy * sinx * cosz, cosy * cosx 44 | end 45 | 46 | if not script_serverside then 47 | function getBoneMatrix(ped, bone) 48 | local x, y, z, tx, ty, tz, fx, fy, fz 49 | x, y, z = getPedBonePosition(ped, bone_0[bone]) 50 | if bone == 1 then 51 | local x6, y6, z6 = getPedBonePosition(ped, 6) 52 | local x7, y7, z7 = getPedBonePosition(ped, 7) 53 | tx, ty, tz = (x6 + x7) * 0.5, (y6 + y7) * 0.5, (z6 + z7) * 0.5 54 | elseif bone == 3 then 55 | local x21, y21, z21 = getPedBonePosition(ped, 21) 56 | local x31, y31, z31 = getPedBonePosition(ped, 31) 57 | tx, ty, tz = (x21 + x31) * 0.5, (y21 + y31) * 0.5, (z21 + z31) * 0.5 58 | else 59 | tx, ty, tz = getPedBonePosition(ped, bone_t[bone]) 60 | end 61 | fx, fy, fz = getPedBonePosition(ped, bone_f[bone]) 62 | local xx, xy, xz, yx, yy, yz, zx, zy, zz = getMatrixFromPoints(x, y, z, tx, ty, tz, fx, fy, fz) 63 | if bone == 1 or bone == 3 then xx, xy, xz, yx, yy, yz = -yx, -yy, -yz, xx, xy, xz end 64 | return xx, xy, xz, yx, yy, yz, zx, zy, zz 65 | end 66 | end -------------------------------------------------------------------------------- /amx/client/garages.lua: -------------------------------------------------------------------------------- 1 | addEventHandler('onClientResourceStart', resourceRoot, 2 | function() 3 | for i = 0, 49 do 4 | local gx, gy, gz = getGaragePosition(i) 5 | local colshape = createColSphere(gx, gy, gz, 20) 6 | setElementData(colshape, 'GarageID', i) 7 | 8 | -- Check initial proximity 9 | if isElementWithinColShape(localPlayer, colshape) then 10 | server.setGarageOpen(i, true) 11 | end 12 | end 13 | end 14 | ) 15 | 16 | addEventHandler('onClientColShapeHit', resourceRoot, 17 | function(hitElement, matchingDimension) 18 | if hitElement == localPlayer and matchingDimension then 19 | local garage = getElementData(source, 'GarageID') 20 | if garage and not isGarageOpen(garage) then 21 | server.setGarageOpen(garage, true) 22 | end 23 | end 24 | end 25 | ) 26 | 27 | addEventHandler('onClientColShapeLeave', resourceRoot, 28 | function(hitElement, matchingDimension) 29 | if hitElement == localPlayer and matchingDimension then 30 | local garage = getElementData(source, 'GarageID') 31 | if garage and isGarageOpen(garage) then 32 | server.setGarageOpen(garage, false) 33 | end 34 | end 35 | end 36 | ) 37 | -------------------------------------------------------------------------------- /amx/client/map_waypoint.lua: -------------------------------------------------------------------------------- 1 | local targetBlipIcon = 41 2 | local targetBlip 3 | 4 | local screenSize = Vector2(guiGetScreenSize()) 5 | local wasLMBPressed, wasRMBPressed = false, false 6 | local wasMapOpened = false 7 | 8 | local function handleMapTargetBlip() 9 | if not isPlayerMapVisible() then 10 | if wasMapOpened then 11 | showCursor(false, false) 12 | wasLMBPressed, wasRMBPressed = false, false 13 | wasMapOpened = false 14 | end 15 | return 16 | end 17 | 18 | if not isCursorShowing() then 19 | showCursor(true, false) 20 | end 21 | 22 | local isLMBPressed = getKeyState('mouse1') 23 | if isLMBPressed and isLMBPressed ~= wasLMBPressed then 24 | local cursorPos, mapMin, mapMax = Vector2(getCursorPosition()) 25 | cursorPos.x, cursorPos.y = cursorPos.x * screenSize.x, cursorPos.y * screenSize.y 26 | 27 | do 28 | local mx, my, Mx, My = getPlayerMapBoundingBox() 29 | mapMin = Vector2(mx, my) 30 | mapMax = Vector2(Mx, My) 31 | end 32 | 33 | if cursorPos.x >= mapMin.x and cursorPos.y >= mapMin.y and cursorPos.x <= mapMax.x and cursorPos.y <= mapMax.y then 34 | local relPos = Vector2((cursorPos.x - mapMin.x) / (mapMax.x - mapMin.x), (cursorPos.y - mapMin.y) / (mapMax.y - mapMin.y)) 35 | local worldPlanePos = Vector2(6000 * (relPos.x - 0.5), 3000 - (relPos.y * 6000)) 36 | local worldPos = Vector3(worldPlanePos.x, worldPlanePos.y, getGroundPosition(worldPlanePos.x, worldPlanePos.y, 3000)) 37 | 38 | triggerServerEvent('OnPlayerClickMap_Ev', localPlayer, worldPos.x, worldPos.y, worldPos.z) 39 | playSoundFrontEnd(1) 40 | 41 | if not targetBlip then 42 | targetBlip = createBlip(worldPos, targetBlipIcon) 43 | else 44 | setElementPosition(targetBlip, worldPos) 45 | end 46 | end 47 | end 48 | 49 | local isRMBPressed = getKeyState('mouse2') 50 | if targetBlip then 51 | if isRMBPressed and isRMBPressed ~= wasRMBPressed then 52 | playSoundFrontEnd(2) 53 | destroyElement(targetBlip) 54 | targetBlip = nil 55 | end 56 | end 57 | 58 | wasLMBPressed, wasRMBPressed = isLMBPressed, isRMBPressed 59 | wasMapOpened = true 60 | end 61 | addEventHandler('onClientRender', root, handleMapTargetBlip) 62 | -------------------------------------------------------------------------------- /amx/client/mouselook.lua: -------------------------------------------------------------------------------- 1 | -- implements a mouse look for spectating e.g. vehicles, as MTA's setCameraTarget only supports players 2 | 3 | local screenWidth, screenHeight = guiGetScreenSize() 4 | 5 | local phi, theta = false, false 6 | local target 7 | local distance = false 8 | 9 | local sin = math.sin 10 | local cos = math.cos 11 | local pi = math.pi 12 | 13 | local _setCameraMatrix = setCameraMatrix 14 | 15 | local function scale(factor, baseX, baseY, baseZ, x, y, z) 16 | return baseX + factor * (x - baseX), baseY + factor * (y - baseY), baseZ + factor * (z - baseZ) 17 | end 18 | 19 | local function onRender() 20 | if not phi or not theta then 21 | return 22 | end 23 | local x, y, z = getElementPosition(target) 24 | local camX = x + 3 * distance * cos(phi) * cos(theta) 25 | local camY = y + 3 * distance * sin(phi) * cos(theta) 26 | local camZ = z + 0.4 * distance + 2 * distance * sin(theta) 27 | local camLookZ = z + 0.5 * distance 28 | local hit, hitX, hitY, hitZ = processLineOfSight(x, y, camLookZ, camX, camY, camZ, true, false, false) 29 | if hit then 30 | camX, camY, camZ = scale(0.9, x, y, camLookZ, hitX, hitY, hitZ) 31 | end 32 | _setCameraMatrix(camX, camY, camZ, x, y, camLookZ) 33 | end 34 | 35 | local function onMouseMove(relX, relY, absX, absY) 36 | if isMTAWindowActive() then 37 | return 38 | end 39 | absX = absX - screenWidth / 2 40 | absY = absY - screenHeight / 2 41 | phi = (phi - 0.005 * absX) % (2 * pi) 42 | theta = theta + 0.005 * absY 43 | if theta > 0.4 * pi then 44 | theta = 0.4 * pi 45 | elseif theta < -0.4 * pi then 46 | theta = -0.4 * pi 47 | end 48 | end 49 | 50 | local function registerHandlers() 51 | addEventHandler('onClientCursorMove', root, onMouseMove) 52 | addEventHandler('onClientRender', root, onRender) 53 | end 54 | 55 | local function unregisterHandlers() 56 | removeEventHandler('onClientCursorMove', root, onMouseMove) 57 | removeEventHandler('onClientRender', root, onRender) 58 | end 59 | 60 | local _setCameraTarget = setCameraTarget 61 | function setCameraTarget(_target) 62 | unregisterHandlers() 63 | if getElementType(_target) == 'player' then 64 | _setCameraTarget(_target) 65 | elseif getElementType(_target) == 'vehicle' and getVehicleController(_target) then 66 | _setCameraTarget(getVehicleController(_target)) 67 | elseif isElement(_target) then 68 | phi = 0 69 | theta = 0 70 | target = _target 71 | distance = getElementRadius(_target) or 3.5 72 | registerHandlers() 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /amx/images/closebtn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx/images/closebtn.png -------------------------------------------------------------------------------- /amx/images/closebtn_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx/images/closebtn_hover.png -------------------------------------------------------------------------------- /amx/images/logo_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/multitheftauto/amx/3d4c32cf9572f3c6bef0ed68b918162a474cd53e/amx/images/logo_small.png -------------------------------------------------------------------------------- /amx/meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |