├── .gitattributes ├── .github └── workflows │ └── DETUtils_AutoBuild.yaml ├── .gitignore ├── CODEOWNERS ├── CONTRIBUTING.md ├── DETUTILS.png ├── DETUTILS ├── d_als.inc ├── d_als │ ├── d_als_entry.inc │ ├── d_als_impl.inc │ └── d_als_macros.inc ├── d_anticheat.inc ├── d_anticheat │ └── d_anticheat_entry.inc ├── d_ascii.inc ├── d_ascii │ ├── d_ascii_entry.inc │ └── d_ascii_impl.inc ├── d_commands.inc ├── d_commands │ ├── d_commands_entry.inc │ ├── d_commands_impl.inc │ ├── d_commands_macros.inc │ └── d_commands_setup.inc ├── d_core │ ├── d_core_compilefix.inc │ ├── d_core_debug.inc │ ├── d_core_entry.inc │ ├── d_core_errors.inc │ ├── d_core_funcgen.inc │ ├── d_core_funcs.inc │ ├── d_core_init.inc │ ├── d_core_mainfix.inc │ ├── d_core_memory.inc │ ├── d_core_rem.inc │ ├── d_core_text.inc │ ├── d_core_thirdpartyinclude.inc │ └── d_core_version.inc ├── d_dialog.inc ├── d_dialog │ ├── d_dialog_entry.inc │ └── d_dialog_macros.inc ├── d_discordapi.inc ├── d_discordapi │ ├── d_discordapi_commands.inc │ ├── d_discordapi_data.inc │ ├── d_discordapi_entry.inc │ └── d_discordapi_macros.inc ├── d_editobject.inc ├── d_editobject │ ├── d_editobject_entry.inc │ └── d_editobject_impl.inc ├── d_events.inc ├── d_events │ ├── d_events_commands.inc │ ├── d_events_dialogs.inc │ ├── d_events_entry.inc │ └── d_events_properties.inc ├── d_factions.inc ├── d_factions │ ├── d_factions_entry.inc │ ├── d_factions_impl.inc │ └── d_factions_permissions.inc ├── d_filequeries.inc ├── d_filequeries │ └── d_filequeries_entry.inc ├── d_fmargs.inc ├── d_fmargs │ ├── d_fmargs_entry.inc │ ├── d_fmargs_impl.inc │ └── d_fmargs_sscanf.inc ├── d_foreach.inc ├── d_foreach │ ├── d_foreach_entry.inc │ └── d_foreach_macros.inc ├── d_global.inc ├── d_global │ ├── d_global_entry.inc │ ├── d_global_idx.inc │ ├── d_global_impl.inc │ └── d_global_parse.inc ├── d_lambda.inc ├── d_lambda │ ├── d_lambda_entry.inc │ ├── d_lambda_header.inc │ └── d_lambda_impl.inc ├── d_mapeditor.inc ├── d_mapeditor │ └── d_mapeditor_entry.inc ├── d_permissions.inc ├── d_permissions │ └── d_permissions_entry.inc ├── d_profile.inc ├── d_profile │ ├── d_profile_entry.inc │ └── d_profile_macros.inc ├── d_properties.inc ├── d_properties │ └── d_properties_entry.inc ├── d_races.inc ├── d_races │ ├── d_races_entry.inc │ └── d_races_impl.inc ├── d_server.inc ├── d_server │ ├── d_server_cfg.inc │ ├── d_server_entry.inc │ └── d_server_impl.inc ├── d_tables.inc ├── d_tables │ ├── d_tables_entry.inc │ └── d_tables_macros.inc ├── d_testing.inc ├── d_testing │ ├── d_testing_entry.inc │ ├── d_testing_impl.inc │ └── d_testing_internal.inc ├── d_timers.inc ├── d_timers │ ├── d_timers_entry.inc │ └── d_timers_macros.inc ├── d_toml.inc ├── d_toml │ ├── d_toml_entry.inc │ ├── d_toml_impl.inc │ └── d_toml_save.inc ├── d_vars.inc ├── d_vars │ ├── d_vars_circular.inc │ ├── d_vars_entry.inc │ ├── d_vars_macros.inc │ ├── d_vars_stack.inc │ ├── d_vars_standard.inc │ └── d_vars_strret.inc ├── d_visual.inc ├── d_visual │ ├── d_visual_dmzones.inc │ ├── d_visual_entry.inc │ ├── d_visual_impl.inc │ └── d_visual_tdanims.inc ├── d_yaml.inc ├── d_yaml │ ├── d_yaml_entry.inc │ ├── d_yaml_impl.inc │ └── d_yaml_save.inc └── detutils.inc ├── DETUTILS_TESTS.amx ├── DETUTILS_TESTS.pwn ├── README.md ├── ReleaseNotes.md ├── detutils.png ├── docs ├── d_als.md ├── d_anticheat.md ├── d_ascii.md ├── d_cmdparsing.md ├── d_commands.md ├── d_core.md ├── d_debug.md ├── d_dialog.md ├── d_discordapi.md ├── d_discordapi_commands.md ├── d_discordapi_data.md ├── d_dmzone.md ├── d_editobject.md ├── d_events.md ├── d_example.md ├── d_extra.md ├── d_factions.md ├── d_filequeries.md ├── d_fmargs.md ├── d_foreach.md ├── d_global.md ├── d_installation.md ├── d_lambda.md ├── d_limits.md ├── d_mapeditor.md ├── d_memory.md ├── d_permissions.md ├── d_profile.md ├── d_properties.md ├── d_races.md ├── d_rem.md ├── d_server.md ├── d_tables.md ├── d_testing.md ├── d_testlog.md ├── d_testscript.md ├── d_timers.md ├── d_toml.md ├── d_vars.md ├── d_vars_circular.md ├── d_vars_stack.md ├── d_vars_standard.md ├── d_versioning.md ├── d_visual.md ├── d_visual_tdanims.md ├── d_yaml.md └── detutils.md ├── license.md ├── pawn.json └── tests ├── DETUTILS_TESTS.pwn ├── README.md ├── a_commands_tests.inc ├── a_interiors_tests.inc ├── a_interiors_tests_ingame.pwn ├── lib_test2.pwn ├── lib_test_2.c ├── libraries_tests.c ├── library_test.pwn └── library_test3.c /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pwn linguist-language=Pawn 2 | *.inc linguist-language=Pawn 3 | -------------------------------------------------------------------------------- /.github/workflows/DETUtils_AutoBuild.yaml: -------------------------------------------------------------------------------- 1 | name: DETUtils - sampctl test build 2 | on: 3 | push: 4 | branches: [ "master" ] 5 | pull_request: 6 | branches: [ "master" ] 7 | workflow_dispatch: 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - uses: AGraber/sampctl-action@v1 14 | with: 15 | version: '1.10.0' 16 | - run: sampctl package build --forceEnsure 17 | - run: sampctl version 18 | 19 | - uses: actions/upload-artifact@v3 20 | with: 21 | name: DETUtils_Build_Test 22 | path: DETUTILS_TESTS.pwn 23 | retention-days: 1 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /DETUTILS.rar 2 | /DETUTILS.zip 3 | /DETUTILS.tar.gz 4 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | DEntis-T 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Check [read me](README.md) for all information. 4 | -------------------------------------------------------------------------------- /DETUTILS.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bracesoftware/DETUtils-Old/81147eade9c8823457bb2e2728856b8724da8e02/DETUTILS.png -------------------------------------------------------------------------------- /DETUTILS/d_als.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #include "d_core\d_core_entry" 15 | 16 | // After funcgen (core entry) is included, 17 | // we include the entry point. 18 | 19 | #if defined __DETUTILS_INTERNAL_ALS_INC 20 | 21 | #endinput 22 | 23 | #endif 24 | 25 | #define __DETUTILS_INTERNAL_ALS_INC 26 | 27 | #define DETUTILS_LIBVER_ALS 1 28 | 29 | #include "d_als\d_als_entry" -------------------------------------------------------------------------------- /DETUTILS/d_als/d_als_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * a new system of ALS hooking. 11 | * 12 | * 13 | */ 14 | 15 | #include "d_als_macros" 16 | 17 | /* 18 | 19 | 20 | 88b d88 88 db 88888888ba 88 21 | 888b d888 "" d88b 88 "8b 88 22 | 88`8b d8'88 d8'`8b 88 ,8P 88 23 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 24 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 25 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 26 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 27 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 28 | 29 | 30 | 31 | */ 32 | 33 | #include "d_als_impl" 34 | 35 | /* 36 | 37 | 88888888888 38 | 88 ,d 39 | 88 88 40 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 41 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 42 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 43 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 44 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 45 | 46 | 47 | */ 48 | 49 | public OnDETUtilsInit() 50 | { 51 | #if defined DETUTILS_DEBUG_MODE 52 | SaveLogIntoFile("detutils_als.log", "[DETUtils]: (debug) - Loading..."); 53 | SaveLogIntoFile("detutils_als.log", "[DETUtils]: (debug) - Loaded."); 54 | #endif 55 | LoadDETUtilsScript(DETUTILS_SCRIPT_ALS); 56 | if(funcidx("d_als_detutilsinit") != -1) 57 | { 58 | CallLocalFunction("d_als_detutilsinit", ""); 59 | } 60 | return 1; 61 | } 62 | 63 | #if defined _ALS_OnDETUtilsInit 64 | #undef OnDETUtilsInit 65 | #else 66 | #define _ALS_OnDETUtilsInit 67 | #endif 68 | 69 | #define OnDETUtilsInit( d_als_detutilsinit( 70 | 71 | forward d_als_detutilsinit(); 72 | 73 | // cleanup 74 | 75 | public OnDETUtilsExit() 76 | { 77 | UnloadDETUtilsScript(DETUTILS_SCRIPT_ALS); 78 | if(funcidx("d_als_detutilsexit") != -1) 79 | { 80 | CallLocalFunction("d_als_detutilsexit", ""); 81 | } 82 | return 1; 83 | } 84 | 85 | #if defined _ALS_OnDETUtilsExit 86 | #undef OnDETUtilsExit 87 | #else 88 | #define _ALS_OnDETUtilsExit 89 | #endif 90 | 91 | #define OnDETUtilsExit( d_als_detutilsexit( 92 | 93 | forward d_als_detutilsexit(); 94 | 95 | /* 96 | public OnDETUtilsInit() 97 | { 98 | // Set the default return value. 99 | #emit ZERO.pri 100 | #if defined d_als_detutilsinit 101 | d_als_detutilsinit(); 102 | #endif 103 | 104 | #if defined DETUTILS_DEBUG_MODE 105 | SaveLogIntoFile("detutils_als.log", "[DETUtils]: (debug) - Loading..."); 106 | SaveLogIntoFile("detutils_als.log", "[DETUtils]: (debug) - Loaded."); 107 | #endif 108 | LoadDETUtilsScript(DETUTILS_SCRIPT_ALS); 109 | 110 | // Implicitly return the value of the previous call. This means we can 111 | // call `main` and return it's return value, without requiring it to 112 | // have a `return` statement. It might, but the most common uses don't. 113 | #emit RETN 114 | // Return 0, just in case. 115 | return 0; 116 | } 117 | 118 | #if defined _ALS_OnDETUtilsInit 119 | #undef OnDETUtilsInit 120 | #else 121 | #define _ALS_OnDETUtilsInit 122 | #endif 123 | forward d_als_detutilsinit(); 124 | 125 | #define OnDETUtilsInit( d_als_detutilsinit(*/ -------------------------------------------------------------------------------- /DETUTILS/d_als/d_als_impl.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * a new system of ALS hooking. 11 | * 12 | * 13 | */ 14 | 15 | /* 16 | 17 | 18 | 88b d88 88 db 88888888ba 88 19 | 888b d888 "" d88b 88 "8b 88 20 | 88`8b d8'88 d8'`8b 88 ,8P 88 21 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 22 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 23 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 24 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 25 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 26 | 27 | 28 | 29 | */ 30 | 31 | 32 | #define @a_detals$ new funcname[32];for(new hookindex;hookindex<1000;hookindex++){ 33 | 34 | #if defined DETUTILS_ALS_CALL_DEBUG 35 | 36 | #define @b_detals$%0$ format(funcname,32,"@%i@%s",hookindex,%0); \ 37 | __DETUtilsDebug("Attempted to call: %s", funcname); \ 38 | if(funcidx(funcname)!= -1){ 39 | 40 | #endif 41 | 42 | #if !defined DETUTILS_ALS_CALL_DEBUG 43 | 44 | #define @b_detals$%0$ format(funcname,32,"@%i@%s",hookindex,%0); \ 45 | if(funcidx(funcname)!= -1){ 46 | 47 | #endif 48 | 49 | #define @c_detals$%0$ if(CallLocalFunction(funcname,%0)==0)break;} 50 | #define @d_detals$..%0$ %0}%0 51 | 52 | #if defined detutils_complete_error_boom 53 | 54 | stock DET_g_DoAls(const funcname[], const call_format[], {Float,_}:...) 55 | { 56 | new alsfuncname[32]; 57 | for(new hookindex; hookindex < 1000; hookindex++) 58 | { 59 | format(alsfuncname, sizeof alsfuncname, "@%i@%s", hookindex, funcname); 60 | printf("[DETUtils]: (ALS call debug) - Attempted to call: %s", alsfuncname); 61 | if(funcidx(alsfuncname)!= -1) 62 | { 63 | if(CallLocalFunction(alsfuncname, call_format, ...) == 0) break; 64 | } 65 | } 66 | return 1; 67 | } 68 | 69 | #endif -------------------------------------------------------------------------------- /DETUTILS/d_als/d_als_macros.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * a new system of ALS hooking. 11 | * 12 | * 13 | */ 14 | 15 | #define @DETUTILSALS_KEYWORD__@%0\32; @DETUTILSALS_KEYWORD__@ 16 | #define @als%0(%1) @DETUTILSALS_KEYWORD__@ 17 | 18 | /* 19 | 20 | 21 | 88b d88 88 db 88888888ba 88 22 | 888b d888 "" d88b 88 "8b 88 23 | 88`8b d8'88 d8'`8b 88 ,8P 88 24 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 25 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 26 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 27 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 28 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 29 | 30 | 31 | 32 | */ 33 | 34 | #if !defined DETUTILS_NO_HOOK_KEYWORD 35 | 36 | #define hook \ 37 | @als() function 38 | 39 | #endif 40 | 41 | #if !defined DET_g_Interval 42 | #define DET_g_Interval 1000 43 | #endif 44 | 45 | #if defined DETUTILS_COMPAT 46 | 47 | #define als @als() 48 | 49 | #endif 50 | 51 | #define @DET_ALS$ 52 | //#define @DHQS_%0\32; @DHQS_ 53 | #define @DETUTILSALS_KEYWORD__@break (0) 54 | #define @DETUTILSALS_KEYWORD__@continue (1) 55 | 56 | #define @DETUTILSALS_KEYWORD__@function%1(%2) @DET_ALS$ @DETUTILSFUNCGEN$%1..%2$;@DETUTILSFUNCGEN$%1..%2$ 57 | 58 | #define @DETUTILSALS_KEYWORD__@do%1(%0,%2)%4; \ 59 | @DET_ALS$ @a_detals$ @DET_ALS$ @b_detals$%0$ @DET_ALS$ @c_detals$%2$ @DET_ALS$ @d_detals$..%4$ -------------------------------------------------------------------------------- /DETUTILS/d_anticheat.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_ANTICHEAT 1 15 | 16 | #include "d_anticheat\d_anticheat_entry" -------------------------------------------------------------------------------- /DETUTILS/d_ascii.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_ASCII 1 15 | 16 | #include "d_ascii\d_ascii_entry" -------------------------------------------------------------------------------- /DETUTILS/d_ascii/d_ascii_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * the new ASCII char defines. 11 | * 12 | * 13 | */ 14 | 15 | /* 16 | 17 | 18 | 88b d88 88 db 88888888ba 88 19 | 888b d888 "" d88b 88 "8b 88 20 | 88`8b d8'88 d8'`8b 88 ,8P 88 21 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 22 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 23 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 24 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 25 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 26 | 27 | 28 | 29 | */ 30 | 31 | #include "d_ascii_impl" 32 | 33 | /* 34 | 35 | 88888888888 36 | 88 ,d 37 | 88 88 38 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 39 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 40 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 41 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 42 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 43 | 44 | 45 | */ 46 | 47 | public OnDETUtilsInit() 48 | { 49 | LoadDETUtilsScript(DETUTILS_SCRIPT_ASCII); 50 | if(funcidx("d_ascii_detutilsinit") != -1) 51 | { 52 | CallLocalFunction("d_ascii_detutilsinit", ""); 53 | } 54 | return 1; 55 | } 56 | 57 | #if defined _ALS_OnDETUtilsInit 58 | #undef OnDETUtilsInit 59 | #else 60 | #define _ALS_OnDETUtilsInit 61 | #endif 62 | 63 | #define OnDETUtilsInit( d_ascii_detutilsinit( 64 | 65 | forward d_ascii_detutilsinit(); 66 | 67 | // cleanup 68 | 69 | public OnDETUtilsExit() 70 | { 71 | UnloadDETUtilsScript(DETUTILS_SCRIPT_ASCII); 72 | if(funcidx("d_ascii_detutilsexit") != -1) 73 | { 74 | CallLocalFunction("d_ascii_detutilsexit", ""); 75 | } 76 | return 1; 77 | } 78 | 79 | #if defined _ALS_OnDETUtilsExit 80 | #undef OnDETUtilsExit 81 | #else 82 | #define _ALS_OnDETUtilsExit 83 | #endif 84 | 85 | #define OnDETUtilsExit( d_ascii_detutilsexit( 86 | 87 | forward d_ascii_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_commands.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_COMMANDS 1 15 | 16 | #include "d_commands\d_commands_entry" -------------------------------------------------------------------------------- /DETUTILS/d_commands/d_commands_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides creating 10 | * various types of commands in 11 | * various types of syntax. 12 | * 13 | * 14 | */ 15 | 16 | /* 17 | 18 | 88b d88 88 db 88888888ba 88 19 | 888b d888 "" d88b 88 "8b 88 20 | 88`8b d8'88 d8'`8b 88 ,8P 88 21 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 22 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 23 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 24 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 25 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 26 | 27 | 28 | */ 29 | 30 | // Macros: 31 | #include "d_commands_setup" 32 | #include "d_commands_macros" 33 | 34 | // Implementation: 35 | #include "d_commands_impl" 36 | 37 | /* 38 | 39 | 88888888888 40 | 88 ,d 41 | 88 88 42 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 43 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 44 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 45 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 46 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 47 | 48 | 49 | */ 50 | 51 | public OnDETUtilsInit() 52 | { 53 | LoadDETUtilsScript(DETUTILS_SCRIPT_COMMANDS); 54 | if(funcidx("d_cmd2_detutilsinit") != -1) 55 | { 56 | CallLocalFunction("d_cmd2_detutilsinit", ""); 57 | } 58 | return 1; 59 | } 60 | 61 | #if defined _ALS_OnDETUtilsInit 62 | #undef OnDETUtilsInit 63 | #else 64 | #define _ALS_OnDETUtilsInit 65 | #endif 66 | 67 | #define OnDETUtilsInit( d_cmd2_detutilsinit( 68 | 69 | forward d_cmd2_detutilsinit(); 70 | 71 | 72 | // cleanup: 73 | 74 | public OnDETUtilsExit() 75 | { 76 | UnloadDETUtilsScript(DETUTILS_SCRIPT_COMMANDS); 77 | if(funcidx("d_cmd2_detutilsexit") != -1) 78 | { 79 | CallLocalFunction("d_cmd2_detutilsexit", ""); 80 | } 81 | return 1; 82 | } 83 | 84 | #if defined _ALS_OnDETUtilsExit 85 | #undef OnDETUtilsExit 86 | #else 87 | #define _ALS_OnDETUtilsExit 88 | #endif 89 | 90 | #define OnDETUtilsExit( d_cmd2_detutilsexit( 91 | 92 | forward d_cmd2_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_core/d_core_compilefix.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides slight 10 | * "compile fix". 11 | * 12 | * 13 | */ 14 | 15 | #if !defined DETUTILS_NO_COMPILE_FIX 16 | 17 | // THIS IS REALLY IMPORTANT! 18 | // NOTE: This is a HACK, don't remove this: 19 | #pragma option -;+ 20 | 21 | #if defined DETUTILS_DO_LST 22 | 23 | #pragma option -l 24 | 25 | #endif 26 | 27 | #elseif defined DETUTILS_NO_COMPILE_FIX 28 | 29 | #if !defined DETUTILS_NO_MODULE_WARNINGS 30 | 31 | #warning [DETUtils]: (warning) - Internal library 'd_compilefix.inc' is disabled. 32 | 33 | #endif 34 | 35 | #endif -------------------------------------------------------------------------------- /DETUTILS/d_core/d_core_debug.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library core file. 10 | * 11 | * 12 | * 13 | */ 14 | 15 | #define __line,) __line) 16 | 17 | #define __DETUTILS_DEBUG_STRSIZE 1024 18 | 19 | new 20 | __DETUtilsDebug_[__DETUTILS_DEBUG_STRSIZE], 21 | __DETUtilsError_[__DETUTILS_DEBUG_STRSIZE], 22 | __DETUtilsWarning_[__DETUTILS_DEBUG_STRSIZE], 23 | __DETUtilsInfo_[__DETUTILS_DEBUG_STRSIZE]; 24 | 25 | #if defined DETUTILS_DEBUG_MODE 26 | 27 | #if defined __DETUtilsDebug 28 | #undef __DETUtilsDebug 29 | #endif 30 | 31 | #define __DETUtilsDebug%0(%1,%2) \ 32 | format(__DETUtilsDebug_,__DETUTILS_DEBUG_STRSIZE,"[DETUtils]: (debug @ %s:%i) - "%1,__file,__line,%2)&& \ 33 | print(__DETUtilsDebug_)&&SaveDETUtilsLog(__DETUtilsDebug_) 34 | 35 | #elseif !defined DETUTILS_DEBUG_MODE 36 | 37 | #define __DETUtilsDebug%0(%1)%2; 38 | 39 | #endif 40 | 41 | #if defined __DETUtilsWarning 42 | #undef __DETUtilsWarning 43 | #endif 44 | 45 | #define __DETUtilsWarning%0(%1,%2) \ 46 | format(__DETUtilsWarning_,__DETUTILS_DEBUG_STRSIZE,"*** [DETUtils]: (warning @ %s:%i) - "%1,__file,__line,%2)&& \ 47 | print(__DETUtilsWarning_)&&SaveDETUtilsLog(__DETUtilsWarning_) 48 | 49 | 50 | #if defined __DETUtilsError 51 | #undef __DETUtilsError 52 | #endif 53 | 54 | #define __DETUtilsError%0(%1,%2) \ 55 | format(__DETUtilsError_,__DETUTILS_DEBUG_STRSIZE,"*!* [DETUtils]: (error @ %s:%i) - "%1,__file,__line,%2)&& \ 56 | print(__DETUtilsError_)&&SaveDETUtilsLog(__DETUtilsError_) 57 | 58 | #if defined __DETUtilsInfo 59 | #undef __DETUtilsInfo 60 | #endif 61 | 62 | #define __DETUtilsInfo%0(%1,%2) \ 63 | format(__DETUtilsInfo_,__DETUTILS_DEBUG_STRSIZE,"* [DETUtils]: (info @ %s:%i) - "%1,__file,__line,%2)&& \ 64 | print(__DETUtilsInfo_)&&SaveDETUtilsLog(__DETUtilsInfo_) -------------------------------------------------------------------------------- /DETUTILS/d_core/d_core_errors.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Code parse dependency 4 | * 5 | * 6 | * 7 | * DETUtils core 8 | * 9 | * 10 | */ 11 | 12 | #define DETUTILS_ERROR_1 "1 :: Undefined command `%s`." 13 | #define DETUTILS_ERROR_2 "2 :: Undefined chatmode ID `%i`." 14 | #define DETUTILS_ERROR_3 "3 :: Undefined custom-prefixed command `%s`." 15 | #define DETUTILS_ERROR_4 "4 :: Invalid dimension." 16 | #define DETUTILS_ERROR_5 "5 :: Size of a circular array or a stack can't be less than 1." -------------------------------------------------------------------------------- /DETUTILS/d_core/d_core_funcs.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library core file. 10 | * 11 | * 12 | * 13 | */ 14 | 15 | #define @DETUTILSCORE_KWORD__@%0\32; @DETUTILSCORE_KWORD__@ 16 | #define det @DETUTILSCORE_KWORD__@ 17 | 18 | #if defined DETUTILS_COMPATIBILITY_MODE || defined detutils_complete_error_boom 19 | 20 | #error [DETUtils]: (fatal error) - crl :: Stop messing with the core libraries! 21 | 22 | #endif 23 | 24 | //Undefine this anyways: 25 | #if defined DETUTILS_COMPATIBILITY_MODE 26 | #undef DETUTILS_COMPATIBILITY_MODE 27 | #endif 28 | 29 | #if !defined __PawnBuild 30 | 31 | #error [DETUtils]: (fatal error) - DETUtils require community Pawn compiler. Get it from: github.com/pawn-lang/compiler 32 | 33 | #endif 34 | 35 | #if defined DETUTILS_DEBUG_MODE 36 | 37 | #pragma warning disable 231 38 | 39 | #endif 40 | 41 | /* 42 | 43 | 88888888ba, 44 | 88 `"8b ,d 45 | 88 `8b 88 46 | 88 88 ,adPPYYba, MM88MMM ,adPPYYba, 47 | 88 88 "" `Y8 88 "" `Y8 48 | 88 8P ,adPPPPP88 88 ,adPPPPP88 49 | 88 .a8P 88, ,88 88, 88, ,88 50 | 88888888Y"' `"8bbdP"Y8 "Y888 `"8bbdP"Y8 51 | 52 | */ 53 | 54 | #define D_COLOUR_GREY "{B9C9BF}" 55 | 56 | stock d_SendWarningMessage(playerid, const string[]) 57 | { 58 | new message[300]; 59 | format(message, 300, ""D_COLOUR_GREY"Warning: [DETUtils]: (debug) - %s", string); 60 | return SendClientMessage(playerid, -1, message); 61 | } 62 | 63 | /* 64 | 65 | 88888888888 66 | 88 ,d 67 | 88 88 68 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 69 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 70 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 71 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 72 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 73 | 74 | 75 | */ 76 | 77 | #if defined DETUTILS_NO_DIALOG 78 | 79 | stock HidePlayerDialog(playerid) 80 | { 81 | ShowPlayerDialog(playerid, -1, 1, @DETUTILSSTRING_NULL__4); 82 | return 1; 83 | } 84 | 85 | #endif 86 | 87 | stock _ReturnPlayerName(id) 88 | { 89 | new player_name[MAX_PLAYER_NAME]; 90 | GetPlayerName(id, player_name, sizeof player_name); 91 | return player_name; 92 | } 93 | 94 | stock SaveLogIntoFile(const filename[], const message[]) 95 | { 96 | // For internal backwards compatibility I'm lazy to remove. 97 | return 1; 98 | } 99 | 100 | #if !defined __SAMPStdLib 101 | 102 | stock strtok(const string[], &index, delimiter = ' ') { 103 | new length = strlen(string); 104 | while ((index < length) && (string[index] <= delimiter)) { 105 | index++; 106 | } 107 | new offset = index; 108 | new result[128]; 109 | while ((index < length) && (string[index] > delimiter) && ((index - offset) < (sizeof(result) - 1))) { 110 | result[index - offset] = string[index]; 111 | index++; 112 | } 113 | result[index - offset] = EOS; 114 | return result; 115 | } 116 | 117 | stock strrest(const string[], &index) 118 | { 119 | new length = strlen(string); 120 | while ((index < length) && (string[index] <= ' ')) 121 | { 122 | index++; 123 | } 124 | new offset = index; 125 | new result[128]; 126 | while ((index < length) && ((index - offset) < (sizeof(result) - 1))) 127 | { 128 | result[index - offset] = string[index]; 129 | index++; 130 | } 131 | result[index - offset] = EOS; 132 | return result; 133 | } 134 | 135 | #endif -------------------------------------------------------------------------------- /DETUTILS/d_core/d_core_mainfix.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * - Mainfix provides 6 | * the main() in filterscripts 7 | * too. 8 | * 9 | * - This is internal include 10 | * so it's included alone. 11 | * 12 | */ 13 | 14 | #if defined d_mainfix_included 15 | 16 | #endscript 17 | 18 | #endif 19 | 20 | #define d_mainfix_included 21 | 22 | /* 23 | 24 | Code 25 | 26 | */ 27 | 28 | #if defined DETUTILS_FILTERSCRIPT_MODE 29 | 30 | public OnFilterScriptInit() 31 | { 32 | main(); 33 | if(funcidx("a_mainfix_fsinit") != -1) 34 | { 35 | CallLocalFunction("a_mainfix_fsinit", ""); 36 | } 37 | OnDETUtilsInit(); 38 | return 1; 39 | } 40 | 41 | #if defined _ALS_OnFilterScriptInit 42 | #undef OnFilterScriptInit 43 | #else 44 | #define _ALS_OnFilterScriptInit 45 | #endif 46 | 47 | #define OnFilterScriptInit a_mainfix_fsinit 48 | 49 | forward a_mainfix_fsinit(); 50 | 51 | main() 52 | { 53 | #if defined DETUTILS_DEBUG_MODE_MODE 54 | SendRconCommand("hostname [DETUtils]: (test) - Server"); 55 | SetGameModeText("SA:MP | DET-Utils"); 56 | #endif 57 | a_mainfix_entry(); 58 | } 59 | 60 | #if defined _ALS_main 61 | #undef main 62 | #else 63 | #define _ALS_main 64 | #endif 65 | 66 | #define main a_mainfix_entry 67 | 68 | #else 69 | /* 70 | main() 71 | { 72 | #if defined DETUTILS_DEBUG_MODE_MODE 73 | SendRconCommand("hostname [DETUtils]: (test) - Server"); 74 | SetGameModeText("SA:MP | DET-Utils"); 75 | #endif 76 | a_mainfix_entry(); 77 | } 78 | 79 | #if defined _ALS_main 80 | #undef main 81 | #else 82 | #define _ALS_main 83 | #endif 84 | 85 | #define main a_mainfix_entry 86 | */ 87 | #endif -------------------------------------------------------------------------------- /DETUTILS/d_core/d_core_memory.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library core file. 10 | * 11 | * 12 | */ 13 | 14 | 15 | // Entry point. 16 | #define @detmemory%0\32;%1\10;%3 ModifyDETUtilsMemory(%1); 17 | 18 | // Internal. 19 | 20 | enum DET_e_eMemory 21 | { 22 | e_INIT, 23 | e_CREATED_PROPS, 24 | e_LAST_FQUERY_TYPE, 25 | e_FQUERY_DELIMITER 26 | } 27 | 28 | new DET_g_EntryMemory[DET_e_eMemory]; 29 | 30 | // Operands: 31 | #define DET_o_SysInit 0 32 | #define DET_o_CreatedProps 1 33 | #define DET_o_LastFQueryType 2 34 | #define DET_o_FQueryDelimiter 3 35 | 36 | // Funcs. 37 | stock ModifyDETUtilsMemory(operand, value) 38 | { 39 | if(operand == DET_o_SysInit) 40 | { 41 | DET_g_EntryMemory[e_INIT] = value; 42 | printf("*** [DETUtils]: (memory) - Operand \"DET_o_SysInit\" has been updated to: \"%i\"", value); 43 | } 44 | if(operand == DET_o_CreatedProps) 45 | { 46 | DET_g_EntryMemory[e_CREATED_PROPS] = value; 47 | printf("*** [DETUtils]: (memory) - Operand \"DET_o_CreatedProps\" has been updated to: \"%i\"", value); 48 | } 49 | if(operand == DET_o_LastFQueryType) 50 | { 51 | DET_g_EntryMemory[e_LAST_FQUERY_TYPE] = value; 52 | printf("*** [DETUtils]: (memory) - Operand \"DET_o_LastFQueryType\" has been updated to: \"%i\"", value); 53 | } 54 | if(operand == DET_o_FQueryDelimiter) 55 | { 56 | DET_g_EntryMemory[e_FQUERY_DELIMITER] = value; 57 | printf("*** [DETUtils]: (memory) - Operand \"DET_o_FQueryDelimiter\" has been updated to: \"%i\"", value); 58 | } 59 | return 1; 60 | } -------------------------------------------------------------------------------- /DETUTILS/d_core/d_core_rem.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * - d_rem provides the `@rem` 6 | * decorator. 7 | * 8 | * - Provides rem levels, 9 | * IMPORTANT, HACK, 10 | * BUG and NOTE. 11 | */ 12 | 13 | #define @DETUTILSREM_KEYWORD__@%0\32; @DETUTILSREM_KEYWORD__@ 14 | #define @rem%0(%1.level%2= @DETUTILSREM_KEYWORD__@ 15 | 16 | /* 17 | 18 | 88b d88 88 db 88888888ba 88 19 | 888b d888 "" d88b 88 "8b 88 20 | 88`8b d8'88 d8'`8b 88 ,8P 88 21 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 22 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 23 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 24 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 25 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 26 | 27 | 28 | */ 29 | 30 | #define @DETUTILSREM_KEYWORD__@IMPORTANT%0)%1:%2; 31 | #define @DETUTILSREM_KEYWORD__@HACK%0)%1:%2; 32 | #define @DETUTILSREM_KEYWORD__@NOTE%0)%1:%2; 33 | #define @DETUTILSREM_KEYWORD__@BUG%0)%1:%2; -------------------------------------------------------------------------------- /DETUTILS/d_core/d_core_text.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library core file. 10 | * 11 | * 12 | */ 13 | 14 | // d_properties 15 | 16 | #define DETUTILS_TEXT_MAX_PROPS_REACH "Maximum number of created properties exceeded." 17 | #define DETUTILS_TEXT_PROPERTY_NAME "Property: %s" 18 | 19 | #define DETUTILS_TEXT_PROP_LOCK "SERVER: This property's door is locked." 20 | #define DETUTILS_TEXT_TEAMPROP_LOCK "SERVER: Invalid team; try again." 21 | 22 | // d_commands 23 | 24 | #define DETUTILS_TEXT_UNK_PRX_FUNC "Prefix function name for command %s doesn't exist." 25 | 26 | #define DETUTILS_TEXT_CHATMODE_PRX "SERVER: Chat mode switched to custom-prefixed commands mode." 27 | #define DETUTILS_TEXT_CHATMODE_MSG "SERVER: Chat mode switched to plain-text messages mode." 28 | 29 | // d_fmargs 30 | 31 | // d_visual 32 | 33 | #define DETUTILS_TEXT_MAX_GUN_REACH "Maximum number of dropped gun objects exceeded." 34 | #define DETUTILS_TEXT_CMD_TIMER "The player tried to use the command but the timer was not over yet." 35 | #define DETUTILS_TEXT_CANNOT_OPERATE ""D_COLOUR_GREY"Operation can't be completed at the moment." 36 | #define DETUTILS_TEXT_THROW_GUN ""D_COLOUR_GREY"You threw away {ffffff}%s"D_COLOUR_GREY"." 37 | #define DETUTILS_TEXT_NOGUN_NEARBY ""D_COLOUR_GREY"No guns nearby." 38 | #define DETUTILS_TEXT_GUN_DESTROY ""D_COLOUR_GREY"You destroyed {ffffff}%s"D_COLOUR_GREY"." 39 | #define DETUTILS_TEXT_GUN_PICK ""D_COLOUR_GREY"You picked up {ffffff}%s"D_COLOUR_GREY"." 40 | 41 | // d_anticheat 42 | 43 | // d_colours 44 | 45 | // d_mapeditor 46 | 47 | #define DETUTILS_TEXT_DIALOG_CONFIRM "Confirm" 48 | #define DETUTILS_TEXT_EXITDIALOG "Cancel" 49 | #define DETUTILS_TEXT_MAPEDITOR_CAPTION "Map Editor" 50 | 51 | #define DETUTILS_TEXT_MAPEDITOR_CHOICES "Create object\nDestroy object\nEdit object" 52 | #define DETUTILS_TEXT_MAPEDITOR_OBJID "Please insert the object ID you want to create below:" 53 | #define DETUTILS_TEXT_MAPEDITOR_DSTRY "Please insert the object's ID you want to destroy below:" 54 | #define DETUTILS_TEXT_MAPEDITOR_EDIT "Please insert the object's ID you want to edit below:" -------------------------------------------------------------------------------- /DETUTILS/d_core/d_core_thirdpartyinclude.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * THIRD PARTY INCLUDES 4 | * 5 | * 6 | * 7 | * DETUtils core 8 | * 9 | * 10 | */ 11 | 12 | #if !defined @DETUTILSCMD_NO_PARSER__ 13 | 14 | #tryinclude 15 | #tryinclude "code-parse" 16 | 17 | #if !defined _INC_code_parse_inc 18 | 19 | #warning [DETUtils]: (warning) - Missing code parser for Pawn function analysing. 20 | 21 | #endif 22 | 23 | #endif 24 | 25 | #tryinclude 26 | #tryinclude "amx_header" 27 | 28 | #if !defined AMX_HEADER_INC 29 | 30 | #warning [DETUtils]: (warning) - Missing AMX assembly libraries for Pawn AMX header reading. 31 | 32 | #endif 33 | 34 | #if !defined DETUTILS_NO_DISCORDAPI 35 | 36 | #tryinclude 37 | #tryinclude "discord-connector" 38 | 39 | #if !defined dcconnector_included 40 | 41 | #warning [DETUtils]: (warning) - Missing the Discord Connector plugin natives. 42 | 43 | #endif 44 | 45 | #endif -------------------------------------------------------------------------------- /DETUTILS/d_core/d_core_version.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library core file. 10 | * 11 | * 12 | */ 13 | 14 | 15 | #if __Pawn >= 0x0400 16 | #error [DETUtils]: (error) - Library does not support Pawn 4.0.x yet. 17 | #elseif __Pawn < 0x0300 18 | #error [DETUtils]: (error) - Library does not support Pawn 2.0.x/1.0.x yet. 19 | #endif 20 | 21 | /* 22 | 23 | 24 | 88b d88 88 db 88888888ba 88 25 | 888b d888 "" d88b 88 "8b 88 26 | 88`8b d8'88 d8'`8b 88 ,8P 88 27 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 28 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 29 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 30 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 31 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 32 | 33 | 34 | 35 | */ 36 | 37 | #define __DETUtils 0x207 38 | #define __DETUtilsRelease 0x3 39 | #define __DETUtilsBeta 1 40 | 41 | #define DETUTILS_VERSION_MAJOR 2 42 | #define DETUTILS_VERSION_MINOR 0 43 | #define DETUTILS_VERSION_PATCH 7 44 | #define DETUTILS_VERSION_RELEASE 3 -------------------------------------------------------------------------------- /DETUTILS/d_dialog.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_DIALOG 1 15 | 16 | #include "d_dialog\d_dialog_entry" -------------------------------------------------------------------------------- /DETUTILS/d_discordapi.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_DISCORDAPI 1 15 | 16 | #include "d_discordapi\d_discordapi_entry" -------------------------------------------------------------------------------- /DETUTILS/d_discordapi/d_discordapi_commands.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - An extension to the DCC plugin. 10 | * 11 | * 12 | */ 13 | 14 | #if !defined DISCORD_COMMAND_PREFIX 15 | #error [DETUtils]: (error) - Discord Command prefix is not defined. Please do: `#define DISCORD_COMMAND_PREFIX '!'` 16 | #endif 17 | 18 | /* 19 | 20 | 88b d88 88 db 88888888ba 88 21 | 888b d888 "" d88b 88 "8b 88 22 | 88`8b d8'88 d8'`8b 88 ,8P 88 23 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 24 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 25 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 26 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 27 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 28 | 29 | 30 | */ 31 | 32 | public DCC_OnMessageCreate(DCC_Message:message) 33 | { 34 | new DCC_User:author, 35 | DCC_Channel:channel, 36 | DCC_Guild:guild, 37 | content[1024]; 38 | 39 | DCC_GetMessageAuthor(message, author); 40 | DCC_GetMessageChannel(message, channel); 41 | DCC_GetMessageContent(message, content); 42 | DCC_GetChannelGuild(channel, guild); 43 | 44 | if(content[0] == DISCORD_COMMAND_PREFIX) 45 | { 46 | new component[2][1024]; 47 | sscanf do(content, component, 2); // using d_fmargs.inc 48 | 49 | strdel(component[0], 0, 1); //delete the prefix 50 | new cmdname[32]; 51 | format(cmdname, sizeof cmdname, "dccmd_%s", component[0]); 52 | 53 | CallLocalFunction(cmdname, "iiiis", 54 | _:guild, 55 | _:channel, 56 | _:message, 57 | _:author, 58 | component[1]); 59 | 60 | #if defined DETUTILS_DEBUG_MODE 61 | printf("[DETUtils]: (debug) - cmdinfo :: Command function: '%s' : command arguments: '%s'", cmdname, component[1]); 62 | #endif 63 | } 64 | return 1; 65 | } -------------------------------------------------------------------------------- /DETUTILS/d_discordapi/d_discordapi_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - An extension to the DCC plugin. 10 | * 11 | * 12 | */ 13 | 14 | #if !defined dcconnector_included 15 | #warning [DETUtils]: (warning) - Discord Connector plugin is missing, the 'd_discordapi.inc' library was automatically disabled. 16 | #endinput 17 | #endif 18 | 19 | #include "d_discordapi_macros" 20 | 21 | /* 22 | 23 | 88b d88 88 db 88888888ba 88 24 | 888b d888 "" d88b 88 "8b 88 25 | 88`8b d8'88 d8'`8b 88 ,8P 88 26 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 27 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 28 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 29 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 30 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 31 | 32 | 33 | */ 34 | 35 | #include "d_discordapi_commands" 36 | #include "d_discordapi_data" 37 | 38 | /* 39 | 40 | 88888888888 41 | 88 ,d 42 | 88 88 43 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 44 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 45 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 46 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 47 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 48 | 49 | 50 | */ 51 | 52 | public OnDETUtilsInit() 53 | { 54 | LoadDETUtilsScript(DETUTILS_SCRIPT_DISCORDAPI); 55 | if(funcidx("d_dcapi_detutilsinit") != -1) 56 | { 57 | CallLocalFunction("d_dcapi_detutilsinit", ""); 58 | } 59 | return 1; 60 | } 61 | 62 | #if defined _ALS_OnDETUtilsInit 63 | #undef OnDETUtilsInit 64 | #else 65 | #define _ALS_OnDETUtilsInit 66 | #endif 67 | 68 | #define OnDETUtilsInit( d_dcapi_detutilsinit( 69 | 70 | forward d_dcapi_detutilsinit(); 71 | 72 | // cleanup 73 | 74 | public OnDETUtilsExit() 75 | { 76 | UnloadDETUtilsScript(DETUTILS_SCRIPT_DISCORDAPI); 77 | if(funcidx("d_dcapi_detutilsexit") != -1) 78 | { 79 | CallLocalFunction("d_dcapi_detutilsexit", ""); 80 | } 81 | return 1; 82 | } 83 | 84 | #if defined _ALS_OnDETUtilsExit 85 | #undef OnDETUtilsExit 86 | #else 87 | #define _ALS_OnDETUtilsExit 88 | #endif 89 | 90 | #define OnDETUtilsExit( d_dcapi_detutilsexit( 91 | 92 | forward d_dcapi_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_discordapi/d_discordapi_macros.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - An extension to the DCC plugin. 10 | * 11 | * 12 | */ 13 | 14 | // commands 15 | 16 | 17 | #if !defined DETUTILS_CMD_MACROS 18 | 19 | #define @DETUTILS_CMD_DEC__@%0\32; @DETUTILS_CMD_DEC__@ 20 | 21 | #define @command%0(%1.type%2= @DETUTILS_CMD_DEC__@ 22 | 23 | #endif 24 | 25 | #define dccmd_%0\32; dccmd_ 26 | 27 | #define @DETUTILS_CMD_DEC__@DISCORD_COMMAND%2)%0(%1) \ 28 | dccmd_%0(%1);public dccmd_%0(%1) 29 | 30 | // data 31 | 32 | #if defined DETUTILS_BUGZ_LOL 33 | #define @DETUTILSDCDATA_DEC__@%0\32; @DETUTILSDCDATA_DEC__@ 34 | #define @discord%0(%1.entity%2= @DETUTILSDCDATA_DEC__@ 35 | #endif 36 | 37 | #define DCC_%0\32; DCC_ 38 | #define @discord%0(%1) DCC_ 39 | 40 | #if defined DETUTILS_BUGZ_LOL 41 | #define @DETUTILSDCDATA_DEC__@GUILD%0)%1SetIntegerData(%2) \ 42 | DET_SetGuildData_Integer(%2) 43 | #define @DETUTILSDCDATA_DEC__@GUILD%0)%1GetIntegerData(%2) \ 44 | DET_GetGuildData_Integer(%2) 45 | #define @DETUTILSDCDATA_DEC__@GUILD%0)%1SetBooleanData(%2) \ 46 | DET_SetGuildData_Boolean(%2) 47 | #define @DETUTILSDCDATA_DEC__@GUILD%0)%1GetBooleanData(%2) \ 48 | DET_GetGuildData_Boolean(%2) 49 | #define @DETUTILSDCDATA_DEC__@GUILD%0)%1SetFloatData(%2) \ 50 | DET_SetGuildData_Float(%2) 51 | #define @DETUTILSDCDATA_DEC__@GUILD%0)%1GetFloatData(%2) \ 52 | DET_GetGuildData_Float(%2) 53 | #define @DETUTILSDCDATA_DEC__@GUILD%0)%1SetStringData(%2) \ 54 | DET_SetGuildData_String(%2) 55 | #define @DETUTILSDCDATA_DEC__@GUILD%0)%1GetStringData(%2) \ 56 | DET_GetGuildData_String(%2) 57 | #define @DETUTILSDCDATA_DEC__@CHANNEL%0)%1SetIntegerData(%2) \ 58 | DET_SetChannelData_Integer(%2) 59 | #define @DETUTILSDCDATA_DEC__@CHANNEL%0)%1GetIntegerData(%2) \ 60 | DET_GetChannelData_Integer(%2) 61 | #define @DETUTILSDCDATA_DEC__@CHANNEL%0)%1SetBooleanData(%2) \ 62 | DET_SetChannelData_Boolean(%2) 63 | #define @DETUTILSDCDATA_DEC__@CHANNEL%0)%1GetBooleanData(%2) \ 64 | DET_GetChannelData_Boolean(%2) 65 | #define @DETUTILSDCDATA_DEC__@CHANNEL%0)%1SetFloatData(%2) \ 66 | DET_SetChannelData_Float(%2) 67 | #define @DETUTILSDCDATA_DEC__@CHANNEL%0)%1GetFloatData(%2) \ 68 | DET_GetChannelData_Float(%2) 69 | #define @DETUTILSDCDATA_DEC__@CHANNEL%0)%1SetStringData(%2) \ 70 | DET_SetChannelData_String(%2) 71 | #define @DETUTILSDCDATA_DEC__@CHANNEL%0)%1GetStringData(%2) \ 72 | DET_GetChannelData_String(%2) 73 | #define @DETUTILSDCDATA_DEC__@USER%0)%1SetIntegerData(%2) \ 74 | DET_SetUserData_Integer(%2) 75 | #define @DETUTILSDCDATA_DEC__@USER%0)%1GetIntegerData(%2) \ 76 | DET_GetUserData_Integer(%2) 77 | #define @DETUTILSDCDATA_DEC__@USER%0)%1SetBooleanData(%2) \ 78 | DET_SetUserData_Boolean(%2) 79 | #define @DETUTILSDCDATA_DEC__@USER%0)%1GetBooleanData(%2) \ 80 | DET_GetUserData_Boolean(%2) 81 | #define @DETUTILSDCDATA_DEC__@USER%0)%1SetFloatData(%2) \ 82 | DET_SetUserData_Float(%2) 83 | #define @DETUTILSDCDATA_DEC__@USER%0)%1GetFloatData(%2) \ 84 | DET_GetUserData_Float(%2) 85 | #define @DETUTILSDCDATA_DEC__@USER%0)%1SetStringData(%2) \ 86 | DET_SetUserData_String(%2) 87 | #define @DETUTILSDCDATA_DEC__@USER%0)%1GetStringData(%2) \ 88 | DET_GetUserData_String(%2) 89 | #endif -------------------------------------------------------------------------------- /DETUTILS/d_editobject.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_EDITOBJECT 1 15 | 16 | #include "d_editobject\d_editobject_entry" -------------------------------------------------------------------------------- /DETUTILS/d_events.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_EVENTS 1 15 | 16 | #include "d_events\d_events_entry" -------------------------------------------------------------------------------- /DETUTILS/d_events/d_events_commands.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * the @event decorator. 11 | * 12 | * 13 | */ 14 | 15 | #define @cmde_%0\32; @cmde_ 16 | 17 | /* 18 | 19 | 20 | 88b d88 88 db 88888888ba 88 21 | 888b d888 "" d88b 88 "8b 88 22 | 88`8b d8'88 d8'`8b 88 ,8P 88 23 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 24 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 25 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 26 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 27 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 28 | 29 | 30 | 31 | */ 32 | 33 | #define @DETUTILSEVENTS_KWORD__@COMMAND_EVENT%0)%1(%2) \ 34 | @cmde_%1(%2); @cmde_%1(%2) -------------------------------------------------------------------------------- /DETUTILS/d_events/d_events_dialogs.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * the @event decorator. 11 | * 12 | * 13 | */ 14 | 15 | #define @dlge_%0\32; @dlge_ 16 | #define @dlgp_%0\32; @dlgp_ 17 | 18 | #define dref_%0\32; dref_ 19 | #define dext_%0\32; dext_ 20 | #define darr_%0\32; darr_ 21 | #define dstr_%0\32; dstr_ 22 | #define dnum_%0\32; dnum_ 23 | 24 | /* 25 | 26 | 27 | 88b d88 88 db 88888888ba 88 28 | 888b d888 "" d88b 88 "8b 88 29 | 88`8b d8'88 d8'`8b 88 ,8P 88 30 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 31 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 32 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 33 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 34 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 35 | 36 | 37 | 38 | */ 39 | 40 | #define @DETUTILSEVENTS_PARSEFAIL@%5@ \ 41 | return printf("*** [DETUtils]: (event parse) - Met an unexpected or unknown argument in the dialog event header while parsing.\n\ 42 | Dialog event: '"#%5"'\n\ 43 | Make sure that your event header looks like this:\n\ 44 | @event(.type = DIALOG_EVENT) EVENT_NAME__(playerid, response, listitem inputtext[]) {...}\n\n\n") 45 | 46 | #define @DETUTILSEVENT_DLG_CACHE__@%5@%0@%1@%2@%3@%4@ \ 47 | { \ 48 | new const DET_g_DialogParamCount=%0+%1+%2+%3+%4; \ 49 | printf("*** [DETUtils]: (event parse) - Parsing a dialog event : '"#%5"' with %i parameters.", DET_g_DialogParamCount); \ 50 | if(DET_g_DialogParamCount!=4||%2 !=1||%4 !=3){DET_g_DialogParser[p]=0;@DETUTILSEVENTS_PARSEFAIL@%5@; \ 51 | }DET_g_DialogParser[p]=1;return 1;} 52 | 53 | // Entry. Parse all parameter types. 54 | #define @DETUTILSEVENT_PARSE__D:%1(%2) FUNC_PARSER(__DETEVENT_DIALOG_,ARR:NUM:EXT:STR:REF:)(%1(%2)) \ 55 | stock const dref_%1 = 0, dext_%1 = 0, darr_%1 = 0, dstr_%1 = 0, dnum_%1 = 0; \ 56 | @dlgp_%1(p);@dlgp_%1(p) @DETUTILSEVENT_DLG_CACHE__@%1@dref_%1@dext_%1@darr_%1@dstr_%1@dnum_%1@ %1(%2) 57 | 58 | // Counts. Add one to the relevant number. 59 | #define __DETEVENT_DIALOG__REF(%9)%8$%0,%1,%2,%3,%4; %8$%0 + 1,%1,%2,%3,%4; 60 | #define __DETEVENT_DIALOG__EXT(%9)%8$%0,%1,%2,%3,%4; %8$%0,%1 + 1,%2,%3,%4; 61 | #define __DETEVENT_DIALOG__ARR(%9)%8$%0,%1,%2,%3,%4; %8$%0,%1,%2 + 1,%3,%4; 62 | #define __DETEVENT_DIALOG__STR(%9)%8$%0,%1,%2,%3,%4; %8$%0,%1,%2,%3 + 1,%4; 63 | #define __DETEVENT_DIALOG__NUM(%9)%8$%0,%1,%2,%3,%4; %8$%0,%1,%2,%3,%4 + 1; 64 | 65 | // Endings 66 | #define __DETEVENT_DIALOG__END(%9)%8$ %8$ 67 | #define __DETEVENT_DIALOG__NUL(%9)%8$ %8$ 68 | 69 | // Entry point #2 70 | #define @DETUTILSEVENTS_KWORD__@DIALOG_EVENT%0)%1(%2) \ 71 | @DETUTILSEVENT_PARSE__D:%1(%2){}@dlge_%1(%2); @dlge_%1(%2) -------------------------------------------------------------------------------- /DETUTILS/d_events/d_events_properties.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * the @event decorator. 11 | * 12 | * 13 | */ 14 | 15 | #define @prpe_%0\32; @prpe_ 16 | #define @prpp_%0\32; @prpp_ 17 | 18 | #define pref_%0\32; pref_ 19 | #define pext_%0\32; pext_ 20 | #define parr_%0\32; parr_ 21 | #define pstr_%0\32; pstr_ 22 | #define pnum_%0\32; pnum_ 23 | 24 | /* 25 | 26 | 27 | 88b d88 88 db 88888888ba 88 28 | 888b d888 "" d88b 88 "8b 88 29 | 88`8b d8'88 d8'`8b 88 ,8P 88 30 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 31 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 32 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 33 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 34 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 35 | 36 | 37 | 38 | */ 39 | 40 | #define @DETUTILSEVENTS_PARSEFAIL2@%5@ \ 41 | return printf("*** [DETUtils]: (event parse) - Met an unexpected or unknown argument in the property event header while parsing.\n\ 42 | Property event: '"#%5"'\n\ 43 | Make sure that your event header looks like this:\n\ 44 | @event(.type = PROPERTY_EVENT) EVENT_NAME__(playerid, propertyid, actionid) {...}\n\n\n") 45 | 46 | #define @DETUTILSEVENT_DLG_CACHE__2@%5@%0@%1@%2@%3@%4@ \ 47 | { \ 48 | new const DET_g_DialogParamCount=%0+%1+%2+%3+%4; \ 49 | printf("*** [DETUtils]: (event parse) - Parsing a property event : '"#%5"' with %i parameters.", DET_g_DialogParamCount); \ 50 | if(DET_g_DialogParamCount!=3||%4 != 3){DET_g_PropertyParser[p]=0;@DETUTILSEVENTS_PARSEFAIL2@%5@; \ 51 | }DET_g_PropertyParser[p]=1;return 1;} 52 | 53 | // Entry. Parse all parameter types. 54 | #define @DETUTILSEVENT_PARSE__P:%1(%2) FUNC_PARSER(__DETEVENT_PROPERTY_,ARR:NUM:EXT:STR:REF:)(%1(%2)) \ 55 | stock const pref_%1 = 0, pext_%1 = 0, parr_%1 = 0, pstr_%1 = 0, pnum_%1 = 0; \ 56 | @prpp_%1(p);@prpp_%1(p) @DETUTILSEVENT_DLG_CACHE__2@%1@pref_%1@pext_%1@parr_%1@pstr_%1@pnum_%1@ %1(%2) 57 | 58 | // Counts. Add one to the relevant number. 59 | #define __DETEVENT_PROPERTY__REF(%9)%8$%0,%1,%2,%3,%4; %8$%0 + 1,%1,%2,%3,%4; 60 | #define __DETEVENT_PROPERTY__EXT(%9)%8$%0,%1,%2,%3,%4; %8$%0,%1 + 1,%2,%3,%4; 61 | #define __DETEVENT_PROPERTY__ARR(%9)%8$%0,%1,%2,%3,%4; %8$%0,%1,%2 + 1,%3,%4; 62 | #define __DETEVENT_PROPERTY__STR(%9)%8$%0,%1,%2,%3,%4; %8$%0,%1,%2,%3 + 1,%4; 63 | #define __DETEVENT_PROPERTY__NUM(%9)%8$%0,%1,%2,%3,%4; %8$%0,%1,%2,%3,%4 + 1; 64 | 65 | // Endings 66 | #define __DETEVENT_PROPERTY__END(%9)%8$ %8$ 67 | #define __DETEVENT_PROPERTY__NUL(%9)%8$ %8$ 68 | 69 | // Entry point #2 70 | #define @DETUTILSEVENTS_KWORD__@PROPERTY_EVENT%0)%1(%2) \ 71 | @DETUTILSEVENT_PARSE__P:%1(%2){} @prpe_%1(%2); @prpe_%1(%2) -------------------------------------------------------------------------------- /DETUTILS/d_factions.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_FACTIONS 1 15 | 16 | #include "d_factions\d_factions_entry" -------------------------------------------------------------------------------- /DETUTILS/d_factions/d_factions_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * creation of teams, adding 11 | * and removing players from them. 12 | * 13 | * - Also extends the features of 14 | * other includes such as 15 | * d_commands or d_properties. 16 | * 17 | * 18 | */ 19 | 20 | /* 21 | 22 | 88b d88 88 db 88888888ba 88 23 | 888b d888 "" d88b 88 "8b 88 24 | 88`8b d8'88 d8'`8b 88 ,8P 88 25 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 26 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 27 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 28 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 29 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 30 | 31 | 32 | */ 33 | 34 | #include "d_factions_impl" 35 | 36 | /* 37 | 38 | 88888888888 39 | 88 ,d 40 | 88 88 41 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 42 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 43 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 44 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 45 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 46 | 47 | */ 48 | 49 | public OnDETUtilsInit() 50 | { 51 | // For all the players: 52 | for(new i; i < MAX_PLAYERS; i++) 53 | { 54 | // Set the internal team... 55 | strmid(DET_g_PlayerFactionCache[i][Faction], "NO_FACTION", 0, 32); 56 | } 57 | 58 | LoadDETUtilsScript(DETUTILS_SCRIPT_FACTIONS); 59 | if(funcidx("d_factions_detutilsinit") != -1) 60 | { 61 | CallLocalFunction("d_factions_detutilsinit", ""); 62 | } 63 | return 1; 64 | } 65 | 66 | #if defined _ALS_OnDETUtilsInit 67 | #undef OnDETUtilsInit 68 | #else 69 | #define _ALS_OnDETUtilsInit 70 | #endif 71 | 72 | #define OnDETUtilsInit( d_factions_detutilsinit( 73 | 74 | forward d_factions_detutilsinit(); 75 | 76 | // cleanup 77 | 78 | public OnDETUtilsExit() 79 | { 80 | UnloadDETUtilsScript(DETUTILS_SCRIPT_FACTIONS); 81 | if(funcidx("d_factions_detutilsexit") != -1) 82 | { 83 | CallLocalFunction("d_factions_detutilsexit", ""); 84 | } 85 | return 1; 86 | } 87 | 88 | #if defined _ALS_OnDETUtilsExit 89 | #undef OnDETUtilsExit 90 | #else 91 | #define _ALS_OnDETUtilsExit 92 | #endif 93 | 94 | #define OnDETUtilsExit( d_factions_detutilsexit( 95 | 96 | forward d_factions_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_factions/d_factions_permissions.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Faction permissions submodule. 10 | * 11 | * 12 | */ 13 | 14 | /* 15 | 16 | 88b d88 88 db 88888888ba 88 17 | 888b d888 "" d88b 88 "8b 88 18 | 88`8b d8'88 d8'`8b 88 ,8P 88 19 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 20 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 21 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 22 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 23 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 24 | 25 | 26 | */ 27 | 28 | new DET_g_FactionPermissions[MAX_FACTIONS]; 29 | 30 | stock SetFactionPermissionInteger(const name[], permissions) 31 | { 32 | if(!strcmp("NO_FACTION", name, false)) 33 | { 34 | printf("[DETUtils]: (denied) - Permission to modify the 'NO_FACTION' faction permissions is denied."); 35 | return 0; 36 | } 37 | for(new i = 1; 38 | i < MAX_FACTIONS; 39 | i++) 40 | { 41 | if(!strcmp(DET_g_FactionCache[i][FactionName], name, false)) 42 | { 43 | DET_g_FactionPermissions[i] = permissions; 44 | } 45 | } 46 | return 1; 47 | } 48 | 49 | public OnPlayerUpdate(playerid) 50 | { 51 | new factionname[32]; 52 | GetPlayerFaction(playerid, factionname); 53 | if(strcmp(factionname, "NO_FACTION", false)) 54 | { 55 | for(new i = 1; 56 | i < MAX_FACTIONS; 57 | i++) 58 | { 59 | if(!strcmp(DET_g_FactionCache[i][FactionName], factionname, false)) 60 | { 61 | SetPlayerPermissionInteger(playerid, DET_g_FactionPermissions[i]); 62 | } 63 | } 64 | } 65 | if(funcidx("d_factperm_playerupdate") != -1) 66 | { 67 | CallLocalFunction("d_factperm_playerupdate", "i", playerid); 68 | } 69 | return 1; 70 | } 71 | 72 | #if defined _ALS_OnPlayerUpdate 73 | #undef OnPlayerUpdate 74 | #else 75 | #define _ALS_OnPlayerUpdate 76 | #endif 77 | 78 | #define OnPlayerUpdate( d_factperm_playerupdate( 79 | 80 | forward d_factperm_playerupdate(playerid); -------------------------------------------------------------------------------- /DETUTILS/d_filequeries.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_FILEQUERIES 1 15 | 16 | #include "d_filequeries\d_filequeries_entry" -------------------------------------------------------------------------------- /DETUTILS/d_fmargs.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_FMARGS 1 15 | 16 | #include "d_fmargs\d_fmargs_entry" -------------------------------------------------------------------------------- /DETUTILS/d_fmargs/d_fmargs_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides using format 10 | * inside functions. 11 | * 12 | */ 13 | 14 | #if defined _INC_y_va 15 | 16 | #warning [DETUtils]: (warning) - 'd_fmargs' is not compatible with 'y_va' include. 17 | 18 | #endif 19 | 20 | /* 21 | 22 | 88 88 23 | 88 88 24 | 88 88 25 | 88 88,dPYba,,adPYba, 8b,dPPYba, 88 26 | 88 88P' "88" "8a 88P' "8a 88 27 | 88 88 88 88 88 d8 88 28 | 88 88 88 88 88b, ,a8" 88 29 | 88 88 88 88 88`YbbdP"' 88 30 | 88 31 | 88 32 | */ 33 | 34 | // for d_visual 35 | 36 | enum enum_TextDrawData 37 | { 38 | Valid, 39 | Float:Pos[2], 40 | Float:OldPos[2] 41 | } 42 | 43 | new g_TextDrawData[MAX_TEXT_DRAWS][enum_TextDrawData]; 44 | new g_PlayerTextDrawData[MAX_TEXT_DRAWS][enum_TextDrawData]; 45 | 46 | // sscanf implementation: 47 | #include "d_fmargs_sscanf" 48 | 49 | // Actual FMARGS function implementation: 50 | #include "d_fmargs_impl" 51 | 52 | /* 53 | 54 | 88888888888 55 | 88 ,d 56 | 88 88 57 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 58 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 59 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 60 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 61 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 62 | 63 | 64 | */ 65 | 66 | public OnDETUtilsInit() 67 | { 68 | #if defined DETUTILS_DEBUG_MODE 69 | SaveLogIntoFile("detutils_fmargs.log", "[DETUtils]: (debug) - Loading..."); 70 | SaveLogIntoFile("detutils_fmargs.log", "[DETUtils]: (debug) - Loaded."); 71 | #endif 72 | LoadDETUtilsScript(DETUTILS_SCRIPT_FMARGS); 73 | if(funcidx("d_fmargs_detutilsinit") != -1) 74 | { 75 | CallLocalFunction("d_fmargs_detutilsinit", ""); 76 | } 77 | return 1; 78 | } 79 | 80 | #if defined _ALS_OnDETUtilsInit 81 | #undef OnDETUtilsInit 82 | #else 83 | #define _ALS_OnDETUtilsInit 84 | #endif 85 | 86 | #define OnDETUtilsInit( d_fmargs_detutilsinit( 87 | 88 | forward d_fmargs_detutilsinit(); 89 | 90 | // cleanup 91 | 92 | public OnDETUtilsExit() 93 | { 94 | UnloadDETUtilsScript(DETUTILS_SCRIPT_FMARGS); 95 | if(funcidx("d_fmargs_detutilsexit") != -1) 96 | { 97 | CallLocalFunction("d_fmargs_detutilsexit", ""); 98 | } 99 | return 1; 100 | } 101 | 102 | #if defined _ALS_OnDETUtilsExit 103 | #undef OnDETUtilsExit 104 | #else 105 | #define _ALS_OnDETUtilsExit 106 | #endif 107 | 108 | #define OnDETUtilsExit( d_fmargs_detutilsexit( 109 | 110 | forward d_fmargs_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_fmargs/d_fmargs_sscanf.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * Pawn implementation 11 | * of 'sscanf'. 12 | * 13 | */ 14 | 15 | #if defined DETUTILS_NO_SSCANF 16 | 17 | #endinput 18 | 19 | #endif 20 | 21 | #if !defined DETUTILS_SSCANF_DELIMITER 22 | 23 | #define DETUTILS_SSCANF_DELIMITER ' ' 24 | 25 | #endif 26 | 27 | #define SSCANF_INCLUDED 28 | 29 | /* 30 | 31 | 88 88 32 | 88 88 33 | 88 88 34 | 88 88,dPYba,,adPYba, 8b,dPPYba, 88 35 | 88 88P' "88" "8a 88P' "8a 88 36 | 88 88 88 88 88 d8 88 37 | 88 88 88 88 88b, ,a8" 88 38 | 88 88 88 88 88`YbbdP"' 88 39 | ------------------------88------------- 40 | ------------------------88------------- 41 | 42 | */ 43 | 44 | #define @DETUTILSSSCANF_KEYWORD__@%0\32; @DETUTILSSSCANF_KEYWORD__@ 45 | #define sscanf @DETUTILSSSCANF_KEYWORD__@ 46 | 47 | #define @DETUTILSSSCANF_KEYWORD__@do%0(%1,%2) DET__do_sscanf(%1,%2) 48 | #define @DETUTILSSSCANF_KEYWORD__@String%0(%1,%2,%3) strmid(%1,%2,0,%3) 49 | #define @DETUTILSSSCANF_KEYWORD__@Integer%0(%1) strval(%1) 50 | #define @DETUTILSSSCANF_KEYWORD__@Float%0(%1) floatstr(%1) 51 | 52 | #define SSCANF_FAIL 0 53 | #define SSCANF_SUCCESS 1 54 | 55 | stock DET__do_sscanf(const source[], dest[][], args = 1) 56 | { 57 | new 58 | i, 59 | start, 60 | index, 61 | len, 62 | scount; 63 | 64 | if(args != 1) 65 | { 66 | for(new ii; ii < strlen(source); ii++) 67 | { 68 | new count = strfind(source, " ", false, ii); 69 | if(count == SSCANF_SUCCESS) scount ++; 70 | } 71 | if(scount == SSCANF_FAIL) 72 | { 73 | return scount; 74 | } 75 | } 76 | while(i <= strlen(source)) 77 | { 78 | if(source[i] == DETUTILS_SSCANF_DELIMITER || i == strlen(source)) 79 | { 80 | len = strmid(dest[index], source, start, i, 128); 81 | dest[index][len] = SSCANF_FAIL; 82 | start = i + 1; 83 | index ++; 84 | } 85 | i++; 86 | } 87 | #if defined DETUTILS_DEBUG_MODE 88 | printf("[DETUtils]: (sscanf debug) - Variables; \ 89 | 'index' : %i, 'start' : %i", index, start); 90 | #endif 91 | return SSCANF_SUCCESS; 92 | } -------------------------------------------------------------------------------- /DETUTILS/d_foreach.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_FOREACH 1 15 | 16 | #include "d_foreach\d_foreach_entry" -------------------------------------------------------------------------------- /DETUTILS/d_foreach/d_foreach_macros.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Macros for d_foreach. 10 | * 11 | * 12 | */ 13 | 14 | #if defined __DETUTILS_DEFAULT_ITERATORS 15 | 16 | #error [DETUtils]: (iter error) - Compile option `__DETUTILS_DEFAULT_ITERATORS` is not available yet. 17 | 18 | #endif 19 | 20 | /* 21 | 22 | 88b d88 88 db 88888888ba 88 23 | 888b d888 "" d88b 88 "8b 88 24 | 88`8b d8'88 d8'`8b 88 ,8P 88 25 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 26 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 27 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 28 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 29 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 30 | 31 | 32 | */ 33 | 34 | // Keywords. 35 | #define @DETUTILSFOREACH_KWORD__@%0\32; @DETUTILSFOREACH_KWORD__@ 36 | #define DETUTILS_foreach @DETUTILSFOREACH_KWORD__@ 37 | #define @DETUTILSFOREACH_KWORD__2@%0\32; @DETUTILSFOREACH_KWORD__2@ 38 | #define DETUTILS_iterator @DETUTILSFOREACH_KWORD__2@ 39 | #define DETUTILS_iter DETUTILS_iterator 40 | 41 | #if DETUTILS_KEYWORD__(foreach) 42 | #define foreach DETUTILS_foreach 43 | #endif 44 | #if DETUTILS_KEYWORD__(iterator) 45 | #define iterator DETUTILS_iterator 46 | #endif 47 | #if DETUTILS_KEYWORD__(iter) 48 | #define iter DETUTILS_iter 49 | #endif 50 | 51 | // Prefixes! 52 | #define itr_%0\32; itr_ 53 | #define iid_%0\32; iid_ 54 | #define ite_%0\32; ite_ 55 | #define fii_%0\32; fii_ 56 | #define dpp_%0\32; dpp_ 57 | #define @for for 58 | #define itridx%0\32; itridx 59 | 60 | // Core preprocessor. 61 | #define DETUTILSFOREACH_DO_DECL:#${%0..%1} enum ite_%0{__retvls[%1]}; 62 | #define DETUTILS_ITER__decl:<%0..?||$$|#> new iid_%0;new itr_%0[ite_%0] 63 | #define DETUTILS_ITER__SIZE:|||%1..$||| sizeof(itr_%1[__retvls]) 64 | #define @d_ADD<%1,%2> itridx%1++,%2=itr_%1[__retvls][--itridx%1] 65 | #define @d_FUNC<%1> itridx%1 new itridx%1 67 | #define @d_VAL_C<%1> itr_%1[__retvls][itridx%1]!=-1 68 | 69 | // Iterator preprocessor. 70 | #define @DET_FOREACH_PP_1<%1> for(new dpp_%1;dpp_%1 if(itr_%1[__retvls][dpp_%1]==%2)itr_%1[__retvls] 72 | #define @DET_FOREACH_PP_3<$%1..#> [dpp_%1]=-1;break; 73 | 74 | // Iterators and iterator functions. 75 | #define @DETUTILSFOREACH_KWORD__2@new%0<%1> DETUTILSFOREACH_DO_DECL:#${%0..%1} DETUTILS_ITER__decl:<%0..?||$$|#> 76 | #define @DETUTILSFOREACH_KWORD__2@sizeof%0(%1) DETUTILS_ITER__SIZE:|||%1..$||| 77 | #define @DETUTILSFOREACH_KWORD__2@add%0(%1,%2) itr_%1[__retvls][iid_%1]=%2;iid_%1++ 78 | #define @DETUTILSFOREACH_KWORD__2@remove%0(%1,%2)%3; @DET_FOREACH_PP_1<%1> \ 79 | {@DET_FOREACH_PP_2<%1..%2>@DET_FOREACH_PP_3<$%1..#>} 80 | #define @DETUTILSFOREACH_KWORD__2@init%0(%1) for(new fii_%1;fii_%1; \ 85 | @d_FUNC<%1>;@d_ADD<%1,%2>)if(@d_VAL_C<%1>) -------------------------------------------------------------------------------- /DETUTILS/d_global.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_GLOBAL 1 15 | 16 | #include "d_global\d_global_entry" -------------------------------------------------------------------------------- /DETUTILS/d_global/d_global_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - A library providing an execution 10 | * of code outside functions. 11 | * 12 | * 13 | */ 14 | 15 | #include "d_global_idx" 16 | 17 | // After globalidx is included, 18 | // we include the entry point. 19 | 20 | #if defined __DETUTILS_INTERNAL_GLOBAL_INC 21 | 22 | #endinput 23 | 24 | #endif 25 | 26 | #define __DETUTILS_INTERNAL_GLOBAL_INC 27 | #define @DETUTILSGLOBAL_RET__FUNC:%0; {%0;return 1;} 28 | #define @DETUTILSGLOBAL_AMXFUNC__:%0; @glbc_%0();@glbc_%0() 29 | #define MAX_PROCEDURES 10000 30 | 31 | /* 32 | 33 | 88b d88 88 db 88888888ba 88 34 | 888b d888 "" d88b 88 "8b 88 35 | 88`8b d8'88 d8'`8b 88 ,8P 88 36 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 37 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 38 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 39 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 40 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 41 | 42 | 43 | */ 44 | 45 | #if defined AMX_HEADER_INC 46 | 47 | new DET_g_ProcedureFail[MAX_PROCEDURES]; 48 | #include "d_global_parse" 49 | 50 | #endif 51 | 52 | #include "d_global_impl" 53 | 54 | /* 55 | 56 | 88888888888 57 | 88 ,d 58 | 88 88 59 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 60 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 61 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 62 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 63 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 64 | 65 | 66 | */ 67 | 68 | public OnDETUtilsInit() 69 | { 70 | LoadDETUtilsGlobalCode(); 71 | LoadDETUtilsScript(DETUTILS_SCRIPT_GLOBAL); 72 | if(funcidx("d_global_detutilsinit") != -1) 73 | { 74 | CallLocalFunction("d_global_detutilsinit", ""); 75 | } 76 | return 1; 77 | } 78 | 79 | #if defined _ALS_OnDETUtilsInit 80 | #undef OnDETUtilsInit 81 | #else 82 | #define _ALS_OnDETUtilsInit 83 | #endif 84 | 85 | #define OnDETUtilsInit( d_global_detutilsinit( 86 | 87 | forward d_global_detutilsinit(); 88 | 89 | public OnDETUtilsExit() 90 | { 91 | UnloadDETUtilsScript(DETUTILS_SCRIPT_GLOBAL); 92 | if(funcidx("d_global_detutilsexit") != -1) 93 | { 94 | CallLocalFunction("d_global_detutilsexit", ""); 95 | } 96 | return 1; 97 | } 98 | 99 | #if defined _ALS_OnDETUtilsExit 100 | #undef OnDETUtilsExit 101 | #else 102 | #define _ALS_OnDETUtilsExit 103 | #endif 104 | 105 | #define OnDETUtilsExit( d_global_detutilsexit( 106 | 107 | forward d_global_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_global/d_global_impl.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - A library providing an execution 10 | * of code outside functions. 11 | * 12 | * 13 | */ 14 | 15 | #if defined detutils_complete_error_boom 16 | 17 | #define @DETUTILSGLOBAL_KWORD__@%0\32; @DETUTILSGLOBAL_KWORD__@ 18 | #define global @DETUTILSGLOBAL_KWORD__@ 19 | 20 | #endif 21 | 22 | #if DETUTILS_KEYWORD__(global) 23 | 24 | #define global DETUTILS_global 25 | 26 | #endif 27 | 28 | #define @glb%0\32; @glb 29 | #define @glbc_%0\32; @glbc_ 30 | 31 | /* 32 | 33 | 88b d88 88 db 88888888ba 88 34 | 888b d888 "" d88b 88 "8b 88 35 | 88`8b d8'88 d8'`8b 88 ,8P 88 36 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 37 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 38 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 39 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 40 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 41 | 42 | 43 | */ 44 | 45 | stock LoadDETUtilsGlobalCode() 46 | { 47 | new amx_assembly = 0; 48 | #if defined AMX_HEADER_INC 49 | 50 | //#emit JUMP amx_assembly 51 | amx_assembly = 1; 52 | 53 | #endif 54 | new globalfunc[32], parsefunc[32]; 55 | if(amx_assembly == 0) 56 | { 57 | for(new i; i < MAX_PROCEDURES - 9000; i++) 58 | { 59 | format(globalfunc, sizeof globalfunc, "@%i@glb", i); 60 | if(funcidx(globalfunc) != -1) 61 | { 62 | CallLocalFunction(globalfunc, ""); 63 | } 64 | } 65 | } 66 | if(amx_assembly == 1) 67 | { 68 | for(new i; i < MAX_PROCEDURES; i++) 69 | { 70 | // Get public name from the code header. 71 | GetPublicNameFromIndex(i, globalfunc); 72 | if(globalfunc[0] == '@' && 73 | globalfunc[1] == 'g' && 74 | globalfunc[2] == 'l' && 75 | globalfunc[3] == 'b' && 76 | globalfunc[4] == 'c' && 77 | globalfunc[5] == '_') // Check if the function is global code. 78 | { 79 | strmid(parsefunc, globalfunc, 0, 32 + 1); 80 | parsefunc[4] = 'p'; 81 | 82 | if(funcidx(parsefunc) != -1) 83 | { 84 | CallLocalFunction(parsefunc, "i", i); 85 | } 86 | 87 | if(DET_g_ProcedureFail[i] != 0) 88 | { 89 | CallLocalFunction(globalfunc, ""); 90 | } 91 | } 92 | } 93 | } 94 | return 1; 95 | } 96 | 97 | #if !defined AMX_HEADER_INC 98 | 99 | #define DETUTILS_global%0; \ 100 | @DETUTILSGLOBAL_FUNC__$glb..$; @DETUTILSGLOBAL_FUNC__$glb..$ @DETUTILSGLOBAL_RET__FUNC:%0; 101 | 102 | #elseif defined AMX_HEADER_INC 103 | 104 | #define DETUTILS_global%0(%2)%1; \ 105 | @DETUTILSGLOBAL_PROCEDURE__P:%0(%2); @DETUTILSGLOBAL_AMXFUNC__:%0; @DETUTILSGLOBAL_RET__FUNC:%1; 106 | 107 | stock CallGlobalProcedure(const procedure[]) 108 | { 109 | new parsefunc[32], globalfunc[32]; 110 | format(globalfunc, sizeof globalfunc, "@glbc_%s", procedure); 111 | format(parsefunc, sizeof parsefunc, "@glbp_%s", procedure); 112 | 113 | if(funcidx(parsefunc) != -1) 114 | { 115 | CallLocalFunction(parsefunc, "i", funcidx(globalfunc)); 116 | } 117 | 118 | if(DET_g_ProcedureFail[funcidx(globalfunc)] == 0) 119 | { 120 | return 0; 121 | } 122 | 123 | if(funcidx(globalfunc) != -1) 124 | { 125 | CallLocalFunction(globalfunc, ""); 126 | return 1; 127 | } 128 | return 0; 129 | } 130 | 131 | #endif -------------------------------------------------------------------------------- /DETUTILS/d_global/d_global_parse.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - A library providing an execution 10 | * of code outside functions. 11 | * 12 | * 13 | */ 14 | 15 | #define @glbp_%0\32; @glbp_ 16 | 17 | #define gref_%0\32; gref_ 18 | #define gext_%0\32; gext_ 19 | #define garr_%0\32; garr_ 20 | #define gstr_%0\32; gstr_ 21 | #define gnum_%0\32; gnum_ 22 | 23 | /* 24 | 25 | 26 | 88b d88 88 db 88888888ba 88 27 | 888b d888 "" d88b 88 "8b 88 28 | 88`8b d8'88 d8'`8b 88 ,8P 88 29 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 30 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 31 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 32 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 33 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 34 | 35 | 36 | 37 | */ 38 | 39 | #define @__DETGLOBAL_ARGFAIL@%5@ \ 40 | return printf("*** [DETUtils]: (global parse) - Met an extra argument in the global procedure header while parsing.\n\ 41 | Procedure name: '"#%5"'\n\ 42 | Make sure that your global procedure header looks like this:\n\ 43 | global PROCEDURE_NAME__() ;\n\n\n") 44 | 45 | #define @__DETGLOBAL_ARGNUM@%5@%0@%1@%2@%3@%4@ \ 46 | { \ 47 | new const DET_g_GlobalProcedureArgs=%0+%1+%2+%3+%4; \ 48 | printf("*** [DETUtils]: (global parse) - Parsing a global procedure : '"#%5"' with %i parameters.", DET_g_GlobalProcedureArgs); \ 49 | if(DET_g_GlobalProcedureArgs!=0){DET_g_ProcedureFail[p]=0;@__DETGLOBAL_ARGFAIL@%5@; \ 50 | }DET_g_ProcedureFail[p]=1;return 1;} 51 | 52 | // Entry. Parse all parameter types. 53 | #define @DETUTILSGLOBAL_PROCEDURE__P:%1(%2)%3; FUNC_PARSER(__DETGLOBAL_,ARR:NUM:EXT:STR:REF:)(%1(%2)) \ 54 | stock const gref_%1 = 0, gext_%1 = 0, garr_%1 = 0, gstr_%1 = 0, gnum_%1 = 0; \ 55 | @glbp_%1(p);@glbp_%1(p) @__DETGLOBAL_ARGNUM@%1@gref_%1@gext_%1@garr_%1@gstr_%1@gnum_%1@ 56 | 57 | // Counts. Add one to the relevant number. 58 | #define __DETGLOBAL__REF(%9)%8$%0,%1,%2,%3,%4; %8$%0 + 1,%1,%2,%3,%4; 59 | #define __DETGLOBAL__EXT(%9)%8$%0,%1,%2,%3,%4; %8$%0,%1 + 1,%2,%3,%4; 60 | #define __DETGLOBAL__ARR(%9)%8$%0,%1,%2,%3,%4; %8$%0,%1,%2 + 1,%3,%4; 61 | #define __DETGLOBAL__STR(%9)%8$%0,%1,%2,%3,%4; %8$%0,%1,%2,%3 + 1,%4; 62 | #define __DETGLOBAL__NUM(%9)%8$%0,%1,%2,%3,%4; %8$%0,%1,%2,%3,%4 + 1; 63 | 64 | // Endings 65 | #define __DETGLOBAL__END(%9)%8$ %8$ 66 | #define __DETGLOBAL__NUL(%9)%8$ %8$ -------------------------------------------------------------------------------- /DETUTILS/d_lambda.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_LAMBDA 1 15 | 16 | #include "d_lambda\d_lambda_entry" -------------------------------------------------------------------------------- /DETUTILS/d_lambda/d_lambda_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Provides lambda functions, 10 | * small functions used in expressions, 11 | * such as conditions, calls, etc. 12 | * 13 | * 14 | */ 15 | 16 | #define LAMBDA_FAIL 0 17 | #define LAMBDA_SUCCESS 1 18 | 19 | // Include the header with functions. 20 | #include "d_lambda_header" 21 | 22 | /* 23 | 24 | 88b d88 88 db 88888888ba 88 25 | 888b d888 "" d88b 88 "8b 88 26 | 88`8b d8'88 d8'`8b 88 ,8P 88 27 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 28 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 29 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 30 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 31 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 32 | 33 | 34 | */ 35 | 36 | #include "d_lambda_impl" 37 | 38 | /* 39 | 40 | 88888888888 41 | 88 ,d 42 | 88 88 43 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 44 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 45 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 46 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 47 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 48 | 49 | 50 | */ 51 | 52 | public OnDETUtilsInit() 53 | { 54 | LoadDETUtilsScript(DETUTILS_SCRIPT_LAMBDA); 55 | if(funcidx("d_lambda_detutilsinit") != -1) 56 | { 57 | CallLocalFunction("d_lambda_detutilsinit", ""); 58 | } 59 | return 1; 60 | } 61 | 62 | #if defined _ALS_OnDETUtilsInit 63 | #undef OnDETUtilsInit 64 | #else 65 | #define _ALS_OnDETUtilsInit 66 | #endif 67 | 68 | #define OnDETUtilsInit( d_lambda_detutilsinit( 69 | 70 | forward d_lambda_detutilsinit(); 71 | 72 | // cleanup 73 | 74 | public OnDETUtilsExit() 75 | { 76 | UnloadDETUtilsScript(DETUTILS_SCRIPT_LAMBDA); 77 | if(funcidx("d_lambda_detutilsexit") != -1) 78 | { 79 | CallLocalFunction("d_lambda_detutilsexit", ""); 80 | } 81 | return 1; 82 | } 83 | 84 | #if defined _ALS_OnDETUtilsExit 85 | #undef OnDETUtilsExit 86 | #else 87 | #define _ALS_OnDETUtilsExit 88 | #endif 89 | 90 | #define OnDETUtilsExit( d_lambda_detutilsexit( 91 | 92 | forward d_lambda_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_lambda/d_lambda_header.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Provides lambda functions, 10 | * small functions used in expressions, 11 | * such as conditions, calls, etc. 12 | * 13 | * 14 | */ 15 | 16 | /* 17 | 18 | 88b d88 88 db 88888888ba 88 19 | 888b d888 "" d88b 88 "8b 88 20 | 88`8b d8'88 d8'`8b 88 ,8P 88 21 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 22 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 23 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 24 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 25 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 26 | 27 | 28 | */ 29 | 30 | stock _D_LAMBDA_for__(const function[], range) 31 | { 32 | if(range <= 0) 33 | { 34 | __DETUtilsInfo("'lambda for' returned 'LAMBDA_FAIL'.",); 35 | return LAMBDA_FAIL; 36 | } 37 | new func[32]; 38 | format(func, 32, "@D_LM_%s", function); 39 | if(funcidx(func) == -1) 40 | { 41 | __DETUtilsInfo("'lambda for' returned 'LAMBDA_FAIL'.",); 42 | return LAMBDA_FAIL; 43 | } 44 | for(new _D_LAMBDA_inline_loop; 45 | _D_LAMBDA_inline_loop < range; 46 | _D_LAMBDA_inline_loop++) 47 | { 48 | CallLocalFunction(func, ""); 49 | } 50 | __DETUtilsInfo("'lambda for' returned 'LAMBDA_SUCCESS'.",); 51 | return LAMBDA_SUCCESS; 52 | } 53 | 54 | stock _D_LAMBDA_while__(const function[], bool:condition) 55 | { 56 | if(condition == false) 57 | { 58 | __DETUtilsInfo("'lambda while' returned 'LAMBDA_FAIL'.",); 59 | return LAMBDA_FAIL; 60 | } 61 | new func[32]; 62 | format(func, 32, "@D_LM_%s", function); 63 | if(funcidx(func) == -1) 64 | { 65 | __DETUtilsInfo("'lambda while' returned 'LAMBDA_FAIL'.",); 66 | return LAMBDA_FAIL; 67 | } 68 | _D_LAMBDA_call_while__: 69 | { 70 | CallLocalFunction(func, ""); 71 | } 72 | if(condition == true) 73 | { 74 | #emit JUMP _D_LAMBDA_call_while__ 75 | } 76 | __DETUtilsInfo("'lambda while' returned 'LAMBDA_SUCCESS'.",); 77 | return LAMBDA_SUCCESS; 78 | } 79 | 80 | stock _D_LAMBDA_using__(const function[]) 81 | { 82 | new func[32]; 83 | format(func, 32, "@D_LM_%s", function); 84 | if(funcidx(func) == -1) 85 | { 86 | __DETUtilsInfo("'lambda using' returned 'LAMBDA_FAIL'.",); 87 | return LAMBDA_FAIL; 88 | } 89 | CallLocalFunction(func, ""); 90 | __DETUtilsInfo("'lambda using' returned 'LAMBDA_SUCCESS'.",); 91 | return LAMBDA_SUCCESS; 92 | } 93 | 94 | stock _D_LAMBDA_task__(const function[], interval, repeating) 95 | { 96 | new func[32]; 97 | format(func, 32, "@D_LM_%s", function); 98 | if(funcidx(func) == -1) 99 | { 100 | __DETUtilsInfo("'lambda task' returned 'LAMBDA_FAIL'.",); 101 | return LAMBDA_FAIL; 102 | } 103 | __DETUtilsInfo("'lambda task' returned 'LAMBDA_SUCCESS'.",); 104 | return SetTimer(func, interval, repeating); 105 | } -------------------------------------------------------------------------------- /DETUTILS/d_lambda/d_lambda_impl.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Provides lambda functions, 10 | * small functions used in expressions, 11 | * such as conditions, calls, etc. 12 | * 13 | * 14 | */ 15 | 16 | /* 17 | 18 | 88b d88 88 db 88888888ba 88 19 | 888b d888 "" d88b 88 "8b 88 20 | 88`8b d8'88 d8'`8b 88 ,8P 88 21 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 22 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 23 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 24 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 25 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 26 | 27 | 28 | */ 29 | 30 | // Keywords. 31 | 32 | #define @DETUTILSLAMBDA_KWORD__@%0\32; @DETUTILSLAMBDA_KWORD__@ 33 | #define lambda @DETUTILSLAMBDA_KWORD__@ 34 | 35 | #define @D_LM_%0\32; @D_LM_ 36 | #define @D_LMV_%0\32; @D_LMV_ 37 | 38 | #define Lambda:%1= @D_LMV_%1;@D_LM_%1();@D_LM_%1() 39 | 40 | #define @DETUTILSLAMBDA_KWORD__@for%0=%1{%2} _D_LAMBDA_for__(%2) 41 | #define @DETUTILSLAMBDA_KWORD__@while%0=%1{%2} _D_LAMBDA_while__(%2) 42 | #define @DETUTILSLAMBDA_KWORD__@using%0=%1{%2} _D_LAMBDA_using__(%2) 43 | #define @DETUTILSLAMBDA_KWORD__@task%0=%1{%2} _D_LAMBDA_task__(%2) -------------------------------------------------------------------------------- /DETUTILS/d_mapeditor.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_MAPEDITOR 1 15 | 16 | #include "d_mapeditor\d_mapeditor_entry" -------------------------------------------------------------------------------- /DETUTILS/d_permissions.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_PERMISSIONS 1 15 | 16 | #include "d_permissions\d_permissions_entry" -------------------------------------------------------------------------------- /DETUTILS/d_profile.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_PROFILE 1 15 | 16 | #include "d_profile\d_profile_entry" -------------------------------------------------------------------------------- /DETUTILS/d_profile/d_profile_macros.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Macros for d_profile. 10 | * 11 | * 12 | */ 13 | 14 | #define @DETUTILSPROFILE_KWORD__@%0\32; @DETUTILSPROFILE_KWORD__@ 15 | #define @DETUTILS_profile%0(%1. @DETUTILSPROFILE_KWORD__@ 16 | #if DETUTILS_ANNOTATION__(profile) 17 | #define @profile%0(%1. @DETUTILSPROFILE_KWORD__@ 18 | #endif 19 | #define __d_pfunc%0\32; __d_pfunc 20 | #define __d_pfunc2%0\32; __d_pfunc2 21 | 22 | /* 23 | 24 | 88b d88 88 db 88888888ba 88 25 | 888b d888 "" d88b 88 "8b 88 26 | 88`8b d8'88 d8'`8b 88 ,8P 88 27 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 28 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 29 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 30 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 31 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 32 | 33 | 34 | */ 35 | 36 | /* 37 | @profile(.format = "ii", ) 38 | */ 39 | 40 | #define CallProfiler%0(%1,%2) CallLocalFunction("__d_pfunc"%1,%2) 41 | 42 | #define @DETUTILSPROFILE_KWORD__@format%2=%3{%4}%5)%0(%1) \ 43 | __d_pfunc%0(%1);public __d_pfunc%0(%1){ \ 44 | format(DET_g_ProfilerName,sizeof DET_g_ProfilerName,#%0); \ 45 | DET_g_ProfilerCount = GetTickCount(); \ 46 | return CallLocalFunction("__d_pfunc2"#%0, %4);} \ 47 | __d_pfunc2%0(%1);public __d_pfunc2%0(%1) 48 | 49 | #define @DETUTILSPROFILE_KWORD__@value%0=%1)%2return \ 50 | printf("[DETUtils]: (profiling) - Code '%s' took %i ticks to execute.",DET_g_ProfilerName,GetTickCount()-DET_g_ProfilerCount);return %1 51 | -------------------------------------------------------------------------------- /DETUTILS/d_properties.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_PROPERTIES 1 15 | 16 | #include "d_properties\d_properties_entry" -------------------------------------------------------------------------------- /DETUTILS/d_races.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_RACES 1 15 | 16 | #include "d_races\d_races_entry" -------------------------------------------------------------------------------- /DETUTILS/d_races/d_races_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * a dynamic race creation. 11 | * 12 | * 13 | */ 14 | 15 | /* 16 | 17 | 18 | 88b d88 88 db 88888888ba 88 19 | 888b d888 "" d88b 88 "8b 88 20 | 88`8b d8'88 d8'`8b 88 ,8P 88 21 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 22 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 23 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 24 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 25 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 26 | 27 | 28 | 29 | */ 30 | 31 | #include "d_races_impl" 32 | 33 | /* 34 | 35 | 88888888888 36 | 88 ,d 37 | 88 88 38 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 39 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 40 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 41 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 42 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 43 | 44 | 45 | */ 46 | 47 | public OnDETUtilsInit() 48 | { 49 | for(new i; i < MAX_PLAYERS; i++) 50 | { 51 | DET_g_PlayerRaceId[i] = -1; 52 | } 53 | for(new r; r < MAX_RACES; r++) 54 | { 55 | strmid(DET_g_RaceData[r][Name], "__INVALID_RACE", 0, 32); 56 | DET_g_RaceData[r][WinnerId] = -1; 57 | } 58 | LoadDETUtilsScript(DETUTILS_SCRIPT_RACES); 59 | if(funcidx("d_races_detutilsinit") != -1) 60 | { 61 | CallLocalFunction("d_races_detutilsinit", ""); 62 | } 63 | return 1; 64 | } 65 | 66 | #if defined _ALS_OnDETUtilsInit 67 | #undef OnDETUtilsInit 68 | #else 69 | #define _ALS_OnDETUtilsInit 70 | #endif 71 | 72 | #define OnDETUtilsInit( d_races_detutilsinit( 73 | 74 | forward d_races_detutilsinit(); 75 | 76 | // cleanup 77 | 78 | public OnDETUtilsExit() 79 | { 80 | UnloadDETUtilsScript(DETUTILS_SCRIPT_RACES); 81 | if(funcidx("d_races_detutilsexit") != -1) 82 | { 83 | CallLocalFunction("d_races_detutilsexit", ""); 84 | } 85 | return 1; 86 | } 87 | 88 | #if defined _ALS_OnDETUtilsExit 89 | #undef OnDETUtilsExit 90 | #else 91 | #define _ALS_OnDETUtilsExit 92 | #endif 93 | 94 | #define OnDETUtilsExit( d_races_detutilsexit( 95 | 96 | forward d_races_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_server.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_SERVER 1 15 | 16 | #include "d_server\d_server_entry" -------------------------------------------------------------------------------- /DETUTILS/d_server/d_server_cfg.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - A library which is providing 10 | * generally server-related functions. 11 | * 12 | * 13 | */ 14 | 15 | new DET_g_ServerConfigContent[8000]; 16 | 17 | stock DET_s_ParseConfig(const code[], destln[][], delimiter) 18 | { 19 | new 20 | i, 21 | start, 22 | index, 23 | len; 24 | 25 | while(i <= strlen(code)) 26 | { 27 | if(code[i] == delimiter || i == strlen(code)) 28 | { 29 | len = strmid(destln[index], code, start, i, 128); 30 | destln[index][len] = 0; 31 | start = i+1; 32 | index++; 33 | } 34 | i++; 35 | } 36 | return 1; 37 | } 38 | 39 | stock DET_s_ReadServerConfig() 40 | { 41 | new File:file = fopen("../server.cfg", io_read), rlen; 42 | for(new i; i < MAX_SERVERCFG_OPTIONS; i++) 43 | { 44 | DET_g_ConfigCache[i][DET_e_Valid] = 0; 45 | } 46 | if(file) 47 | { 48 | while(rlen = fread(file, DET_g_ServerConfigContent)) 49 | { 50 | //dpp_debug("Executing:\n\n%s", DET_g_ServerConfigContent); 51 | for(new i; i < 1024; i++) 52 | { 53 | DET_s_ProcessConfig(DET_g_ServerConfigContent); 54 | } 55 | } 56 | } 57 | 58 | return 1; 59 | } 60 | 61 | stock DET_s_ProcessConfig(const line[]) 62 | { 63 | //PROJECT_NAME=D++ testing 64 | new address[2][512]; 65 | DET_s_ParseConfig(line,address,' '); 66 | 67 | for(new i; i < MAX_SERVERCFG_OPTIONS; i++) 68 | { 69 | if(DET_g_ConfigCache[i][DET_e_Valid] == 0) 70 | { 71 | strmid(DET_g_ConfigCache[i][DET_e_Name],address[0],0,64,64); 72 | strmid(DET_g_ConfigCache[i][DET_e_Value],address[1],0,1024,1024); 73 | return 1; 74 | } 75 | } 76 | return 1; 77 | } 78 | 79 | stock GetServerConfigValue(const config[], dest[]) 80 | { 81 | DET_s_ReadServerConfig(); 82 | for(new i; i < MAX_SERVERCFG_OPTIONS; i++) 83 | { 84 | if(DET_g_ConfigCache[i][DET_e_Valid] == 1) 85 | { 86 | if(!strcmp(DET_g_ConfigCache[i][DET_e_Name], config)) 87 | { 88 | strmid(dest,DET_g_ConfigCache[i][DET_e_Value],0,1024,1024); 89 | return 1; 90 | } 91 | } 92 | } 93 | return 1; 94 | } -------------------------------------------------------------------------------- /DETUTILS/d_server/d_server_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - A library which is providing 10 | * generally server-related functions. 11 | * 12 | * 13 | */ 14 | 15 | #define PLAYER_CLIENT_UNKNOWN -1 16 | #define PLAYER_CLIENT_ANDROID 0 17 | #define PLAYER_CLIENT_PC 1 18 | 19 | new 20 | DET_g_Client[MAX_PLAYERS], 21 | DET_g_PedAnimsUsed = 0; 22 | 23 | #define MAX_SERVERCFG_OPTIONS 1000 24 | 25 | enum DET__ServerCfgInfo 26 | { 27 | DET_e_Valid, 28 | DET_e_Name[64], 29 | DET_e_Value[1024] 30 | } 31 | 32 | new DET_g_ConfigCache[MAX_SERVERCFG_OPTIONS][DET__ServerCfgInfo]; 33 | 34 | /* 35 | 36 | 88b d88 88 db 88888888ba 88 37 | 888b d888 "" d88b 88 "8b 88 38 | 88`8b d8'88 d8'`8b 88 ,8P 88 39 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 40 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 41 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 42 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 43 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 44 | 45 | 46 | */ 47 | 48 | #include "d_server_impl" 49 | 50 | #if !defined DETUTILS_NO_SERVER_CFG 51 | 52 | #include "d_server_cfg" 53 | 54 | #else 55 | 56 | #if !defined DETUTILS_NO_MODULE_WARNINGS 57 | 58 | #warning [DETUtils]: (includes) - Sublibrary (submodule) 'd_server_cfg' is disabled. 59 | 60 | #endif 61 | 62 | #endif 63 | 64 | /* 65 | 66 | 88888888888 67 | 88 ,d 68 | 88 88 69 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 70 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 71 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 72 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 73 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 74 | 75 | 76 | */ 77 | 78 | public OnDETUtilsInit() 79 | { 80 | LoadDETUtilsScript(DETUTILS_SCRIPT_SERVER); 81 | if(funcidx("d_srv_detutilsinit") != -1) 82 | { 83 | CallLocalFunction("d_srv_detutilsinit", ""); 84 | } 85 | return 1; 86 | } 87 | 88 | #if defined _ALS_OnDETUtilsInit 89 | #undef OnDETUtilsInit 90 | #else 91 | #define _ALS_OnDETUtilsInit 92 | #endif 93 | 94 | #define OnDETUtilsInit( d_srv_detutilsinit( 95 | 96 | forward d_srv_detutilsinit(); 97 | 98 | // cleanup 99 | 100 | public OnDETUtilsExit() 101 | { 102 | UnloadDETUtilsScript(DETUTILS_SCRIPT_SERVER); 103 | if(funcidx("d_srv_detutilsexit") != -1) 104 | { 105 | CallLocalFunction("d_srv_detutilsexit", ""); 106 | } 107 | return 1; 108 | } 109 | 110 | #if defined _ALS_OnDETUtilsExit 111 | #undef OnDETUtilsExit 112 | #else 113 | #define _ALS_OnDETUtilsExit 114 | #endif 115 | 116 | #define OnDETUtilsExit( d_srv_detutilsexit( 117 | 118 | forward d_srv_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_tables.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_TABLES 1 15 | 16 | #include "d_tables\d_tables_entry" -------------------------------------------------------------------------------- /DETUTILS/d_tables/d_tables_macros.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - An excel-like table management system. 10 | * 11 | * 12 | */ 13 | 14 | #if defined detutils_complete_error_boom 15 | #define @DETUTILSTABLES_KWORD__@%0\32; @DETUTILSTABLES_KWORD__@ 16 | #define @table%0(%1) @DETUTILSTABLES_KWORD__@ 17 | #define @DETUTILSTABLES_KWORD__1@%0\32; @DETUTILSTABLES_KWORD__1@ 18 | #define @column%0(%1) @DETUTILSTABLES_KWORD__1@ 19 | #define @DETUTILSTABLES_KWORD__2@%0\32; @DETUTILSTABLES_KWORD__2@ 20 | #define @datarow%0(%1) @DETUTILSTABLES_KWORD__2@ 21 | #define @DETUTILSTABLES_KWORD__3@%0\32; @DETUTILSTABLES_KWORD__3@ 22 | #define @cell%0(%1) @DETUTILSTABLES_KWORD__3@ 23 | #endif 24 | 25 | /* 26 | 27 | 88b d88 88 db 88888888ba 88 28 | 888b d888 "" d88b 88 "8b 88 29 | 88`8b d8'88 d8'`8b 88 ,8P 88 30 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 31 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 32 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 33 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 34 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 35 | 36 | 37 | */ 38 | 39 | #if defined detutils_complete_error_boom 40 | #define @DETUTILSTABLES_KWORD__@Create%0(%1) __CreateTable(%1) 41 | #define @DETUTILSTABLES_KWORD__@Remove%0(%1) __DeleteTable(%1) 42 | #define @DETUTILSTABLES_KWORD__@Preview%0(%1) __PreviewTable(%1) 43 | 44 | #define @DETUTILSTABLES_KWORD__1@Add%0(%1) __CreateColumn(%1) 45 | #define @DETUTILSTABLES_KWORD__1@Remove%0(%1) __DeleteColumn(%1) 46 | 47 | #define @DETUTILSTABLES_KWORD__2@Add%0(%1) __CreateRow(%1) 48 | #define @DETUTILSTABLES_KWORD__2@Remove%0(%1) __DeleteRow(%1) 49 | 50 | #define @DETUTILSTABLES_KWORD__3@Set%0(%1) __SetCellValue(%1) 51 | #define @DETUTILSTABLES_KWORD__3@Get%0(%1) __GetCellValue(%1) 52 | 53 | #define tablecreate __CreateTable 54 | #define tabledelete __DeleteTable 55 | #define previewtable __PreviewTable 56 | #define columncreate __CreateColumn 57 | #define columndelete __DeleteColumn 58 | #define rowcreate __CreateRow 59 | #define rowdelete __DeleteRow 60 | #define setcellvalue __SetCellValue 61 | #define getcellvalue __GetCellValue 62 | #endif -------------------------------------------------------------------------------- /DETUTILS/d_testing.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | 15 | #include "d_core\d_core_entry" 16 | 17 | // After funcgen (core entry) is included, 18 | // we include the entry point. 19 | 20 | #if defined __DETUTILS_INTERNAL_TESTING_INC 21 | 22 | #endinput 23 | 24 | #endif 25 | 26 | #define __DETUTILS_INTERNAL_TESTING_INC 27 | 28 | #define DETUTILS_LIBVER_TESTING 1 29 | 30 | #include "d_testing\d_testing_entry" -------------------------------------------------------------------------------- /DETUTILS/d_timers.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | 15 | #include "d_core\d_core_entry" 16 | 17 | // After funcgen (core entry) is included, 18 | // we include the entry point. 19 | 20 | #if defined __DETUTILS_INTERNAL_TIMERS_INC 21 | 22 | #endinput 23 | 24 | #endif 25 | 26 | #define __DETUTILS_INTERNAL_TIMERS_INC 27 | 28 | #define DETUTILS_LIBVER_TIMERS 1 29 | 30 | #include "d_timers\d_timers_entry" -------------------------------------------------------------------------------- /DETUTILS/d_timers/d_timers_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - A library which is providing the 10 | * automatic and manual timers. 11 | * 12 | * 13 | */ 14 | 15 | #include "d_timers_macros" 16 | 17 | /* 18 | 19 | 88b d88 88 db 88888888ba 88 20 | 888b d888 "" d88b 88 "8b 88 21 | 88`8b d8'88 d8'`8b 88 ,8P 88 22 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 23 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 24 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 25 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 26 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 27 | 28 | 29 | */ 30 | 31 | stock void:LoadDETUtilsAutomaticTimers() 32 | { 33 | new intervalfunc[32]; 34 | new taskfunc[32]; 35 | for(new i; i < 1000; i++) 36 | { 37 | format(taskfunc, sizeof taskfunc, "@%i@d_timerid", i); 38 | format(intervalfunc, sizeof intervalfunc, "@%i@d_t_int", i); 39 | if(funcidx(taskfunc) != -1) 40 | { 41 | SetTimer(taskfunc, CallLocalFunction(intervalfunc, ""), true); 42 | } 43 | } 44 | } 45 | 46 | /* 47 | 48 | 88888888888 49 | 88 ,d 50 | 88 88 51 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 52 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 53 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 54 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 55 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 56 | 57 | 58 | */ 59 | 60 | public OnDETUtilsInit() 61 | { 62 | LoadDETUtilsAutomaticTimers(); 63 | #if defined DETUTILS_DEBUG_MODE 64 | SaveLogIntoFile("detutils_timers.log", "[DETUtils]: (debug) - Loading..."); 65 | SaveLogIntoFile("detutils_timers.log", "[DETUtils]: (debug) - Loaded."); 66 | #endif 67 | LoadDETUtilsScript(DETUTILS_SCRIPT_TIMERS); 68 | if(funcidx("d_timers_detutilsinit") != -1) 69 | { 70 | CallLocalFunction("d_timers_detutilsinit", ""); 71 | } 72 | return 1; 73 | } 74 | 75 | #if defined _ALS_OnDETUtilsInit 76 | #undef OnDETUtilsInit 77 | #else 78 | #define _ALS_OnDETUtilsInit 79 | #endif 80 | 81 | #define OnDETUtilsInit( d_timers_detutilsinit( 82 | 83 | forward d_timers_detutilsinit(); 84 | 85 | // cleanup 86 | 87 | public OnDETUtilsExit() 88 | { 89 | UnloadDETUtilsScript(DETUTILS_SCRIPT_TIMERS); 90 | if(funcidx("d_timers_detutilsexit") != -1) 91 | { 92 | CallLocalFunction("d_timers_detutilsexit", ""); 93 | } 94 | return 1; 95 | } 96 | 97 | #if defined _ALS_OnDETUtilsExit 98 | #undef OnDETUtilsExit 99 | #else 100 | #define _ALS_OnDETUtilsExit 101 | #endif 102 | 103 | #define OnDETUtilsExit( d_timers_detutilsexit( 104 | 105 | forward d_timers_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_timers/d_timers_macros.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Macros for d_timers. 10 | * 11 | * 12 | */ 13 | 14 | #define @DETUTILSTIMERS_KWORD__@%0\32; @DETUTILSTIMERS_KWORD__@ 15 | #define @DETUTILS_task%0(%1.%2type%3= @DETUTILSTIMERS_KWORD__@ 16 | 17 | #if DETUTILS_ANNOTATION__(task) 18 | #define @task%0(%1.%2type%3= @DETUTILSTIMERS_KWORD__@ 19 | #endif 20 | 21 | /* 22 | 23 | 88b d88 88 db 88888888ba 88 24 | 888b d888 "" d88b 88 "8b 88 25 | 88`8b d8'88 d8'`8b 88 ,8P 88 26 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 27 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 28 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 29 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 30 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 31 | 32 | 33 | */ 34 | 35 | #define @d_trpt_%0\32; @d_trpt_ 36 | #define @d_tint_%0\32; @d_tint_ 37 | #define @d_tmr_%0\32; @d_tmr_ 38 | #define @d_ret_%0\32; @d_ret_ 39 | 40 | #define DeferTask%0(%1,%2) \ 41 | SetTimerEx("@d_tmr_"%1,CallLocalFunction("@d_tint_"%1,""),CallLocalFunction("@d_trpt_"%1,""),%2) 42 | 43 | #define @DETUTILSTIMERS_KWORD__@AUTOMATIC%0,%3.interval%4=%5)%1(%2) \ 44 | @DETUTILSFUNCGEN$d_t_int..%2$;@DETUTILSFUNCGEN$d_t_int..%2$ return %5;\ 45 | @DETUTILSFUNCGEN$d_timerid..%2$;@DETUTILSFUNCGEN$d_timerid..%2$ 46 | 47 | #define @DETUTILSTIMERS_KWORD__@MANUAL%0,%3.interval%4=%5,%6.repeating%7=%8)%1(%2) \ 48 | @d_trpt_%1();@d_trpt_%1() return %8;@d_tint_%1();@d_tint_%1() return %5; \ 49 | @d_tmr_%1(%2);@d_tmr_%1(%2) -------------------------------------------------------------------------------- /DETUTILS/d_toml.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_TOML 1 15 | 16 | #include "d_toml\d_toml_entry" -------------------------------------------------------------------------------- /DETUTILS/d_toml/d_toml_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * a TOML file management. 11 | * 12 | * 13 | */ 14 | 15 | /* 16 | 17 | 18 | 88b d88 88 db 88888888ba 88 19 | 888b d888 "" d88b 88 "8b 88 20 | 88`8b d8'88 d8'`8b 88 ,8P 88 21 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 22 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 23 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 24 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 25 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 26 | 27 | 28 | 29 | */ 30 | 31 | stock __parsetomlline(const source[], dest[][]) 32 | { 33 | new 34 | i, 35 | start, 36 | index, 37 | len; 38 | 39 | while(i <= strlen(source)) 40 | { 41 | if(source[i] == '=' || i == strlen(source)) 42 | { 43 | len = strmid(dest[index], source, start, i, 128); 44 | dest[index][len] = 0; 45 | start = i+1; 46 | index++; 47 | } 48 | i++; 49 | } 50 | return 1; 51 | } 52 | 53 | #include "d_toml_impl" 54 | #include "d_toml_save" 55 | 56 | /* 57 | 58 | 88888888888 59 | 88 ,d 60 | 88 88 61 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 62 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 63 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 64 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 65 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 66 | 67 | 68 | */ 69 | 70 | public OnDETUtilsInit() 71 | { 72 | LoadDETUtilsScript(DETUTILS_SCRIPT_TOML); 73 | if(funcidx("d_toml_detutilsinit") != -1) 74 | { 75 | CallLocalFunction("d_toml_detutilsinit", ""); 76 | } 77 | return 1; 78 | } 79 | 80 | #if defined _ALS_OnDETUtilsInit 81 | #undef OnDETUtilsInit 82 | #else 83 | #define _ALS_OnDETUtilsInit 84 | #endif 85 | 86 | #define OnDETUtilsInit( d_toml_detutilsinit( 87 | 88 | forward d_toml_detutilsinit(); 89 | 90 | // cleanup 91 | 92 | public OnDETUtilsExit() 93 | { 94 | UnloadDETUtilsScript(DETUTILS_SCRIPT_TOML); 95 | if(funcidx("d_toml_detutilsexit") != -1) 96 | { 97 | CallLocalFunction("d_toml_detutilsexit", ""); 98 | } 99 | return 1; 100 | } 101 | 102 | #if defined _ALS_OnDETUtilsExit 103 | #undef OnDETUtilsExit 104 | #else 105 | #define _ALS_OnDETUtilsExit 106 | #endif 107 | 108 | #define OnDETUtilsExit( d_toml_detutilsexit( 109 | 110 | forward d_toml_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_vars.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_VARS 1 15 | 16 | #include "d_vars\d_vars_entry" -------------------------------------------------------------------------------- /DETUTILS/d_vars/d_vars_strret.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Extra feature for d_vars.inc 10 | * 11 | * 12 | */ 13 | 14 | #endinput 15 | 16 | // If you don't use YSI (I actually wrote these!): 17 | 18 | #if defined DETUTILS_STRRET_COMPLICATED 19 | 20 | #define YSI_STRRET_KEYWORD@%0\32; YSI_STRRET_KEYWORD@ 21 | #define __COMPILER_STRING YSI_STRRET_KEYWORD@ 22 | #define strret_%0\32; strret_ 23 | #define str_%0\32; str_ 24 | #define funcid_%0\32; funcid_ 25 | 26 | #if !defined strmid 27 | native strmid(dest[], const source[], start, end, maxlength=sizeof dest); 28 | #endif 29 | 30 | new YSI_g_StrretCache[YSI_MAX_STRING]; 31 | 32 | #define YSI_STRRET_KEYWORD@forward%0(%1) strret_%0(%1);str_%0(%1,YSI_g_StaticStrRet) 33 | #define YSI_DO_FUNCID<%0..%1> {funcid_%0=funcidx(#strret_%0);return str_%0(%1,funcid_%0);}str_%0(%1,YSI_g_StaticStrRet) 34 | #define YSI_STRRET_KEYWORD@public%0(%1) new funcid_%0;strret_%0(%1)YSI_DO_FUNCID<%0..%1> 35 | 36 | #define YSI_STRRET_KEYWORD@return%0; return strmid(YSI_g_StrretCache,%0,0,YSI_MAX_STRING); 37 | #define YSI_STRRET_KEYWORD@CallLocalFunction(%0,%1,%2)%3; CallLocalFunction(#strret_%0,%1,%2); 38 | 39 | #else 40 | 41 | // This is much easier to understand (but really bad): 42 | 43 | #define YSI_STRRET_KEYWORD@%0\32; YSI_STRRET_KEYWORD@ 44 | #define __COMPILER_STRING YSI_STRRET_KEYWORD@ 45 | 46 | new YSI_g_StrretCache[YSI_MAX_STRING]; 47 | 48 | #define YSI_STRRET_KEYWORD@return%0; return strmid(YSI_g_StrretCache,%0,0,YSI_MAX_STRING); 49 | #define YSI_STRRET_KEYWORD@get_last_return%0(%1) YSI_g_StrretCache 50 | 51 | #endif -------------------------------------------------------------------------------- /DETUTILS/d_visual.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_VISUAL 1 15 | 16 | #include "d_visual\d_visual_entry" -------------------------------------------------------------------------------- /DETUTILS/d_visual/d_visual_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides in-game visible 10 | * stuff. 11 | * 12 | * 13 | */ 14 | 15 | // Moved d_dmzone.inc here! 16 | #include "d_visual_dmzones" 17 | 18 | /* 19 | 20 | 21 | 88b d88 88 db 88888888ba 88 22 | 888b d888 "" d88b 88 "8b 88 23 | 88`8b d8'88 d8'`8b 88 ,8P 88 24 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 25 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 26 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 27 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 28 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 29 | 30 | 31 | 32 | */ 33 | 34 | #include "d_visual_impl" 35 | #include "d_visual_tdanims" 36 | 37 | /* 38 | 39 | 88888888888 40 | 88 ,d 41 | 88 88 42 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 43 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 44 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 45 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 46 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 47 | 48 | 49 | */ 50 | 51 | public OnDETUtilsInit() 52 | { 53 | SetTimer("__Weapon_timer", 1000, true); 54 | LoadDETUtilsScript(DETUTILS_SCRIPT_VISUAL); 55 | #if defined DETUTILS_DEBUG_MODE 56 | SaveLogIntoFile("detutils_visual.log", "[DETUtils]: (debug) - Loading..."); 57 | SaveLogIntoFile("detutils_visual.log", "[DETUtils]: (debug) - Loaded."); 58 | #endif 59 | if(funcidx("d_visual_detutilsinit") != -1) 60 | { 61 | CallLocalFunction("d_visual_detutilsinit", ""); 62 | } 63 | return 1; 64 | } 65 | 66 | #if defined _ALS_OnDETUtilsInit 67 | #undef OnDETUtilsInit 68 | #else 69 | #define _ALS_OnDETUtilsInit 70 | #endif 71 | 72 | #define OnDETUtilsInit( d_visual_detutilsinit( 73 | 74 | forward d_visual_detutilsinit(); 75 | 76 | // cleanup 77 | 78 | public OnDETUtilsExit() 79 | { 80 | UnloadDETUtilsScript(DETUTILS_SCRIPT_VISUAL); 81 | if(funcidx("d_visual_detutilsexit") != -1) 82 | { 83 | CallLocalFunction("d_visual_detutilsexit", ""); 84 | } 85 | return 1; 86 | } 87 | 88 | #if defined _ALS_OnDETUtilsExit 89 | #undef OnDETUtilsExit 90 | #else 91 | #define _ALS_OnDETUtilsExit 92 | #endif 93 | 94 | #define OnDETUtilsExit( d_visual_detutilsexit( 95 | 96 | forward d_visual_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_visual/d_visual_tdanims.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * textdraw animations. 11 | * 12 | * 13 | */ 14 | 15 | #define TEXTDRAW_HIDE_ANIMATION_SHRINK 0 //normal td shrinks to small size 16 | #define TEXTDRAW_HIDE_ANIMATION_EXPAND 1 //normal td expands to big size 17 | #define TEXTDRAW_SHOW_ANIMATION_SHRINK 2 //set big td shrinks to small size 18 | #define TEXTDRAW_SHOW_ANIMATION_EXPAND 3 //very small td expands to big size 19 | 20 | #define TEXTDRAW_ANIMATION_TYPE_TEXT 0 //apply animation to text 21 | #define TEXTDRAW_ANIMATION_TYPE_BOX 1 //apply animation to box 22 | 23 | enum DET__TextDrawInfo 24 | { 25 | Float:TextSize[2], 26 | Float:LetterSize[2] 27 | } 28 | 29 | new DET_g_TextDrawData[_:MAX_TEXT_DRAWS][DET__TextDrawInfo]; 30 | 31 | enum DET__PlayerTextDrawInfo 32 | { 33 | Float:TextSize[2], 34 | Float:LetterSize[2] 35 | } 36 | 37 | new DET_g_PlayerTextDrawData[_:MAX_PLAYER_TEXT_DRAWS][DET__PlayerTextDrawInfo]; 38 | 39 | // Hooks: 40 | 41 | //[GLOBAL TDS] 42 | stock DET_g_Anim_TextDrawTextSize(Text:text, Float:x, Float:y) 43 | { 44 | DET_g_TextDrawData[_:text][TextSize][0] = x; 45 | DET_g_TextDrawData[_:text][TextSize][1] = y; 46 | return TextDrawTextSize(text,x,y); 47 | } 48 | 49 | #if defined _ALS_TextDrawTextSize 50 | #undef TextDrawTextSize 51 | #else 52 | #define _ALS_TextDrawTextSize 53 | #endif 54 | 55 | #define TextDrawTextSize DET_g_Anim_TextDrawTextSize 56 | 57 | stock DET_g_Anim_TextDrawLetterSize(Text:text, Float:x, Float:y) 58 | { 59 | DET_g_TextDrawData[_:text][LetterSize][0] = x; 60 | DET_g_TextDrawData[_:text][LetterSize][1] = y; 61 | return TextDrawLetterSize(text,x,y); 62 | } 63 | 64 | #if defined _ALS_TextDrawLetterSize 65 | #undef TextDrawLetterSize 66 | #else 67 | #define _ALS_TextDrawLetterSize 68 | #endif 69 | 70 | #define TextDrawLetterSize DET_g_Anim_TextDrawLetterSize 71 | 72 | //[PLAYER TDS] 73 | stock PlayerText:DET_g_Anim_CreatePlayerTextDraw(playerid, Float:x, Float:y, text[]) 74 | { 75 | return textid; 76 | } 77 | 78 | #if defined _ALS_CreatePlayerTextDraw 79 | #undef CreatePlayerTextDraw 80 | #else 81 | #define _ALS_CreatePlayerTextDraw 82 | #endif 83 | 84 | #define CreatePlayerTextDraw DET_g_Anim_CreatePlayerTextDraw 85 | 86 | // Functions: 87 | 88 | stock ApplyTextDrawAnimation(Text:textid, animationid, animation_type) 89 | { 90 | if(animationid == TEXTDRAW_HIDE_ANIMATION_SHRINK) 91 | { 92 | return TEXTDRAW_HIDE_ANIMATION_SHRINK; 93 | } 94 | return 1; 95 | } 96 | 97 | stock ApplyPlayerTextDrawAnimation(playerid, PlayerText:playertextid, animationid, animation_type) 98 | { 99 | if(animationid == TEXTDRAW_HIDE_ANIMATION_SHRINK) 100 | { 101 | return TEXTDRAW_HIDE_ANIMATION_SHRINK; 102 | } 103 | return 1; 104 | } 105 | 106 | // Timers: 107 | 108 | forward DET_g_TDAnimationTimer(); 109 | public DET_g_TDAnimationTimer() 110 | { 111 | return 1; 112 | } -------------------------------------------------------------------------------- /DETUTILS/d_yaml.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Entry files. 10 | * 11 | * 12 | */ 13 | 14 | #define DETUTILS_LIBVER_YAML 1 15 | 16 | #include "d_yaml\d_yaml_entry" -------------------------------------------------------------------------------- /DETUTILS/d_yaml/d_yaml_entry.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * a YAML file management. 11 | * 12 | * 13 | */ 14 | 15 | /* 16 | 17 | 18 | 88b d88 88 db 88888888ba 88 19 | 888b d888 "" d88b 88 "8b 88 20 | 88`8b d8'88 d8'`8b 88 ,8P 88 21 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 22 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 23 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 24 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 25 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 26 | 27 | 28 | 29 | */ 30 | 31 | stock __parseyamlline(const source[], dest[][]) 32 | { 33 | new 34 | i, 35 | start, 36 | index, 37 | len; 38 | 39 | while(i <= strlen(source)) 40 | { 41 | if(source[i] == ':' || i == strlen(source)) 42 | { 43 | len = strmid(dest[index], source, start, i, 128); 44 | dest[index][len] = 0; 45 | start = i+1; 46 | index++; 47 | } 48 | i++; 49 | } 50 | return 1; 51 | } 52 | 53 | #include "d_yaml_impl" 54 | #include "d_yaml_save" 55 | 56 | /* 57 | 58 | 88888888888 59 | 88 ,d 60 | 88 88 61 | 88aaaaa 8b, ,d8 MM88MMM 8b,dPPYba, ,adPPYYba, ,adPPYba, 62 | 88""""" `Y8, ,8P' 88 88P' "Y8 "" `Y8 I8[ "" 63 | 88 )888( 88 88 ,adPPPPP88 `"Y8ba, 64 | 88 ,d8" "8b, 88, 88 88, ,88 aa ]8I 65 | 88888888888 8P' `Y8 "Y888 88 `"8bbdP"Y8 `"YbbdP"' 66 | 67 | 68 | */ 69 | 70 | public OnDETUtilsInit() 71 | { 72 | LoadDETUtilsScript(DETUTILS_SCRIPT_YAML); 73 | if(funcidx("d_yaml_detutilsinit") != -1) 74 | { 75 | CallLocalFunction("d_yaml_detutilsinit", ""); 76 | } 77 | return 1; 78 | } 79 | 80 | #if defined _ALS_OnDETUtilsInit 81 | #undef OnDETUtilsInit 82 | #else 83 | #define _ALS_OnDETUtilsInit 84 | #endif 85 | 86 | #define OnDETUtilsInit( d_yaml_detutilsinit( 87 | 88 | forward d_yaml_detutilsinit(); 89 | 90 | // cleanup 91 | 92 | public OnDETUtilsExit() 93 | { 94 | UnloadDETUtilsScript(DETUTILS_SCRIPT_YAML); 95 | if(funcidx("d_yaml_detutilsexit") != -1) 96 | { 97 | CallLocalFunction("d_yaml_detutilsexit", ""); 98 | } 99 | return 1; 100 | } 101 | 102 | #if defined _ALS_OnDETUtilsExit 103 | #undef OnDETUtilsExit 104 | #else 105 | #define _ALS_OnDETUtilsExit 106 | #endif 107 | 108 | #define OnDETUtilsExit( d_yaml_detutilsexit( 109 | 110 | forward d_yaml_detutilsexit(); -------------------------------------------------------------------------------- /DETUTILS/d_yaml/d_yaml_save.inc: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DETUtils 4 | * 5 | * Since 2019., DEntisT 6 | * 7 | * 8 | * 9 | * - Library which provides 10 | * a YAML file management. 11 | * 12 | * 13 | */ 14 | 15 | /* 16 | 17 | 18 | 88b d88 88 db 88888888ba 88 19 | 888b d888 "" d88b 88 "8b 88 20 | 88`8b d8'88 d8'`8b 88 ,8P 88 21 | 88 `8b d8' 88 ,adPPYYba, 88 8b,dPPYba, d8' `8b 88aaaaaa8P' 88 22 | 88 `8b d8' 88 "" `Y8 88 88P' `"8a d8YaaaaY8b 88""""""' 88 23 | 88 `8b d8' 88 ,adPPPPP88 88 88 88 d8""""""""8b 88 88 24 | 88 `888' 88 88, ,88 88 88 88 d8' `8b 88 88 25 | 88 `8' 88 `"8bbdP"Y8 88 88 88 d8' `8b 88 88 26 | 27 | 28 | 29 | */ 30 | 31 | // fwrite 32 | new yamlcontent2[4096]; 33 | stock __yamlset(const filename[], const key[], const value[]) 34 | { 35 | new newfilename[64], linestr[512]; 36 | format(newfilename, sizeof newfilename, "%s.yaml", filename); 37 | new File:file = fopen(newfilename, io_append); 38 | 39 | #if defined DETUTILS_DEBUG_MODE 40 | printf("[DETUtils]: (parse) - yaml :: %s%s", 41 | file ? "Successfully opened : " : "Failed to open : ", newfilename); 42 | 43 | #endif 44 | 45 | format(linestr, sizeof linestr, "%s:%s\r\n", key, value); 46 | fwrite(file, linestr); 47 | 48 | #if defined DETUTILS_DEBUG_MODE 49 | printf("[DETUtils]: (parse) - yaml :: Value of '%s' updated to '%s'.", key, value); 50 | #endif 51 | 52 | fclose(file); 53 | return 1; 54 | } 55 | 56 | // "set" functions 57 | stock yamlsetint(const filename[], const key[], value) 58 | { 59 | new yamlvalue[256]; 60 | format(yamlvalue, sizeof yamlvalue, "%i", value); 61 | return __yamlset(filename, key, yamlvalue); 62 | } 63 | 64 | stock yamlsetbool(const filename[], const key[], bool:value) 65 | { 66 | new yamlvalue[256]; 67 | format(yamlvalue, sizeof yamlvalue, "%s", value ? "true" : "false"); 68 | return __yamlset(filename, key, yamlvalue); 69 | } 70 | 71 | stock yamlsetfloat(const filename[], const key[], Float:value) 72 | { 73 | new yamlvalue[256]; 74 | format(yamlvalue, sizeof yamlvalue, "%f", value); 75 | return __yamlset(filename, key, yamlvalue); 76 | } 77 | 78 | stock yamlsetstr(const filename[], const key[], const value[]) 79 | { 80 | new yamlvalue[256]; 81 | format(yamlvalue, sizeof yamlvalue, "%s", value); 82 | return __yamlset(filename, key, yamlvalue); 83 | } 84 | 85 | stock yamlwritecomment(const filename[], const comment[]) 86 | { 87 | new newfilename[64]; 88 | if(!yamlexist(filename)) return 0; 89 | format(newfilename, sizeof newfilename, "%s.yaml", filename); 90 | new File:file = fopen(newfilename, io_append); 91 | #if defined DETUTILS_DEBUG_MODE 92 | printf("[DETUtils]: (comment) - yaml :: %s%s", 93 | file ? "Successfully opened : " : "Failed to open : ", newfilename); 94 | #endif 95 | new linestr[512]; 96 | if(file) 97 | { 98 | format(linestr, sizeof linestr, "# %s", comment); 99 | fwrite(file, linestr); 100 | fwrite(file, "\r\n"); 101 | __DETUtilsDebug("yaml :: Successfully wrote comment : '%s'.", comment); 102 | fclose(file); 103 | return 1; 104 | } 105 | fclose(file); 106 | return 0; 107 | } -------------------------------------------------------------------------------- /DETUTILS_TESTS.amx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bracesoftware/DETUtils-Old/81147eade9c8823457bb2e2728856b8724da8e02/DETUTILS_TESTS.amx -------------------------------------------------------------------------------- /DETUTILS_TESTS.pwn: -------------------------------------------------------------------------------- 1 | #define DETUTILS_DEV_MODE 2 | //#define DETUTILS_DEBUG_MODE 3 | //#define DETUTILS_TESTING_MODE 4 | //#define DETUTILS_NO_MODULE_WARNINGS 5 | #define DETUTILS_COMPAT 6 | //#define DETUTILS_DO_LST 7 | //#define DETUTILS_FILTERSCRIPT_MODE 8 | //#define DETUTILS_NO_DISCORDAPI 9 | #define DETUTILS_ALS_CALL_DEBUG 10 | #define DISCORD_COMMAND_PREFIX '!' 11 | #define DETUTILS_FMARGS_FUNCREPLACE 12 | #define DETUTILS_NO_DISCORDAPI 13 | 14 | #include 15 | 16 | #include "DETUTILS\detutils" 17 | 18 | main(){} 19 | -------------------------------------------------------------------------------- /ReleaseNotes.md: -------------------------------------------------------------------------------- 1 | # DETUtils 2 | Below, you can find all of the information related to the update; version, installation process, changes included within the update and more! 3 | - Version: `2.0.7` 4 | - Release: `3` 5 | 6 | ***NOTE***: This is a pre-release which means that this product version doesn't represent the final quality of the product - it may contain bugs and problems that aren't yet discovered. 7 | 8 | - Last stable version and release: `2.0.7-R2` 9 | 10 | ## What's new 11 | 12 | **`d_global.inc`** - A brand new PAWN-related library included within the DETUtils package! 13 | 14 | **`d_ascii.inc`** - A brand new PAWN-related library included within the DETUtils package! 15 | 16 | **`d_lambda.inc`** - A brand new PAWN-related library included within the DETUtils package! 17 | 18 | **`d_editobject.inc`** - A brand new SAMP-related library included within the DETUtils package! 19 | 20 | ## What's changed 21 | 22 | **`malloc`** - Now you can use `malloc` instead of `CallVariableHandler`. 23 | 24 | ## Fixed issues 25 | 26 | - No fixed issues. 27 | 28 | And of course more other tweaks, improvements and internal changes included within the update related to the following libraries: 29 | 30 | ----------------------------- 31 | 32 | `DETUTILS` archive is a copy of an original source code, which is recommended to use as the GitHub source code contains documentation and extra files you aren't supposed to use or modify - or even have on your device. 33 | 34 | ----------------------------- 35 | 36 | Simply install to your project and begin using the library with ***sampctl***: 37 | ```bat 38 | sampctl package install samp-api/DETUtils 39 | ``` 40 | ```pawn 41 | #include 42 | ``` 43 | 44 | If you aren't a ***sampctl*** user, you can still download `DETUTILS` archive which matches your operating system from below, extract it into your `includes` folder and begin using the library with: 45 | ```pawn 46 | #include 47 | ``` -------------------------------------------------------------------------------- /detutils.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bracesoftware/DETUtils-Old/81147eade9c8823457bb2e2728856b8724da8e02/detutils.png -------------------------------------------------------------------------------- /docs/d_als.md: -------------------------------------------------------------------------------- 1 | # d_als.inc 2 | Pawn ALS Hooks - Provides `@als()` decorator used to create and interact with ALS hooked functons. 3 | 4 | [Go back to the home page...](../README.md) 5 | 6 | ## How to start to use? 7 | - After including `detutils.inc`, as other libraries, `d_als` will automatically get included. Though, in order to ALS-rehook the same callback, you'll need to reinclude `d_als` ONLY (same concept as `y_hooks` though, only "difference" is that this is not automatic!). 8 | 9 | ```pawn 10 | #include "DETUTILS\detutils" 11 | 12 | public OnGameModeInit() 13 | { 14 | @als() do("OnGameModeInit", ""); 15 | return 1; 16 | } 17 | 18 | @als() function OnGameModeInit() 19 | { 20 | printf("1st hook called."); 21 | return @als() continue; 22 | } 23 | 24 | #include "DETUTILS\d_als" 25 | 26 | @als() function OnGameModeInit() 27 | { 28 | printf("Hook 2 called!"); 29 | return @als() break; 30 | } 31 | ``` 32 | ## Facts and tips 33 | ### Looping 34 | - Since this is an actually hook loop, there are `@als() continue` (or just `1`) and `@als() break` (or just `0`) return values. If you return `@als() continue`, the loop through ALS functions will continue, but if you return `@als() break` the looping through ALS functions will stop. 35 | 36 | ```pawn 37 | @als() function OnGameModeInit() 38 | { 39 | printf("This will break the loop!"); 40 | return @als() break; 41 | } 42 | ``` 43 | ### Hooking fact 44 | - You can literally hook anything you want! As you can see, all you need to do such are `als do` and `als function`. 45 | - Hooking **y_timers** timers: 46 | 47 | ```pawn 48 | task SuperCoolTask[1000]() 49 | { 50 | @als() do("MyTaskName", ""); 51 | return 1; 52 | } 53 | 54 | @als() function MyTaskName() 55 | { 56 | print("MyTaskName called!"); 57 | return @als() continue; 58 | } 59 | ``` 60 | ### `hook` keyword 61 | - Instead of using `@als() function`, you can simply use `hook`. Which means this will work too: 62 | 63 | ```pawn 64 | task SuperCoolTask[1000]() 65 | { 66 | @als() do("MyTaskName", ""); 67 | return 1; 68 | } 69 | 70 | hook MyTaskName() 71 | { 72 | print("MyTaskName called!"); 73 | return @als() continue; 74 | } 75 | ``` 76 | - If you wish to, for any reason, you can disable this keyword simply by using: 77 | 78 | ```pawn 79 | #define DETUTILS_NO_HOOK_KEYWORD 80 | ``` 81 | ## Messages from creator 82 | ### Notes 83 | - No notes. 84 | ### Warnings 85 | - No warnings! 86 | -------------------------------------------------------------------------------- /docs/d_ascii.md: -------------------------------------------------------------------------------- 1 | # d_ascii.inc 2 | Pawn ASCII - ASCII character predefines. 3 | 4 | [Go back to the home page...](../README.md) 5 | 6 | ## How to start to use? 7 | 8 | ```pawn 9 | print("Character : %i", CHARACTER_); 10 | ``` 11 | 12 | ## API 13 | 14 | ### `GetCharacterType` 15 | 16 | ```pawn 17 | native GetCharacterType(charid); 18 | ``` 19 | 20 | - If the character ID is in range of 0 to 31, the character is a `CHARACTER_TYPE_CONTROL`, if the character ID is in range of 32 to 127 - the character is a printable character, or `CHARACTER_TYPE_PRINTABLE`, or if the character ID is in range of 128 to 255 - the character is a `CHARACTER_TYPE_EXTENDED`, otherwise, function will return `CHARACTER_TYPE_UNKNOWN` or simply `-1`. -------------------------------------------------------------------------------- /docs/d_cmdparsing.md: -------------------------------------------------------------------------------- 1 | # Parsing in ``d_commands`` 2 | 3 | [Go back to ``d_commands`` docs](d_commands.md) 4 | 5 | - As I mentioned, parsing is analysing functions. 6 | 7 | - In order to provide ``d_commands``' users an easier experience while tracking down bugs, I added new parsing feature to the include - which was VERY hard to make. Took me few days, by the way. What I was talking about is ``code-parse.inc`` include written by Y_Less. 8 | 9 | - ``code-parse`` provides tons of useful macros used to analyse script functions. That is also done in ``d_commands``. 10 | 11 | # Features 12 | 13 | ## Scripting 14 | 15 | - There is no change in the macro looks. But internally looked at them, there is a another ton of macros hidden in the includes. 16 | 17 | ## Parser effects 18 | 19 | - Now we came to the point, as I said already - few times, parsing is analysing functions, this can be anything related to the functions, but we're talking about the argument counting. Which means, every command's arguments are counted at compile-time and stored in the server cache during run-time, allowing the processor to check for VALID command headers and invalid ones - we're looking for those. 20 | 21 | - So, in every example code I declared the command like this: 22 | ```pawn 23 | @command(.type = SLASH_COMMAND) COMMAND_NAME(playerid, params[]) 24 | { 25 | SendClientMessage(playerid, -1, "Cool message."); 26 | // Or some other cool code. 27 | return 1; 28 | } 29 | ``` 30 | As you can see, I only provide **playerid** and **params[]**, one integer argument and one array argument - in total 2 arguments. And that is the only one correct way, though you can name ``playerid`` and ``params[]`` different, something like ``player`` and ``parameters`` or whatever alike - you only need to make sure first parameter is the integer and the second one is an array. 31 | 32 | - Though, adding more arguments to the header can cause problems such as unexpected crashing and unknown bugs. That's why I added this. 33 | 34 | So - whenever you declare a command like this; 35 | ```pawn 36 | @command(.type = SLASH_COMMAND) COMMAND_NAME(playerid, params[], &data, Float:coord, _:somethingelse) 37 | { 38 | return 1; 39 | } 40 | ``` 41 | ... or: 42 | ```pawn 43 | @command(.type = SLASH_COMMAND) COMMAND_NAME(playerid) 44 | { 45 | return 1; 46 | } 47 | ``` 48 | ... or even this: 49 | ```pawn 50 | @command(.type = SLASH_COMMAND) COMMAND_NAME() 51 | { 52 | return 1; 53 | } 54 | ``` 55 | ... and try to execute it in-game; you'll get an error in console saying this: 56 | 57 | ``` 58 | *** [samp-detutils]: (cmd parse) - Calling parse function: 'P@_cmd' 59 | *** [samp-detutils]: (cmd parse) - Parsing a command : cmd with 3 params. 60 | *** [samp-detutils]: (cmd parse) - Met an unexpected or unknown argument in 61 | the command header while parsing. 62 | Command: cmd 63 | Make sure that your command header looks like this: 64 | @command(...) CMD_NAME__(playerid, params[]) {...} 65 | ``` 66 | 67 | In order to try this; I made the following command (read the comments): 68 | ```pawn 69 | @command(.type = SLASH_COMMAND) cmd(playerid, params[], help) // Added `help` in order to test parsing. 70 | { 71 | // There is no code since it won't get executed anyways, 72 | // since the parser function for the command will stop the processor 73 | // from processing the command, aka this code. 74 | 75 | return 1; // this code 76 | } 77 | ``` 78 | ## Visual effects 79 | - Visual effects of this feature is simple to explain; if the command header is invalid (contains extra or less parameters) - command won't be processed as it is unknown, or rather invalid. 80 | -------------------------------------------------------------------------------- /docs/d_core.md: -------------------------------------------------------------------------------- 1 | ### Internal (`d_core`) libraries 2 | 3 | - The folder containing all the libraries used by the DETUtils system itself. 4 | 5 | [Go back to the home page...](../README.md) 6 | 7 | | Library | Description | 8 | | -------------------- | ------------------------------------------------------------------------------------------ | 9 | | d_core_errors.inc | The internal library other DETUtils libraries use to log runtime errors that occured unexpectedly. | 10 | | d_core_compilefix.inc | Using DETUtils sometimes requires extra compiler options, those are enabled in there. | 11 | | d_core_funcgen.inc | Used to generate function names for `d_als`, `d_timers` and `d_testing`! | 12 | | d_core_init.inc | Used for library initialisation. | 13 | | d_core_funcs.inc | Contains functions used all throughout the DETUtils package and the core itself. | 14 | | d_core_mainfix.inc | Provides a little fix where `main` function is not getting called in filterscripts! | 15 | | d_core_text.inc | In this file, all of strings used in the libraries are defined. | 16 | | d_core_thirdpartyinclude.inc | Using DETUtils requires some extra libraries, this include is here to manage that! | 17 | | d_core_version.inc | Little include used to change library's version, including major release, minor release, patch and `R` marked release (re-release of the same version). There are also built-in constant values named `__DETUtils` which is a hex version number, and `__DETUtilsRelease` which is hex release number. | 18 | | [d_core_rem.inc](d_rem.md) | Provides the `@rem` decorator and rem levels: `IMPORTANT`, `NOTE`, `HACK` and `BUG`. | 19 | | [d_core_memory.inc](d_memory.md) | This is strictly an internal DETUtils library, which is used to modify the internal memory values to manipulate the includes. For example: `@detmemory UNUSED_RACE_INDEX 0` the last unused race index will be set to `0` which may cause lot of problems if you do it yourself. | 20 | | d_core_entry.inc | The whole DETUtils entry point. Without it, the package wouldn't work as nothing would be included. | 21 | | [d_core_debug.inc](d_debug.md) | Provides advanced debugging with precise information, error and warning location. | 22 | -------------------------------------------------------------------------------- /docs/d_debug.md: -------------------------------------------------------------------------------- 1 | # d_core_debug.inc 2 | DETUtils Debug - Provides advanced debugging with precise information, error and warning location. 3 | 4 | [Go back to the home page...](d_core.md) 5 | 6 | ```pawn 7 | __DETUtilsDebug("Debug.",); // Works only with DETUTILS_DEBUG_MODE enabled. 8 | 9 | // `,);` is required for formatting, and `__file` and `__line`. 10 | 11 | __DETUtilsWarning("Warning.",); 12 | __DETUtilsError("Error.",); 13 | __DETUtilsInfo("Info.",); 14 | ``` 15 | 16 | - You can format your message. 17 | 18 | ```pawn 19 | __DETUtilsDebug("Debug: %i.",var); 20 | __DETUtilsWarning("Warning %i.",var); 21 | __DETUtilsError("Error %i.",var); 22 | __DETUtilsInfo("Info %i.",var); 23 | ``` -------------------------------------------------------------------------------- /docs/d_dialog.md: -------------------------------------------------------------------------------- 1 | # d_dialog.inc 2 | SA:MP Dialogs - Create dialogs using `@dialog` decorator and show them to players. A replacement `ShowPlayerDialog` and `OnDialogResponse` containing even more callbacks and functions to manipulate dialogs. 3 | 4 | [Go back to the home page...](../README.md) 5 | 6 | ## How to start to use? 7 | - Start by declaring a dialog. 8 | 9 | ```pawn 10 | @dialog( .type = MESSAGE_BOX, .args = {"", "Hi", "Hello!", "OK", "NO"} ) HiDialog(playerid); 11 | ``` 12 | 13 | - Show the dialog to a player. 14 | 15 | ```pawn 16 | @command(.type = SLASH_COMMAND) dialogtest(playerid, params[]) 17 | { 18 | ShowDialogForPlayer(playerid, "HiDialog"); 19 | return 1; 20 | } 21 | ``` 22 | ### `.args` 23 | Dialog arguments, they go like this: 24 | 25 | - `event` - event which gets called when a player responds to dialog. 26 | - `title` - title of a dialog box. 27 | - `message` - a message, a list or a tablist, depends on a `.type`. 28 | - `response1` - "`false`" response 29 | - `response2` - "`true`" response 30 | 31 | ## API 32 | ### Dialog types 33 | --------------------------------- 34 | - Dialog styles are now dialog types. 35 | 36 | ```pawn 37 | @dialog( .type = MESSAGE_BOX, .args = {"", "Hi", "Hello!", "OK", "NO"} ) HiDialog(playerid); 38 | ``` 39 | So, instead of just `MESSAGE_BOX`, you can use following types: 40 | 41 | - `MESSAGE_BOX` for `DIALOG_STYLE_MSGBOX` 42 | - `INPUT_BOX` for `DIALOG_STYLE_INPUT` 43 | - `LIST` for `DIALOG_STYLE_LIST` 44 | - `PASSWORD_INPUT` for `DIALOG_STYLE_PASSWORD` 45 | - `TABLIST` for `DIALOG_STYLE_TABLIST` 46 | - `TABLIST_HEADERS` for `DIALOG_STYLE_TABLIST_HEADERS` 47 | 48 | ### Dialog functions 49 | --------------------------------- 50 | ### `public` OnPlayerDialogReceived 51 | - Called when a player receives the certain dialog. 52 | 53 | ```pawn 54 | public OnPlayerDialogReceived(playerid, dialog[]) 55 | { 56 | SendClientMessage(playerid, -1, "You received dialog '%s'", dialog); 57 | return 1; 58 | } 59 | ``` 60 | ### `public` OnPlayerDialogHide 61 | - You can hide a dialog, when you do that, this callback gets called. 62 | 63 | ```pawn 64 | public OnPlayerDialogHide(playerid, dialog[]) 65 | { 66 | SendClientMessage(playerid, -1, "'%s' hidden.", dialog); 67 | return 1; 68 | } 69 | ``` 70 | ### `public` OnPlayerDialogResponse 71 | - This is simply a replacement for `OnDialogResponse`. 72 | 73 | ```pawn 74 | public OnPlayerDialogResponse(playerid, dialog[], response, listitem, inputtext[]) 75 | { 76 | SendClientMessage(playerid, -1, 77 | "You responded to dialog '%s', response: %i, listitem: %i, inputtext: %i", 78 | dialog, response, listitem, inputtext); 79 | return 1; 80 | } 81 | ``` 82 | ### `ShowDialogForPlayer` 83 | - Show a dialog for player. 84 | 85 | ### `GetDialogStyle` 86 | - Get a style (type) of a dialog. Returns `-1` if the dialog does not exist. Returns values such as `DIALOG_STYLE_MSGBOX`. 87 | 88 | ```pawn 89 | new style = GetDialogStyle("HiDialog"); 90 | ``` 91 | ### `HideDialogForPlayer` 92 | - Hide a shown dialog. 93 | 94 | ```pawn 95 | HideDialogForPlayer(playerid); 96 | ``` 97 | 98 | ### `GetPlayerDialog` 99 | - Get player's shown dialog. If there is no dialog shown, function will return `0`. Returns a name of a dialog. 100 | 101 | ```pawn 102 | GetPlayerDialog(playerid); 103 | ``` 104 | ### Dialog events 105 | --------------------------------------- 106 | - Read more [here](d_events.md). 107 | ## Messages from creator 108 | ### Warnings 109 | ### Notes 110 | -------------------------------------------------------------------------------- /docs/d_discordapi.md: -------------------------------------------------------------------------------- 1 | # d_discordapi.inc 2 | Discord API - A DETUtils package module containing a set of libraries whose extend the possibilities of the Discord Connector plugin for SA:MP. 3 | 4 | [Go back to the home page...](../README.md) 5 | 6 | ## How to start to use? 7 | Read documentation for the each `d_discordapi` library. 8 | 9 | 10 | | Library | Description | 11 | | -------------------- | ------------------------------------------------------------------------------------------ | 12 | | [d_discordapi_commands.inc](d_discordapi_commands.md) | Text-based and slash commands made easy. | 13 | | [d_discordapi_data.inc](d_discordapi_data.md) | Functions whose allow you to save Discord entity data. | 14 | -------------------------------------------------------------------------------- /docs/d_discordapi_commands.md: -------------------------------------------------------------------------------- 1 | # d_discordapi_commands.inc 2 | Discord Commands - A library which provides creation of Discord text and slash commands. 3 | 4 | [Go back to home page...](d_discordapi.md) 5 | 6 | ## How to start to use? 7 | ### Commands 8 | ```pawn 9 | @command(.type = DISCORD_COMMAND) dctest(DCC_Guild:guild, DCC_Channel:channel, DCC_Message:message, DCC_User:author, params) 10 | { 11 | DCC_SendChannelMessage(channel, "this fucking works"); 12 | return 1; 13 | } 14 | ``` 15 | - This creates a basic text command. 16 | 17 | - Coming soon as the Discord Connector plugin gets an update. 18 | -------------------------------------------------------------------------------- /docs/d_discordapi_data.md: -------------------------------------------------------------------------------- 1 | # d_discordapi_data.inc 2 | Discord Data - A library which provides guild, channel, user and application data management. 3 | 4 | [Go back to home page...](d_discordapi.md) 5 | 6 | ## How to start to use? 7 | 8 | - This library provides the `@discord` decorator. The example of the decorator usage to set and get data is shown below. 9 | 10 | - Set the data using; 11 | ```pawn 12 | @discord(.entity = ENTITY) SetData(DCC_:entity_lowercase_name, data_address[], DataTypeTag:value); 13 | ``` 14 | - ... and get the data using: 15 | ```pawn 16 | @discord(.entity = ENTITY) GetData(DCC_:entity_lowercase_name, data_address[], DataTypeTag:dest); 17 | ``` 18 | 19 | So, let's do a slight parameter explanation: 20 | 21 | 1. `ENTITY` is a kind of an 'object' you're assigning the data to, for example you can assign data to the following entities: `GUILD`, `CHANNEL` and `USER`. 22 | 2. `` is the type of the data you are assigning to the certain entity, it can be: `Integer`, `Boolean`, `Float` and `String`. 23 | 3. `` is a Discord Connector variable tag. In these cases, it can be: `Guild`, `Channel`, `User`. 24 | 4. `entity_lowercase_name` is a name of your variable. 25 | 5. `data_address` is the name of the data you're assigning. 26 | 6. `DataTypeTag` is a Pawn data type tag, it can be: `_:` (nothing) for integers, `bool:` for booleans, `Float:` for floats and `_:` (nothing) for strings - since strings are just arrays - literal strings of integers. 27 | 7. `value` is the value you're assigning. 28 | 8. `dest` is another variable you'll assign the returned data to. 29 | 30 | ## Examples 31 | 32 | - Saving the data. 33 | ```pawn 34 | new DCC_Guild:my_server = ...; 35 | new members = 0; 36 | @discord(.entity = GUILD) GetIntegerData(my_server, "members", members); 37 | @discord(.entity = GUILD) SetIntegerData(my_server, "members", members + 1); 38 | ``` 39 | 40 | - Getting the data. 41 | ```pawn 42 | new DCC_Guild:my_server = ...; 43 | new members = 0; 44 | @discord(.entity = GUILD) GetIntegerData(my_server, "members", members); 45 | // Now you can use `members`. 46 | ``` 47 | -------------------------------------------------------------------------------- /docs/d_dmzone.md: -------------------------------------------------------------------------------- 1 | # d_visual_dmzones.inc 2 | SA:MP DeathMatch Zones - Provides the creation of deathmatch zones, adding and removing players from deathmatch zones. 3 | 4 | [Go back to home page...](README.md) 5 | ## How to start to use? 6 | - Start by creating a deathmatch zone. 7 | 8 | ```pawn 9 | public OnGameModeInit() 10 | { 11 | // Function. // Zone name. // First spawn coord set. // Second spawn coord set. // Third spawn coord set. 12 | CreateDeathMatchZone("Insane DeathMatch", 844.7139,-1614.3539,13.5391, 825.6589,-1614.8202,13.5469, 811.1299,-1616.0647,13.5469); 13 | return 1; 14 | } 15 | ``` 16 | ## API 17 | ### `public` OnDeathMatchZoneCreate 18 | - Called whenever a deathmatch zone is created. 19 | 20 | ```pawn 21 | public OnDeathMatchZoneCreate(zoneid, zonename[]) 22 | { 23 | printf("DM Zone `%s`[%i] created!", zonename, zoneid); 24 | return 1; 25 | } 26 | ``` 27 | ### `public` OnDeathMatchZoneDestroy 28 | - Called whenever a deathmatch zone is destroyed. 29 | 30 | ```pawn 31 | public OnDeathMatchZoneDestroy(zoneid, zonename[]) 32 | { 33 | printf("DM Zone `%s`[%i] destroyed!", zonename, zoneid); 34 | return 1; 35 | } 36 | ``` 37 | ### `CreateDeathMatchZone` 38 | - Create a deathmatch zone. 39 | 40 | ### `GetPlayerDeathMatchZoneKills` 41 | - Gets a number of kills player reached. Note that the function will return the value ONLY if the player is in the deathmatch zone. If not, it will return `-1`. 42 | 43 | ### `IsPlayerInDeathMatchZone` 44 | - Check if the player in the deathmatch zone or not. 45 | 46 | ### `DestroyDeathMatchZone` 47 | - Destroy a deathmatch zone. 48 | 49 | ### `IsValidDeathMatchZone` 50 | - Check if the deathmatch zone is valid. 51 | 52 | ### `GetDeathMatchZoneIDByName` 53 | - Get the deathmatch zone's ID by its name. 54 | 55 | ### `GetDeathMatchZoneName` 56 | - Get the name of a certain deathmatch zone. 57 | 58 | ### `AddPlayerToDeathMatchZone` 59 | - Add the player to certain deathmatch zone with a specific weapon set level. 60 | 61 | ```pawn 62 | @command(.type = SLASH_COMMAND) dmjoin(playerid, params[]) 63 | { 64 | AddPlayerToDeathMatchZone(playerid, "Insane DeathMatch", 1, 10); 65 | return 1; 66 | } 67 | ``` 68 | - Function parameters: 69 | ```pawn 70 | native AddPlayerToDeathMatchZone(playerid, const name[], spawnid, kitlevel); 71 | ``` 72 | Parameter explanation: 73 | - `playerid` - the player. 74 | - `name[]` - name of the deathmatch zone. 75 | - `spawnid` - the spawn coordinates set to set player's position on. 76 | - `kitlevel` - weapon kit level. 77 | 78 | #### Weapon kit levels 79 | - There are 10 weapon kit levels - higher kit: better weapons. 80 | 81 | #### Level 1 82 | - Desert Eagle - 200 ammo 83 | - Shotgun - 100 ammo 84 | 85 | #### Level 2 86 | - + MP5 - 400 ammo 87 | 88 | #### Level 3 89 | - + AK47 - 400 ammo 90 | 91 | #### Level 4 92 | - Instead of AK47: + M4 - 400 ammo 93 | 94 | #### Level 5 95 | - Same as level 3 with 50 more ammo for a Shotgun. 96 | 97 | #### Level 6 98 | - Same as level 4. 99 | 100 | #### Level 7 101 | - Same as level 4, but with max skills for M4. 102 | 103 | #### Level 8 104 | - Instead of MP5, new weapon - UZI. 105 | - + Max skills for UZI. 106 | - + 400 ammo for UZI. 107 | 108 | #### Level 9 109 | - Same as level 8. 110 | - Instead of UZI, new weapon - Tec9. 111 | 112 | #### Level 10 113 | - Instead of Shotgun, new weapon - Sawnoff Shotgun. 114 | - + Max skills for Sawnoff Shotgun. 115 | - Instead of Tec9, new weapon - UZI. 116 | 117 | **NOTE:** I didn't have that much ideas for weapon kit levels, contributions and changes are welcome. 118 | 119 | ### `RemovePlayerFromDeathMatchZone` 120 | - Remove the player from deathmatch zone. 121 | 122 | ```pawn 123 | @command(.type = SLASH_COMMAND) dmleave(playerid, params[]) 124 | { 125 | RemovePlayerFromDeathMatchZone(playerid); 126 | return 1; 127 | } 128 | ``` 129 | ## Messages from creator 130 | ### Warnings 131 | ### Notes 132 | -------------------------------------------------------------------------------- /docs/d_editobject.md: -------------------------------------------------------------------------------- 1 | # d_editobject.inc 2 | SA:MP Object Edit - New `EditObject()`/`EditPlayerObject()` system with many more features. 3 | 4 | [Go back to the home page...](../README.md) 5 | 6 | ## How to start to use? 7 | - `d_editobject.inc` currently supports only global and player objects. Support for attached objects will be made soon. 8 | 9 | - To start editing an object, use `PlayerEditObject`: 10 | 11 | ```pawn 12 | PlayerEditObject(playerid, objectid); 13 | ``` 14 | 15 | - This will show the player an object editing menu. After the player confirms or cancels an edit, or simply moves the object, callback `OnPlayerEditGlobalObject` with many parameters. 16 | 17 | ```pawn 18 | public OnPlayerEditGlobalObject(playerid, objectid, response, 19 | Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) 20 | { 21 | return 1; 22 | } 23 | ``` 24 | 25 | - If player was editing a player object, `OnPlayerEditPlayerObject` instead. 26 | 27 | ### Editing response 28 | 29 | - Whenever the player interacts with editing menu, `OnPlayerEditObject` will be called, with an certain response ID - there are 3 response IDs: 30 | 31 | 1. `EDITING_RESPONSE_CANCEL` - Player has canceled the changes he has done to the object. Object will be automatically reset to the starting positions. 32 | 2. `EDITING_RESPONSE_FINAL` - Object position has been saved and applied. Editing menu will disappear. 33 | 3. `EDITING_RESPONSE_UPDATE` - Object's position has changed. 34 | 35 | ### Update rate 36 | 37 | - Update rate is a rate object's position and rotation are changing at whenever player moves the object. Player can change his update rate by interacting with the editing menu, or you can change it using `SetPlayerEditUpdateRate`. Default update rate is `0.1`. 38 | 39 | ``` 40 | SetPlayerEditUpdateRate(playerid, 1.90); 41 | ``` 42 | 43 | -------------------------------------------------------------------------------- /docs/d_events.md: -------------------------------------------------------------------------------- 1 | # d_events.inc 2 | Pawn Events - A replacement for `CallFunction` and `forward`/`public` which gives you more possibilities and automations, such as local and global functions (on file level), command events, property events and dialog events (extensions of DETUtils API itself). 3 | 4 | [Go back to the home page](../README.md) 5 | 6 | ## How to start to use? 7 | 8 | - Now using `@event` you can create local and global events on a file level. The difference between local and global events is similar to static and global variables and functions! Local event usage is limited to only **one** file. You declare it like this: 9 | 10 | ### Local Events 11 | 12 | ```pawn 13 | // file1.pwn 14 | @event(.type = LOCAL) LocalEvent() 15 | { 16 | print("Debug"); 17 | return 1; 18 | } 19 | ``` 20 | 21 | - This event can now be used only in `file1.pwn`. You can use it by calling it using `CallEvent`. 22 | 23 | ```pawn 24 | // file1.pwn 25 | CallEvent("LocalEvent" , ""); 26 | ``` 27 | 28 | - After you start the compiled script, you should see this in the console: 29 | 30 | ``` 31 | Debug 32 | ``` 33 | 34 | - But if you try to do this: 35 | 36 | ```pawn 37 | // It was previously used only in file1.pwn 38 | // file2.pwn 39 | CallEvent("LocalEvent" , ""); 40 | ``` 41 | 42 | - Your code will get compiled, but you won't see any messages in the console which is not the case with global events. 43 | 44 | ### Global Events 45 | 46 | ```pawn 47 | // file1.pwn 48 | @event(.type = GLOBAL) GlobalEvent() 49 | { 50 | print("Debug2"); 51 | return 1; 52 | } 53 | ``` 54 | 55 | - This is a global event, and its usage isn't limited to a single file. 56 | 57 | ```pawn 58 | CallEvent("GlobalEvent", ""); 59 | ``` 60 | - Using this in any file will work and will print the `Debug2` messages in the console. 61 | 62 | ## API 63 | 64 | ### `CallEvent` 65 | 66 | - This is a macrofunction which, obviously, calls an event. Note that this is a MACRO, and thus the first argument is NOT a string but just a part of macro definition. Which means that this will not work: 67 | 68 | ```pawn 69 | new funcname[32]; 70 | format(funcname, sizeof funcname, "somename"); 71 | CallEvent(funcname, "", ...); 72 | ``` 73 | 74 | ## Extended API 75 | - `d_events` extends the functionality of `d_dialog`, `d_properties` and `d_commands.` 76 | 77 | ### Dialog events 78 | 79 | ```pawn 80 | @dialog(.type = MESSAGE_BOX, .args = {"HiEvent", "Hi", "Hello!", "OK", "NO"}) HiDialog(playerid); 81 | 82 | @event(.type = DIALOG_EVENT) HiEvent(playerid, response, listitem, inputtext[]) 83 | { 84 | SendClientMessage(playerid, -1, "Hi again from HiEvent!"); 85 | return 1; 86 | } 87 | ``` 88 | 89 | - Whenever the player responds to a `d_dialog` dialog, he will receive a message saying `Hi again from HiEvent!`. 90 | 91 | ### Property events 92 | 93 | ```pawn 94 | public Func() 95 | { 96 | CreatePropertyEntrance("24/7 Market", 811.1299,-1616.0647,13.5469, 0, 0, true, INTERIOR_MARKET_247_1, .event = "PropertyEvent"); 97 | return 1; 98 | } 99 | 100 | @event(.type = PROPERTY_EVENT) PropertyEvent(playerid, propertyid, actionid) 101 | { 102 | SendClientMessage(playerid, -1, "PropertyEvent works!"); 103 | return 1; 104 | } 105 | ``` 106 | 107 | - Whenever the player leaves or enters a property, he will receive a message saying `PropertyEvent works!`. 108 | 109 | ### Command events 110 | 111 | - These aren't functional yet. 112 | -------------------------------------------------------------------------------- /docs/d_extra.md: -------------------------------------------------------------------------------- 1 | # Extra stuff 2 | - After including any of DET Utils includes, those includes also import some extra stuff to your code as well. That *extra* stuff can be anything, functions, callbacks and more. 3 | 4 | [Go back to home page...](README.md) 5 | 6 | ## Handy features 7 | - Read information about each feature below. 8 | ### **String functions** 9 | #### strtok 10 | - **SA:MP DET-Utils** provides few new functions which are *extensions* to standard Pawn and SA:MP libraries. 11 | 12 | - *strtok* function is one of them, example: 13 | 14 | ```pawn 15 | decl Command:mycmd(playerid, params[]) 16 | { 17 | new param[128], idx, num; 18 | param = strtok(params, idx); 19 | if(strlen(param) == 0) return SendClientMessage(playerid, -1, "Usage: /mycmd "); 20 | num = strval(param); 21 | if(num == 1) 22 | { 23 | return SendClientMessage(playerid, -1, "This works!"); 24 | } 25 | return 1; 26 | } 27 | ``` 28 | #### strrest 29 | - Almost same as *strtok*. 30 | 31 | ```php 32 | public OnPlayerCommandText(playerid, cmdtext[]) 33 | { 34 | new cmd[256+1]; 35 | new message[256+1]; 36 | new tmp[256+1]; 37 | new idx; 38 | 39 | cmd = strtok(cmdtext, idx); 40 | 41 | // Action commands 42 | if(!strcmp("/me", cmd, true)) 43 | { 44 | message = strrest(cmdtext,idx); 45 | if(!strlen(message)) { 46 | CmdUsageMessage(playerid, "/me [action]"); 47 | return 1; 48 | } 49 | ProcessActionText(playerid, message, ACTION_ME); 50 | return 1; 51 | } 52 | return 0 53 | } 54 | ``` 55 | **NOTE**: This code is the code from *gl_chat.pwn* originally written by SA-MP team. 56 | -------------------------------------------------------------------------------- /docs/d_fmargs.md: -------------------------------------------------------------------------------- 1 | # d_fmargs.inc 2 | 3 | Pawn FuncArgs - Using `d_fmargs` you can easily use specifiers in string-like type arguments of various SA:MP functions. 4 | 5 | [Go back to home page...](README.md) 6 | 7 | ## How to start to use? 8 | 9 | - Usage is really basic. 10 | 11 | Example: 12 | 13 | ```pawn 14 | 15 | public OnPlayerSpawn(playerid) 16 | { 17 | SendClientMessage(playerid, -1, "You are spawned, %s.", ReturnPlayerName(playerid)); 18 | return 1; 19 | } 20 | ``` 21 | **TIP**: Function *ReturnPlayerName* is provided by extra library include *d_libtags.inc*. 22 | 23 | ## API 24 | 25 | Functions whose will work like this after including `detutils` are: 26 | 27 | | SA:MP functions | Description | 28 | | -------------------- | ------------------------------------------------------------------------------------------ | 29 | SendClientMessage | Sends a message to certain client. | 30 | SendClientMessageToAll | Sends a message to all players (clients). | 31 | GameTextForPlayer | Shows a GameText to certain player. | 32 | GameTextForAll | Shows a GameText to all players. | 33 | TextDrawCreate | Creates a global TextDraw. | 34 | CreatePlayerTextDraw | Creates a player TextDraw. | 35 | TextDrawSetString | Changes global TextDraw's string. | 36 | PlayerTextDrawSetString| Changes player TextDraw's string. | 37 | SendRconCommand | Sends a RCON command to a server. | 38 | Update3DTextLabelText | Updates the 3D text label text. | 39 | UpdatePlayer3DTextLabelText | Updates the player 3D text label text. | 40 | 41 | ## `sscanf` 42 | - This include also provides a Pawn implementation of `sscanf` functions. Below, you can see an example on how to use these features: 43 | 44 | ```pawn 45 | @command(.type = SLASH_COMMAND) sscanftest(playerid, params[]) 46 | { 47 | new id, array[2][3]; 48 | 49 | if(sscanf do(params, array, 2) == SSCANF_FAIL) // If sscanf fails (no spaces in a string) 50 | { 51 | return SendClientMessage(playerid, -1, "Sscanf failed."); 52 | } 53 | 54 | SendClientMessage(playerid, -1, "Sscanf succedeed."); 55 | 56 | return 1; 57 | } 58 | ``` 59 | 60 | - You can disable these optional `sscanf` features using: 61 | 62 | ```pawn 63 | #define DETUTILS_NO_SSCANF 64 | ``` 65 | Argument explanation: 66 | ```pawn 67 | sscanf do(source, address, args = 1); 68 | ``` 69 | - `source` is a source string to get data from. 70 | - `address` is an 2D array to assign data to. 71 | - `args` is a count of given arguments in a string. 72 | 73 | ## `DETUTILS_FMARGS_FUNCREPLACE` 74 | - This is a compile-time option which tells DETUtils to hook the **fmargs** functions or not. This is really important to note because it limits the function input only to one line, which means this is impossible to do: 75 | 76 | ```pawn 77 | SendClientMessage( 78 | playerid, 79 | -1, 80 | "Message.") 81 | ; 82 | ``` 83 | - `DETUTILS_FMARGS_FUNCREPLACE` is enabled using: 84 | ```pawn 85 | #define DETUTILS_FMARGS_FUNCREPLACE 86 | ``` 87 | - In case you don't want it, you can still use `d_fmargs` by adding `fmargs_` prefix before using the function: 88 | ```pawn 89 | fmargs_SendClientMessage(playerid, -1, "Format %i!", somearg); 90 | ``` 91 | - Meanwhile, the standard `SendClientMessage` will work just fine without any changes. 92 | ### Note 93 | - You'll still be able to use `fmargs`-prefixed functions even with `DETUTILS_FMARGS_FUNCREPLACE` enabled. 94 | -------------------------------------------------------------------------------- /docs/d_foreach.md: -------------------------------------------------------------------------------- 1 | # d_foreach.inc 2 | Pawn `foreach` - Provides `foreach` and `iterator` keywords to interact with this data structure and loop through iterators. 3 | 4 | [Go back to home page...](README.md) 5 | ## How to start to use? 6 | - Start using the library by creating a simple iterator. 7 | 8 | ```pawn 9 | iterator new MyIterator<10>; 10 | ``` 11 | - You can use `iter` shortcut too 12 | 13 | ```pawn 14 | iter new MyIterator<10>; 15 | ``` 16 | - Before using an iterator, make sure to initialize it: 17 | 18 | ```pawn 19 | iterator init(MyIterator); 20 | ``` 21 | - After the iterator initialization, it's ready for a proper use - let's continue. 22 | 23 | ```pawn 24 | iterator add(MyIterator, 1); 25 | ``` 26 | - We added a value `1` to a iterator. So, when we do this: 27 | 28 | ```pawn 29 | foreach do(new i : MyIterator) 30 | { 31 | printf("%i", i); 32 | } 33 | ``` 34 | - The output will be: 35 | 36 | ``` 37 | 1 38 | ``` 39 | - To remove a value, use `iterator remove`: 40 | 41 | ```pawn 42 | iterator remove(MyIterator, 1); 43 | ``` 44 | ## Explanation 45 | ### Declaration 46 | - So let's firstly explain how `iterator new` works, so: 47 | ```pawn 48 | iterator new MyIterator<10>; 49 | ``` 50 | - This will declare an iterator, actually this is a macro, so in fact iterators are just arrays. This will code will generate into this: 51 | ```pawn 52 | enum IteratorData 53 | { 54 | returnvalues[SIZE] 55 | }; 56 | new IteratorIndex; 57 | new Iterator[IteratorData]; 58 | ``` 59 | - `IteratorData` is an enumerator holding the information about the iterator, `IteratorIndex` is an index of `returnvalues` updated after `iterator add` is used. 60 | ### Initialization 61 | ```pawn 62 | iterator init(MyIterator); 63 | ``` 64 | - This is REALLY important part, this actually prepares the iterator for it's iteration. If you don't initialize the iterator, your console will be full of zeros if you try to this: 65 | ```pawn 66 | foreach do(new i : MyIterator) 67 | { 68 | printf("%i", i); 69 | } 70 | ``` 71 | ### Add and remove values 72 | ```pawn 73 | iterator add(MyIterator, 1); 74 | ``` 75 | ```pawn 76 | iterator remove(MyIterator, 1); 77 | ``` 78 | - These two are literally the point of this library - add and remove the iteration values. The good thing is that you can add any value to the iterator, because the number between `<` and `>` represents the number of slots. The slot number is actually the size of the iterator, but regardless its size any value can be added. So, this code is completely valid even if the size is for example only `10`: 79 | 80 | ```pawn 81 | iterator add(MyIterator, 2437); 82 | ``` 83 | - Let's explain what `iterator add` does, it just adds the provided number to an index of `returnvalues` in `IteratorData`, that index is already mentioned `IteratorIndex` which is updated itself after the each iterator update. Removing the value is simple - almost the same process, just reversed. 84 | ## Facts 85 | ### Same value multiple times 86 | - This one is completely possible and valid, but to remove the twice-applied value, you'll need to logically think - just remove the value twice. So if you did this: 87 | 88 | ```pawn 89 | iterator add(MyIterator, 1); 90 | iterator add(MyIterator, 1); 91 | ``` 92 | - To remove `1` completely, just remove it twice: 93 | 94 | ```pawn 95 | iterator remove(MyIterator, 1); 96 | iterator remove(MyIterator, 1); 97 | ``` 98 | - This is possible since `iterator (add/remove)` highly rely on the standard `for` loop. 99 | 100 | ### Iterator cleanup 101 | - If you want to do an iterator cleanup for any reason, just re-initialize it using `iterator init`. 102 | ## Messages from creator 103 | ### Notes 104 | - No notes yet. 105 | ### Warnings 106 | - No warnings yet. 107 | -------------------------------------------------------------------------------- /docs/d_global.md: -------------------------------------------------------------------------------- 1 | # d_global.inc 2 | Pawn Global - A library which makes expressions possible on the global level - or in simple terms, code outside other functions. 3 | 4 | [Go back to the home page...](../README.md) 5 | 6 | ## How to start to use? 7 | 8 | ```pawn 9 | #include 10 | 11 | new str[32]; 12 | global format(str, sizeof str, "str formatted."); 13 | ``` 14 | 15 | - You can literally put any function or expression next to `global` and it'll get called before `main()`. 16 | 17 | ```pawn 18 | global SendClientMessageToAll(-1, "Hi"); // pointless, but it'll work. 19 | ``` 20 | 21 | - Another example: 22 | 23 | ```pawn 24 | #include 25 | 26 | new var; 27 | global var = 1; 28 | ``` 29 | 30 | ## Notes 31 | - Please note that you need to reinclude `d_global.inc` before using `global` again. 32 | 33 | ```pawn 34 | new str[32], str2[32]; 35 | global format(str, sizeof str, "str formatted."); 36 | 37 | #include // Include again. 38 | global format(str2, sizeof str2, "str2 formatted."); 39 | ``` 40 | 41 | - If you don't want to, don't worry. You can simply download `amx_assembly` includes and put them into your includes folder, and you'll now be able to do: 42 | 43 | ```pawn 44 | new test_str[32]; 45 | global test1() format(test_str, sizeof test_str, "Hmm nice test"); 46 | new test_str2[32]; 47 | global test2() format(test_str2, sizeof test_str2, "Hmm nice test2"); 48 | ``` 49 | 50 | - In `global NAME__() do;`, `NAME__` can be anything you want it to be. This is also valid: 51 | 52 | ```pawn 53 | new test_str[32]; 54 | global omg() format(test_str, sizeof test_str, "Hmm nice test"); 55 | new test_str2[32]; 56 | global lol() format(test_str2, sizeof test_str2, "Hmm nice test2"); 57 | ``` 58 | 59 | ## API 60 | 61 | ### `CallGlobalProcedure` * 62 | 63 | - This function can be used only if you've installed AMX assembly into your includes folder. Basically, you just use it to recall the global procedure you've made before. 64 | 65 | ```pawn 66 | new test_str[32]; 67 | global Test() format(test_str, sizeof test_str, "Hmm nice test"); 68 | 69 | public OnGameModeInit() 70 | { 71 | // Modify test_str. 72 | format(test_str, sizeof test_str, "OnGameModeInit called!"); 73 | print(test_str); 74 | 75 | // Reset test_str back to default. 76 | CallGlobalProcedure("Test"); 77 | return 1; 78 | } 79 | ``` -------------------------------------------------------------------------------- /docs/d_installation.md: -------------------------------------------------------------------------------- 1 | # Library installation 2 | 3 | [Go back to home page...](README.md) 4 | 5 | ## With *sampctl* 6 | Simply install to your project and begin using the library: 7 | 8 | ```bat 9 | sampctl package install samp-api/DETUtils 10 | ``` 11 | 12 | ## Manual installation 13 | Download all files from the last branch and extract them to your *pawno\includes* folder. 14 | -------------------------------------------------------------------------------- /docs/d_lambda.md: -------------------------------------------------------------------------------- 1 | # d_lambda.inc 2 | Pawn Lambda - Provides short functions whose can be used in expressions. Or in other words lambda functions. 3 | 4 | ## How to start to use? 5 | 6 | - The most common example is just calling the function: 7 | 8 | ### `lambda using` 9 | 10 | ```pawn 11 | new 12 | Lambda:Func = { 13 | return print("My Func works!"); 14 | } 15 | 16 | main() 17 | { 18 | lambda using = {"Func"}; 19 | } 20 | ``` 21 | 22 | - Where `lambda using` is a lambda function, and `Lambda:Func` is a lambda procedure. `lambda using` will just call a lambda procedure once. Output: 23 | 24 | ``` 25 | My Func works! 26 | ``` 27 | 28 | ### `lambda for` 29 | 30 | - `lambda for` will call the procedure several times. 31 | 32 | ```pawn 33 | new Lambda:TestLambda = { 34 | print("Lambda test passed!"); 35 | return 1; 36 | } 37 | 38 | main() 39 | { 40 | print("sussylambda : %i", lambda for = {"TestLambda", 10}); 41 | } 42 | ``` 43 | 44 | This way you'll use `print("Lambda test passed!")` ten times as a function argument. So the code above is equivalent to the code below: 45 | 46 | ```pawn 47 | TestLambda() 48 | { 49 | for(new i; i < 10; i++) 50 | { 51 | print("Lambda test passed"); 52 | } 53 | return 1; 54 | } 55 | 56 | main() 57 | { 58 | print("sussylambda : %i", TestLambda()); 59 | } 60 | ``` 61 | 62 | - Output: 63 | 64 | ``` 65 | Lambda test passed! 66 | Lambda test passed! 67 | Lambda test passed! 68 | Lambda test passed! 69 | Lambda test passed! 70 | Lambda test passed! 71 | Lambda test passed! 72 | Lambda test passed! 73 | Lambda test passed! 74 | Lambda test passed! 75 | ``` 76 | 77 | ### `lambda while` 78 | 79 | - `lambda while` will call the procedure while a certain condition or expression is true. 80 | 81 | ```pawn 82 | new 83 | bool:MyCondition = true, 84 | Lambda:TestLambda2 = { 85 | MyCondition = false; 86 | print("TestLambda2 called!"); 87 | return 1; 88 | } 89 | 90 | main() 91 | { 92 | lambda while = {"TestLambda2", MyCondition}; 93 | } 94 | ``` 95 | 96 | - Output: 97 | 98 | ``` 99 | TestLambda2 called! 100 | ``` 101 | 102 | ### `lambda task` 103 | 104 | ```pawn 105 | new 106 | Lambda:Timer = { 107 | return print("Lambda Timer works."); 108 | } 109 | 110 | main() 111 | { 112 | lambda task = {"Timer", 1000, true}; 113 | } 114 | ``` 115 | 116 | - This will create a repeating task (timer) which will get called every 1 second. To kill this timer, use `KillTimer`. 117 | 118 | ```pawn 119 | new 120 | timer; 121 | 122 | main() 123 | { 124 | timer = (lambda task = {"Timer", 1000, true}); 125 | } 126 | 127 | // Somewhere in the code: 128 | KillTimer(timer); 129 | ``` -------------------------------------------------------------------------------- /docs/d_limits.md: -------------------------------------------------------------------------------- 1 | # SA:MP - DETUtils | Library limits 2 | 3 | - Here, you can learn more about library limits. Below, you can see a list of DETUtils includes and learn more about limits built into them. 4 | 5 | [Go back to home page...](README.md) 6 | 7 | # Updates 8 | 9 | - In upcoming updates, some limits may be reduced or eventually removed. But, due to existing SA:MP limits, that is not possible in bright future. 10 | 11 | Check [open.mp official resources site](https://open.mp/docs/scripting/resources/limits) for more information about SA:MP limits! 12 | 13 | # ``detutils.inc`` includes 14 | Check all limits below: 15 | 16 | ## d_commands.inc 17 | 18 | ### Maximum function name 19 | Include code: 20 | ```pawn 21 | #if !defined MAX_FUNC_NAME 22 | 23 | #define MAX_FUNC_NAME (32) 24 | 25 | #endif 26 | ``` 27 | - This limits the number of characters in function name, if the number of characters in a certain function's name is larger than **32**, then you will get an error. This is also a Pawn limit, which explains why I've added this definition to my script as well. 28 | ### Maximum prefix length 29 | Include code: 30 | ```pawn 31 | #define MAX_PREFIX_LENGTH 1 32 | ``` 33 | - Unfortunately, prefix can only contain 1 character. 34 | 35 | ## d_filequeries.inc 36 | 37 | ### Maximum number of file queries 38 | Include code: 39 | ```pawn 40 | #if !defined MAX_FILE_QUERIES 41 | 42 | #define MAX_FILE_QUERIES 1000 43 | 44 | #endif 45 | ``` 46 | - This limits the number of file queries that can be created. That's why I recomment to DELETE the player file queries when player disconnects. 47 | 48 | ## d_properties.inc 49 | 50 | ### Maximum number of created properties 51 | Include code: 52 | ```pawn 53 | #if !defined MAX_PROPERTIES 54 | 55 | #define MAX_PROPERTIES 300 56 | 57 | #endif 58 | ``` 59 | - This limits the maximum number of custom properties that can be created, if you attempt to create a property with ID 301, function will return **0** - also if you have **DETUTILS_DEBUG_MODE** enabled, server will get an ingame warning which tells everyone on the server that maximum number of created properties has been reached. 60 | 61 | ## d_visual.inc 62 | 63 | ### Maximum number of created dropped guns 64 | Include code: 65 | ```pawn 66 | #if !defined MAX_DROPPED_GUNS 67 | 68 | #define MAX_DROPPED_GUNS 2000 69 | 70 | #endif 71 | ``` 72 | 73 | - This limits the maximum number of created dropped gun objects. If you attempt to create a dropped gun with an ID 2001, function will return **0** - also if you have **DETUTILS_DEBUG_MODE** enabled, server will get an ingame warning which tells everyone on the server that maximum number of created dropped gun objects has been reached. 74 | 75 | ### Maximum number of DM zones 76 | Include code: 77 | ```pawn 78 | #define MAX_DM_ZONES 1000 79 | ``` 80 | - This limits the number of DM zones that can be created. 81 | 82 | 83 | ## d_mapeditor.inc 84 | ### Maximum objects 85 | Include code: 86 | ```pawn 87 | #define MAX_OBJECTS 1000 88 | ``` 89 | 90 | - This limits the maximum number of created objects on the server. This is also a SA:MP limit. 91 | 92 | ## d_faction.inc 93 | ### Maximum factions 94 | Include code: 95 | ```pawn 96 | #define MAX_FACTIONS 256 97 | ``` 98 | 99 | - This limits the maximum number of created factions on the server. 100 | -------------------------------------------------------------------------------- /docs/d_mapeditor.md: -------------------------------------------------------------------------------- 1 | # d_mapeditor.inc 2 | 3 | SA:MP Map Editor - Edit San Andreas yourself in the game. 4 | 5 | [Go back to the home page...](../README.md) 6 | 7 | ## How to start to use? 8 | 9 | - Look at examples below. 10 | 11 | ## API (programming interface) 12 | 13 | - There are only few functions though. But really important for the system to work, also are really efficient in commands. 14 | ### `ShowMapEditorMenuToPlayer` 15 | - Shows player a dialog with map editor options. 16 | ```pawn 17 | @command(.type = SLASH_COMMAND) mapeditor(playerid, params[]) 18 | { 19 | ShowMapEditorMenuToPlayer(playerid); 20 | return 1; 21 | } 22 | ``` 23 | ### `ShowObjectInfoLabels` 24 | - Used to show everyone on the server, in the specified virtual world, object info labels. They contain info about object's ID, object's rotation offset and object's **x, y and z** coordinates! 25 | ```pawn 26 | @command(.type = SLASH_COMMAND) labelon(playerid, params[]) 27 | { 28 | ShowObjectInfoLabels(GetPlayerVirtualWorld(playerid)); 29 | return 1; 30 | } 31 | ``` 32 | ### `HideObjectInfoLabels` 33 | - Used to hide object info labels. 34 | ```pawn 35 | @command(.type = SLASH_COMMAND) labeloff(playerid, params[]) 36 | { 37 | HideObjectInfoLabels(); 38 | return 1; 39 | } 40 | ``` 41 | 42 | ## Messages from creator 43 | 44 | ### Warnings 45 | - No warnings yet. 46 | ### Notes 47 | #### Beta version 48 | - This is in beta stage, please, if you find any issues - report them. 49 | 50 | #### Object saving and loading 51 | - In order to save your work properly, in your server's **scriptfiles** folder, you need to make another folder called **detutils_objects**. In that folder, *-.ini* files with object information and data are saved. Besides that note, you don't need to worry about anything else - objects are automatically loaded and saved. 52 | -------------------------------------------------------------------------------- /docs/d_memory.md: -------------------------------------------------------------------------------- 1 | # d_memory.inc 2 | DETUtils Memory - An internal library used to modify and announce the modification of DETUtils memory itself. 3 | 4 | [Go back to the home page...](d_core.md) 5 | 6 | ```pawn 7 | @detmemory , 8 | ``` 9 | 10 | ## Usage 11 | ```pawn 12 | @detmemory UNUSED_RACE_INDEX, 0 13 | ``` 14 | -------------------------------------------------------------------------------- /docs/d_permissions.md: -------------------------------------------------------------------------------- 1 | # d_permissions.inc 2 | 3 | SA:MP Permissions - Control your players with new permissions, now with *d_permissions.inc* you can control who can send a message, use a command or even move! 4 | 5 | [Go back to the home page](../README.md) 6 | 7 | ## How to start to use? 8 | 9 | - All of the player permissions are off by default. To give the player certain permissions to do certain things, you need to use `SetPlayerPermissionInteger`. 10 | 11 | ## List of permissions 12 | These are currently available permissions: 13 | 14 | | Permission | Description | 15 | |--------------------------------------|------------------------------------| 16 | | `DEFAULT_PLAYER_PERMISSIONS` | The default SA:MP player permissions! | 17 | | `PLAYER_PERMISSION_SENDMESSAGES` | Toggles the player's ability to send messages in the chat. | 18 | | `PLAYER_PERMISSION_USECOMMANDS` | Toggles the player's ability to use all of the server commands! | 19 | | `PLAYER_PERMISSION_USEDIALOGS` | Toggles the player's ability to respond to dialogs. | 20 | | `PLAYER_PERMISSION_USEVEHICLES` | Toggles the player's ability to enter vehicles. | 21 | | `PLAYER_PERMISSION_BUNNYHOP` | Toggles the player's ability to press `KEY_JUMP` and `KEY_SPRINT` at the same time. | 22 | | `PLAYER_PERMISSION_CBUG` | Toggles the player's ability to exploit the C-bug! (Note that this permission isn't included within `DEFAULT_PLAYER_PERMISSIONS` as we don't want players to exploit bugs.) | 23 | | `PLAYER_PERMISSION_USEWEAPONS` | Toggles the player's ability to use weapons - if the player attempts to have a weapon without a permission, all of his weapons will get resetted. | 24 | 25 | ## API 26 | ### `SetPlayerPermissionInteger` 27 | - You can change player's permission anytime using the following function! 28 | 29 | ```pawn 30 | SetPlayerPermissionInteger(playerid, PLAYER_PERMISSION_SENDMESSAGES | PLAYER_PERMISSION_USECOMMANDS); 31 | ``` 32 | 33 | **NOTE:** Make sure to use bitwise operators instead of `+`. 34 | 35 | ### `OnPlayerInsufficientPermissions` 36 | - If the player attempts to do something, without a certain permission to do so, you can let him know using the callback below. 37 | 38 | ```pawn 39 | public OnPlayerInsufficientPermissions(playerid, missingpermission) 40 | { 41 | if(missingpermission == PLAYER_PERMISSION_USECOMMANDS) 42 | { 43 | SendClientMessage(playerid, 0xFFFFFFFF, "You aren't allowed to use commands!"); 44 | } 45 | if(missingpermission == PLAYER_PERMISSION_SENDMESSAGES) 46 | { 47 | SendClientMessage(playerid, 0xFFFFFFFF, "You aren't allowed to send messages!"); 48 | } 49 | if(missingpermission == PLAYER_PERMISSION_USEDIALOGS) 50 | { 51 | SendClientMessage(playerid, 0xFFFFFFFF, "You aren't allowed to respond to dialogs!"); 52 | } 53 | return 1; 54 | } 55 | ``` 56 | 57 | ### `OnPlayerPermissionIntegerChange` 58 | - To let the staff know when player permissions change, you can use the following callback: 59 | 60 | ```pawn 61 | public OnPlayerPermissionIntegerChange(playerid, oldpermissions, newpermissions) 62 | { 63 | printf("Player : %i, oldperms : %i, newperms : %i", 64 | playerid, 65 | oldpermissions, 66 | newpermissions); 67 | return 1; 68 | } 69 | ``` 70 | -------------------------------------------------------------------------------- /docs/d_profile.md: -------------------------------------------------------------------------------- 1 | # d_profile.inc 2 | Pawn Profiling - A library which is which is providing the code profiling macros. Profile chunks of code and see how much does it take to execute it. 3 | 4 | [Go back to the home page...](../README.md) 5 | 6 | ## How to start to use? 7 | 8 | - Profiling is a basic process, simply getting how much time it takes to execute a part of certain code. But although it is a simple process, it is hard to get accurate results, because the time it takes to execute the code depends on various factors. 9 | 10 | - This is how to make a profiler function, in which you will put code you want to execute: 11 | ```pawn 12 | @profile(.format = {""}) Callback() 13 | { 14 | print("some code to get profiled."); 15 | @profile(.value = 1) return; 16 | } 17 | ``` 18 | 19 | - Let's do an explanation of the stuff above. `@profile(.format = {""}) Callback()` declares a profiling public function, and `@profile(.value = 1) return` ends the profiling process (ends the profiling timer). 20 | 21 | - Though, this is not automatic, so you'll need to run the profiler manually using: 22 | 23 | ```pawn 24 | CallProfiler("Callback", "i", arg); 25 | ``` 26 | 27 | - After the profiler is called, you should get the following message in the console: 28 | 29 | ``` 30 | [DETUtils]: (profiling) - Code 'Callback' took 27 ticks to execute. 31 | ``` 32 | 33 | - Obviously, the ticks the code takes to execute depends on the code you profile. 34 | -------------------------------------------------------------------------------- /docs/d_rem.md: -------------------------------------------------------------------------------- 1 | # d_rem.inc 2 | Pawn REM - Comments. 3 | 4 | [Go back to the home page...](d_core.md) 5 | 6 | ## How to use? 7 | ```pawn 8 | stock Func(args, ...) 9 | { 10 | return ...; 11 | } 12 | @rem(.level = BUG) : "This code above may cause bugs!"; 13 | 14 | #define DISABLE_OPTION 3 15 | 16 | @rem(.level = NOTE) : "This code will only work if it is placed before the include import."; 17 | 18 | forward public Func(...) return 1; 19 | 20 | @rem(.level = HACK) : "This is incredibly nice thing!"; 21 | 22 | $some_macro<>=#DATA; 23 | 24 | @rem(.level = IMPORTANT) : "This is some retarded macro! Don't reuse it!"; 25 | ``` 26 | - You can use it like this: 27 | 28 | ```pawn 29 | als function OnGameModeInit(@rem(.level = BUG) : "cool";) 30 | { 31 | printf("This works! LOL"); 32 | return als break; 33 | } 34 | ``` 35 | - Or even as a return or inside a function: 36 | 37 | ```pawn 38 | stock cool() 39 | { 40 | @rem(.level = NOTE) : "note"; 41 | code; 42 | return @rem(.level = IMPORTANT) : "really cool";; 43 | } 44 | ``` 45 | - Anywhere! 46 | 47 | ```pawn 48 | #define SUPER_COOL_DEFINE @rem(.level = BUG) : "cool"; 49 | ``` 50 | -------------------------------------------------------------------------------- /docs/d_server.md: -------------------------------------------------------------------------------- 1 | # d_server.inc 2 | SA:MP Server - Generally server-related functions in one library. 3 | 4 | [Go back to the home page...](../README.md) 5 | ## API 6 | ### `ArePlayerPedAnimsUsed` 7 | - Checks if the player ped anims used in the server. 8 | ```pawn 9 | if(ArePlayerPedAnimsUsed()) printf("Player ped anims are used."); 10 | ``` 11 | ### public `OnPlayerClientCheckReceived` 12 | ```pawn 13 | public OnPlayerClientCheckReceived(playerid, type, memaddr, memoffset, bytecount) 14 | { 15 | printf("Client check on player id %i started.", playerid); 16 | return 1; 17 | } 18 | ``` 19 | - This callback is called whenever a client check on a certain player starts to perform. 20 | 21 | ### `IsPlayerUsingPCClient` 22 | - Checks if the player is using a standard PC client. 23 | 24 | ### `IsPlayerUsingAndroidClient` 25 | - Checks if the player is using an Android client. 26 | 27 | ### `GetPlayerClient` 28 | - Returns a player client ID. 29 | 30 | ```c 31 | #define PLAYER_CLIENT_UNKNOWN -1 32 | #define PLAYER_CLIENT_ANDROID 0 33 | #define PLAYER_CLIENT_PC 1 34 | ``` 35 | ### public `OnPlayerClientCheckPerformed` 36 | - Called after the client check was performed. 37 | ```pawn 38 | public OnPlayerClientCheckPerformed(playerid, actionid, memaddr, retndata) 39 | { 40 | if(IsPlayerUsingAndroidClient(playerid)) 41 | { 42 | SendClientMessage(playerid, -1, "You are using an Android client!"); 43 | } 44 | if(IsPlayerUsingPCClient(playerid)) 45 | { 46 | SendClientMessage(playerid, -1, "You are using a PC client!"); 47 | } 48 | return 1; 49 | } 50 | ``` 51 | 52 | ## Notes 53 | - You can disable Android check features by using: 54 | 55 | ```pawn 56 | #define DETUTILS_NO_ANDROID_CHECK 57 | ``` 58 | -------------------------------------------------------------------------------- /docs/d_tables.md: -------------------------------------------------------------------------------- 1 | # d_tables.inc 2 | Pawn Tables - Excel-like column, row and cell management system. 3 | 4 | [Go back to the home page...](../README.md) 5 | 6 | ## How to start to use? 7 | 8 | - The usage of this library is really simple. Firstly, let's use a `tablecreate` function to initialize the table! 9 | 10 | ```pawn 11 | tablecreate("accounts", 10, 2); 12 | ``` 13 | 14 | - Now we didn't really create the table, we just initialized it - or in other words, loaded it. So, we initialized the table `accounts` which currently has 10 previewable columns and 2 previewable rows. Note that the column and row IDs start from `0`! You could do `setcellvalue` even before initializing the table - but the data would not appear on the table preview. Now, let's set the cell values, use the `setcellvalue` function for that. Do the following: 15 | 16 | ```pawn 17 | setcellvalue("accounts", 4, 0, "4c0r"); 18 | setcellvalue("accounts", 4, 1, "4c1r"); 19 | ``` 20 | 21 | - In first line, we set a cell value `4c0r` for a cell located in column 4 and row 0, and in the second line - we set a cell value `4c1r` for a cell located in column 4 and row 1. After we set the values, we can display the table. Use `previewtable` function now! 22 | 23 | ```pawn 24 | previewtable("accounts"); 25 | ``` 26 | 27 | - Make sure your code looks like this: 28 | 29 | ```pawn 30 | tablecreate("accounts", 10, 2); 31 | 32 | setcellvalue("accounts", 4, 0, "4c0r"); 33 | setcellvalue("accounts", 4, 1, "4c1r"); 34 | 35 | previewtable("accounts"); 36 | ``` 37 | 38 | - After we execute the script, the output should be the following text: 39 | 40 | ``` 41 | [18:15:27] ============================================= 42 | [18:15:27] 43 | [18:15:27] 44 | [18:15:27] TABLE PREVIEW | Previewing: accounts 45 | [18:15:27] 46 | [18:15:27] 47 | [18:15:27] ROW: 0 | (empty) | (empty) | (empty) | (empty) | 4c0r | (empty) | (empty) | (empty) | (empty) | (empty) | 48 | [18:15:27] ROW: 1 | (empty) | (empty) | (empty) | (empty) | 4c1r | (empty) | (empty) | (empty) | (empty) | (empty) | 49 | [18:15:27] 50 | [18:15:27] 51 | [18:15:27] ============================================= 52 | ``` 53 | 54 | - Note that you don't really need to use the initialization function unless you want to preview your table like this. You can set the values for cells without initializing. 55 | 56 | ### Getting values 57 | - Use the `getcellvalue` function. 58 | 59 | ```pawn 60 | getcellvalue(table[], column, row); 61 | ``` 62 | -------------------------------------------------------------------------------- /docs/d_testing.md: -------------------------------------------------------------------------------- 1 | # d_testing.inc 2 | Pawn Testing - Provides a fast and an easy way of code testing. 3 | 4 | [Go back to the home page...](../README.md) 5 | 6 | ## How to start to use? 7 | ```pawn 8 | @testing(.subject = SCRIPT_TESTING) d_testing_test() 9 | { 10 | DETUtilsAssert(1 == 1, "1 is 1", "1 is not 1"); 11 | return 1; 12 | } 13 | ``` 14 | Output: 15 | ``` 16 | [19:51:49] [Info] |======================================| 17 | [19:51:49] [Info] 18 | [19:51:49] [Info] DETUtils 19 | [19:51:49] [Info] Tests are staring... 20 | [19:51:49] [Info] 21 | [19:51:49] [Info] |======================================| 22 | [19:51:49] [Info] 23 | [19:51:49] [Info] 24 | [19:51:49] [Info] 25 | [19:51:49] [Info] *** [DETUtils]: (testing) - init :: Testing a module: d_testing.inc [3] 26 | [19:51:49] [Info] 27 | [19:51:49] [Info] *** [DETUtils]: (testing) - assert :: Assertion successful : 1 is 1 28 | [19:51:49] [Info] 29 | [19:51:49] [Info] 30 | [19:51:49] [Info] 31 | [19:51:49] [Info] |======================================| 32 | [19:51:49] [Info] 33 | [19:51:49] [Info] DETUtils 34 | [19:51:49] [Info] All tests performed successfully! 35 | [19:51:49] [Info] 36 | [19:51:49] [Info] |======================================| 37 | ``` 38 | - `d_testing` is mostly used in DETUtils itself, but you can still use it by changing the subject to `CUSTOM`: 39 | 40 | ```pawn 41 | @testing(.subject = CUSTOM) CustomTest() 42 | { 43 | DETUtilsAssert(1 == 1, "1 is 1", "1 is not 1"); 44 | return 1; 45 | } 46 | ``` 47 | Output: 48 | ``` 49 | [19:51:49] [Info] |======================================| 50 | [19:51:49] [Info] 51 | [19:51:49] [Info] DETUtils 52 | [19:51:49] [Info] Tests are staring... 53 | [19:51:49] [Info] 54 | [19:51:49] [Info] |======================================| 55 | [19:51:49] [Info] 56 | [19:51:49] [Info] 57 | [19:51:49] [Info] 58 | [19:51:49] [Info] *** [DETUtils]: (testing) - init :: Performing an user test... [3] 59 | [19:51:49] [Info] 60 | [19:51:49] [Info] *** [DETUtils]: (testing) - assert :: Assertion successful : 1 is 1 61 | [19:51:49] [Info] 62 | [19:51:49] [Info] 63 | [19:51:49] [Info] 64 | [19:51:49] [Info] |======================================| 65 | [19:51:49] [Info] 66 | [19:51:49] [Info] DETUtils 67 | [19:51:49] [Info] All tests performed successfully! 68 | [19:51:49] [Info] 69 | [19:51:49] [Info] |======================================| 70 | ``` 71 | -------------------------------------------------------------------------------- /docs/d_testlog.md: -------------------------------------------------------------------------------- 1 | # Information about the program 2 | 3 | - Below you can see a library test log. Since this is an open-sourced library, I've decided to make this test log thing so I can log my progress and that progress is now available to everyone. 4 | 5 | **NOTE:** This version of the library is a BETA version and is really unstable. 6 | 7 | **WARNING:** I started test logging program on **13 Jan 2022**. 8 | 9 | [Go back to the home page...](../README.md) 10 | 11 | # Library test log 12 | ---------------------------------------- 13 | ## Test no. 1 - 13 Jan 2022 14 | 15 | - Tested by: DEntisT-ofc 16 | - Version: 1.5.2 17 | 18 | ### Anti-cheat issues 19 | 1. System is really unstable. 20 | 2. System sends fake cheating reports with cheat types: **CHEAT_TYPE_HEALTH**, **CHEAT_TYPE_ARMOUR** and **CHEAT_TYPE_SKINCHANGER**. 21 | 22 | ### Visual game issues 23 | 1. ``FadePlayerScreen(...);`` is not working. 24 | 2. ``FadePlayerScreen(...);`` still calls ``OnPlayerScreenFade(...);`` callback, although that did not happen. 25 | ---------------------------------------- 26 | 27 | ## Test no. 1 - 18 Jan 2022 28 | 29 | - Tested by: DEntisT-ofc 30 | - Version: 1.5.5 31 | 32 | ### Anti-cheat issues 33 | 1. System still sends fake cheating reports with cheat type **CHEAT_TYPE_HEALTH**. 34 | 35 | ### Visual game issues 36 | 1. ``FadePlayerScreen(...);`` is not working. 37 | 2. ``FadePlayerScreen(...);`` still calls ``OnPlayerScreenFade(...);`` callback, although that did not happen. 38 | 39 | ### Custom prefixed command processor issues 40 | 1. Custom prefixed commands aren't working as before for some reason. Any prefix provided will still call the command. 41 | ---------------------------------------- 42 | ## Test no. 1 - 20 Jan 2022 43 | 44 | - Tested by: DEntisT-ofc 45 | - Version: 1.5.6 46 | 47 | ### Anti-cheat issues 48 | 1. System is more stable than before but it still has problems and bugs. 49 | 2. System sends fake cheating reports with cheat type **CHEAT_TYPE_HEALTH**. 50 | 51 | ### Visual game issues 52 | 1. ``FadePlayerScreen(...);`` is not working. 53 | 2. ``FadePlayerScreen(...);`` still calls ``OnPlayerScreenFade(...);`` callback, although that did not happen. 54 | 55 | ### Fixes 56 | - Fixed the issue with custom prefixed commands processor. 57 | ---------------------------------------- 58 | ## Test no. 1 - 24 Jan 2022 59 | 60 | - Tested by: DEntisT-ofc 61 | - Version: 1.5.8 62 | 63 | ### Fixes 64 | 65 | - Everything at a glance! Besides the ``FadePlayerScreen(...)`` TextDraw is not showing, fixing it soon. 66 | 67 | ---------------------------------------- 68 | ## Test no. 1 - 22 Feb 2022 69 | 70 | - Tested by: DEntisT-ofc 71 | - Version: 2.0.2-R5 72 | 73 | ## Anti-cheat issues 74 | 75 | - Health and armour anti-cheat is not working correctly. 76 | 77 | ### Fixes 78 | 79 | - Everything at a glance! 80 | 81 | ---------------------------------------- 82 | ## Test no. 1 - 9 Sep 2022 83 | 84 | - Tested by: DEntisT 85 | - Version: 2.0.7-R1-pre 86 | 87 | ## Anti-cheat issues 88 | 89 | - Health and armour anti-cheat is not working correctly. 90 | 91 | ## Server crashes 92 | 93 | - Unexpected and unknown crashes are occuring. They weren't a thing a week ago. 94 | 95 | ### Fixes 96 | 97 | - Everything at a glance! 98 | 99 | ---------------------------------------- 100 | ## Test no. 2 - 9 Sep 2022 101 | 102 | - Tested by: DEntisT 103 | - Version: 2.0.7-R1-pre 104 | 105 | ## Anti-cheat issues 106 | 107 | - Health and armour anti-cheat is not working correctly. 108 | 109 | 110 | ### Fixes 111 | 112 | - Everything at a glance! 113 | - Previously mentioned crashes are fixed. 114 | 115 | ---------------------------------------- 116 | ## Test no. 1 - 27 Sep 2022 117 | 118 | - Tested by: DEntisT 119 | - Version: 2.0.7-R3 120 | 121 | ## Anti-cheat issues 122 | 123 | - Health and armour anti-cheat is not working correctly. 124 | 125 | 126 | ## `d_vars.inc` problems 127 | 128 | - The server is spewing out stack-underflow, invalid memory access and heap-underflow run-time errors. It resulted in increasing the limits so the memory can be allocated correctly, but I, sadly, could not fix the issue. 129 | 130 | ### Fixes 131 | 132 | - Fixes are currently being worked on. 133 | 134 | ---------------------------------------- -------------------------------------------------------------------------------- /docs/d_testscript.md: -------------------------------------------------------------------------------- 1 | # Testing code 2 | 3 | [Go back to the home page...](../README.md) 4 | 5 | You can check `d_testing_internal` and `DETUTILS_TESTS.pwn`. -------------------------------------------------------------------------------- /docs/d_timers.md: -------------------------------------------------------------------------------- 1 | # d_timers.inc 2 | Pawn Timers - A library which provides automatic and manual repeatable timers or **tasks** in this case. In other words, a replacement for `SetTimer(Ex)`. 3 | 4 | [Go back to the home page...](../README.md) 5 | 6 | ## How to start to use? 7 | 8 | - This library provides an usage of a `@task` decorator, with which you can create either automatic or manual timers. Examples of declaring both types of timers are below. 9 | 10 | ### Automatic timers 11 | 12 | ```pawn 13 | @task(.type = AUTOMATIC, .interval = 1000) AutomaticTimer() 14 | { 15 | print("Automatic timer works."); 16 | return 1; 17 | } 18 | ``` 19 | 20 | - This timer will run itself when the code loads (it's deferred inside `OnDETUtilsInit`), so every 1 second - a message `"Automatic timer works."` in console will appear. 21 | 22 | ### Manual timers 23 | 24 | ```pawn 25 | @task(.type = MANUAL, .interval = 1000, .repeating = true) ManualTimer() 26 | { 27 | print("Manual timer works."); 28 | return 1; 29 | } 30 | ``` 31 | 32 | - The example above is a manual timer, it needs to be triggered using a `DeferTask` macrofunction. Example of the function usage is below: 33 | 34 | ```pawn 35 | @als() function OnGameModeInit() 36 | { 37 | DeferTask("ManualTimer", ""); 38 | return @als() break; 39 | } 40 | ``` 41 | 42 | - Now every 1 second, the console message `"Manual timer works."` will appear. 43 | 44 | ## FAQ 45 | - Frequently asked questions. 46 | 47 | ### Killing a manual timer 48 | - Well, now you may ask - how to kill this timer. The answer is easy, the same way you did it before. 49 | 50 | ```pawn 51 | new task = DeferTask("taskname", ""); 52 | KillTimer(task); 53 | ``` 54 | 55 | ### Killing an automatic one 56 | - This is impossible for now. 57 | -------------------------------------------------------------------------------- /docs/d_vars.md: -------------------------------------------------------------------------------- 1 | # d_vars.inc 2 | Pawn Variables - A library which reserves up space for new variables you can dynamically allocate during run-time, which is really similar to `malloc` but can handle up to hundreds of variables, stacks and arrays of different types. 3 | 4 | [Go back to the home page...](../README.md) 5 | 6 | ## How to start to use? 7 | Read documentation for the each `d_vars` library. 8 | 9 | 10 | | Library | Description | 11 | | -------------------- | ------------------------------------------------------------------------------------------ | 12 | | [d_vars_standard.inc](d_vars_standard.md) | Standard variables (integers, booleans, floats and strings) with up to 256 return values reserved. | 13 | | [d_vars_circular.inc](d_vars_circular.md) | Reserves up space for new circular arrays - an array you can keep adding data to the end of, and once it reaches its capacity the earliest data added will be removed - which you can dynamically allocate during run-time. | 14 | | [d_vars_stack.inc](d_vars_stack.md) | Reserves up space for new stacks - conceptual structure consisting of a set of homogeneous elements and is based on the principle of last in first out (LIFO) which is a commonly used abstract data type with two major operations, namely push and pop - which you can dynamically allocate during run-time. | 15 | -------------------------------------------------------------------------------- /docs/d_vars_circular.md: -------------------------------------------------------------------------------- 1 | # d_vars_circular.inc 2 | Pawn Circular Variables - Reserves up space for new circular arrays - an array you can keep adding data to the end of, and once it reaches its capacity the earliest data added will be removed - which you can dynamically allocate during run-time. 3 | 4 | [Go back to the home page...](d_vars.md) 5 | 6 | ## Circular arrays 7 | 8 | A circular buffer is an array you can keep adding data to the end of, and once it reaches its capacity the earliest data added will be removed. 9 | 10 | ```pawn 11 | @variable(.datatype = CIRCULAR_INTEGER, .args = {"CircularArray", 4}) CircArrayTest(); 12 | 13 | public OnGameModeInit() 14 | { 15 | malloc("CircArrayTest"); 16 | 17 | printf("[DETUtils]: (circarr) - Values: %i, %i, %i, %i", 18 | get CircularInteger("CircularArray", 0), 19 | get CircularInteger("CircularArray", 1), 20 | get CircularInteger("CircularArray", 2), 21 | get CircularInteger("CircularArray", 3)); 22 | 23 | add CircularInteger("CircularArray", 236); 24 | add CircularInteger("CircularArray", 72); 25 | 26 | printf("[DETUtils]: (circarr) - Values x2: %i, %i, %i, %i", 27 | get CircularInteger("CircularArray", 0), 28 | get CircularInteger("CircularArray", 1), 29 | get CircularInteger("CircularArray", 2), 30 | get CircularInteger("CircularArray", 3)); 31 | 32 | add CircularInteger("CircularArray", 34); 33 | add CircularInteger("CircularArray", 9); 34 | 35 | printf("[DETUtils]: (circarr) - Values x3: %i, %i, %i, %i", 36 | get CircularInteger("CircularArray", 0), 37 | get CircularInteger("CircularArray", 1), 38 | get CircularInteger("CircularArray", 2), 39 | get CircularInteger("CircularArray", 3)); 40 | 41 | add CircularInteger("CircularArray", 23); 42 | add CircularInteger("CircularArray", 6); 43 | 44 | printf("[DETUtils]: (circarr) - Values x3: %i, %i, %i, %i", 45 | get CircularInteger("CircularArray", 0), 46 | get CircularInteger("CircularArray", 1), 47 | get CircularInteger("CircularArray", 2), 48 | get CircularInteger("CircularArray", 3)); 49 | return 1; 50 | } 51 | ``` -------------------------------------------------------------------------------- /docs/d_vars_stack.md: -------------------------------------------------------------------------------- 1 | # d_vars_stack.inc 2 | Pawn Stack - Reserves up space for new stacks - conceptual structure consisting of a set of homogeneous elements and is based on the principle of last in first out (LIFO) which is a commonly used abstract data type with two major operations, namely push and pop - which you can dynamically allocate during run-time. 3 | 4 | [Go back to the home page...](d_vars.md) 5 | 6 | ## Stack 7 | A stack is a conceptual structure consisting of a set of homogeneous elements and is based on the principle of last in first out (LIFO). It is a commonly used abstract data type with two major operations, namely push and pop. Push and pop are carried out on the topmost element, which is the item most recently added to the stack. 8 | 9 | ```pawn 10 | @variable(.datatype = STACK_INTEGER, .args = {"Stack", 4}) StackTest(); 11 | 12 | public OnGameModeInit() 13 | { 14 | malloc("StackTest"); 15 | 16 | printf("[DETUtils]: (stack) - Values: %i, %i, %i, %i", 17 | get StackInteger("Stack", 0), 18 | get StackInteger("Stack", 1), 19 | get StackInteger("Stack", 2), 20 | get StackInteger("Stack", 3)); 21 | 22 | push StackInteger("Stack", 236); 23 | push StackInteger("Stack", 72); 24 | 25 | printf("[DETUtils]: (stack) - Values: %i, %i, %i, %i", 26 | get StackInteger("Stack", 0), 27 | get StackInteger("Stack", 1), 28 | get StackInteger("Stack", 2), 29 | get StackInteger("Stack", 3)); 30 | 31 | push StackInteger("Stack", 13); 32 | push StackInteger("Stack", 877); 33 | 34 | printf("[DETUtils]: (stack) - Values: %i, %i, %i, %i", 35 | get StackInteger("Stack", 0), 36 | get StackInteger("Stack", 1), 37 | get StackInteger("Stack", 2), 38 | get StackInteger("Stack", 3)); 39 | 40 | // There is no more stack space left. 41 | push StackInteger("Stack", 243); 42 | push StackInteger("Stack", 7212); 43 | 44 | printf("[DETUtils]: (stack) - Values: %i, %i, %i, %i", 45 | get StackInteger("Stack", 0), 46 | get StackInteger("Stack", 1), 47 | get StackInteger("Stack", 2), 48 | get StackInteger("Stack", 3)); 49 | 50 | // Pop the last two values: 51 | new var1, var2; 52 | 53 | pop StackInteger("Stack", var1); 54 | pop StackInteger("Stack", var2); 55 | 56 | printf("[DETUtils]: (stack) - Values: %i, %i, %i, %i", 57 | get StackInteger("Stack", 0), 58 | get StackInteger("Stack", 1), 59 | get StackInteger("Stack", 2), 60 | get StackInteger("Stack", 3)); 61 | 62 | push StackInteger("Stack", 787); 63 | 64 | printf("[DETUtils]: (stack) - Values: %i, %i, %i, %i", 65 | get StackInteger("Stack", 0), 66 | get StackInteger("Stack", 1), 67 | get StackInteger("Stack", 2), 68 | get StackInteger("Stack", 3)); 69 | 70 | return 1; 71 | } -------------------------------------------------------------------------------- /docs/d_versioning.md: -------------------------------------------------------------------------------- 1 | # Versioning 2 | - As you've probably seen on the releases page, DETUtils releases follow really complex versioning system. Which is some kind of a mix of semantic versioning and Kalcor's versioning systems. 3 | 4 | - My mix of these is named `ser-ver` (because calling it server would be ridiculous) or serial versioning. So this ser-ver consists of 4 numbers named: major update, minor update, version patch and general release of the version. 5 | 6 | Not interested? [Go back to the home page...](../README.md) 7 | 8 | ## Updating the version number 9 | - Updating is easier than you think, so, let's say you've made some nice SA:MP library that you want to publish. If you want to use this **serial versioning** (I will stop calling it ser-ver because it started to sound ridiculous as well), you'd start, or you should start, with **0.0.1-R1** which means your project has zero major updates, zero minor updates, one patch and it is on its first version release. 10 | 11 | - Let's say your code had some internal bugs, or your code was messy in general, and you've decided to fix it - you should keep the version number the same, and only increase the release number. So the version would be: **0.0.1-R2**. Which tells the users that no new features were added and that they do not need to upgrade. 12 | 13 | - Okay, so your second release of **0.0.1** has been released, yay! Now, let's say you came up with some fascinanting idea for your code, i.e. a new feature. You made it and implemented it. Now you should increase the patch number and set the release number back to **1**. So the version should be **0.0.2-R1**, which immediatelly tells the user that he should update without hesitating and looking at the changelog. 14 | 15 | - So, you were enjoying your **0.0.2-R1** and unfortunately found a bug - you got it fixed - what you do? Increase the release number. So: **0.0.2-R2**. Straight to the point. 16 | 17 | - Time is passing and you're maintaining your code and you came up to **0.0.9-R1**. What you do? You set the patch number back to zero and release number back to one, and set the minor update number to **1**. So, version of your code is: **0.1.0-R1**. Same is with major updates, once you reach minor update 9, you should not go to 10, but go to major update **1**. 18 | 19 | So basically it all goes like this: 20 | - 0.0.1-R1 21 | - 0.0.1-R2 (R2 if you got some bug-fixes and internal/back-end improvements) 22 | - 0.0.2-R1 23 | - 0.0.3-R1 24 | - 0.0.4-R1 25 | ... 26 | - 0.0.9-R1 27 | - 0.1.0-R1 28 | - 0.1.1-R1 29 | ... 30 | - 0.1.9-R1 31 | - 0.2.0-R1 32 | ... 33 | - 0.9.0-R1 34 | - 1.0.0-R1 35 | 36 | ... and so on. 37 | 38 | ## Pre-releases 39 | - Imagine that you added some big complicated feature, whose testing is not finished yet then you should add a `-beta` suffix - so your version now is: **0.0.1-R1-beta**. You can change **beta** with something yours of course, such as **alpha**, or **prerelease** or anything! 40 | 41 | ## Notes 42 | 43 | - You're allowed to break backwards compatibility at minor updates. 44 | - Version release numbers aren't limited. Which means that **0.0.1-R52** is completely valid. 45 | -------------------------------------------------------------------------------- /docs/d_yaml.md: -------------------------------------------------------------------------------- 1 | # d_yaml.inc 2 | SA:MP YAML - Save, load and manage YAML files using the Pawn API. 3 | 4 | [Go back to the home page...](../README.md) 5 | 6 | ## Example 7 | - For the impatient: 8 | 9 | **`script.pwn`** 10 | ```pawn 11 | yamlremove("test"); 12 | printf("YAML test.yaml exists : %i", yamlexist("test")); 13 | yamlcreate("test"); 14 | yamlwritecomment("test", "This is a comment."); 15 | yamlsetint("test", "int", 1); 16 | yamlsetbool("test", "bool", false); 17 | yamlsetfloat("test", "float", 0.1); 18 | yamlsetstr("test", "string", "Hello World."); 19 | printf("YAML test.yaml exists : %i", yamlexist("test")); 20 | printf("YAML val 'int' is : '%i'", yamlgetint("test", "int")); 21 | printf("YAML val 'bool' is : '%i'", yamlgetbool("test", "bool")); 22 | printf("YAML val 'float' is : '%f'", yamlgetfloat("test", "float")); 23 | printf("YAML val 'string' is : '%s'", yamlgetstr("test", "string")); 24 | ``` 25 | **`test.yaml`** 26 | ```yaml 27 | 28 | # This is a comment. 29 | int:1 30 | bool:false 31 | float:0.100000 32 | string:Hello World. 33 | ``` 34 | **Console output:** 35 | ``` 36 | YAML test.yaml exists : 0 37 | YAML test.yaml exists : 1 38 | YAML val 'int' is : '1' 39 | YAML val 'bool' is : '0' 40 | YAML val 'float' is : '0.100000' 41 | YAML val 'string' is : 'Hello World.' 42 | ``` 43 | 44 | ## How to start to use? 45 | NOTE: Function names start with lowercase letters. 46 | ### Management functions 47 | - These functions are used to manage a YAML file. 48 | ### `yamlexist` 49 | - Checks if the YAML file exists. 50 | 51 | ```pawn 52 | yamlexist("file"); // checks for file: file.yaml 53 | ``` 54 | 55 | ### `yamlremove` 56 | - Removes a YAML file. 57 | 58 | ```pawn 59 | yamlremove("file"); // removes the file: file.yaml 60 | ``` 61 | 62 | ### `yamlcreate` 63 | - This obviously creates a YAML file. 64 | 65 | ```pawn 66 | yamlcreate("file"); // this creates the file: file.yaml 67 | ``` 68 | 69 | - The content of `file.yaml` should be: 70 | 71 | ```yaml 72 | # yaml 73 | ``` 74 | ### "Get" functions 75 | - Used to get key values. 76 | 77 | ### `yamlgetint` 78 | - Get a integer key. Let's say this is your YAML file: 79 | 80 | ```yaml 81 | 82 | 83 | adminlvl:0 84 | ``` 85 | 86 | ```pawn 87 | new admin = yamlgetint("file", "adminlvl"); 88 | ``` 89 | - Variable `admin` will be `0`. 90 | 91 | ### `yamlgetbool` 92 | - Get a boolean key. Let's say this is your YAML file: 93 | 94 | ```yaml 95 | 96 | 97 | player:false 98 | ``` 99 | 100 | ```pawn 101 | new player = yamlgetbool("file", "player"); 102 | ``` 103 | - Variable `player` will be `0`. 104 | 105 | ### `yamlgetfloat` 106 | - Get a float key. Let's say this is your YAML file: 107 | 108 | ```yaml 109 | 110 | 111 | coords:23.73 112 | ``` 113 | 114 | ```pawn 115 | new Float:coords = yamlgetfloat("file", "coords"); 116 | ``` 117 | - Variable `Float:coords` will be `23.73`. 118 | 119 | ### `yamlgetstr` 120 | - Get a string key. Let's say this is your YAML file: 121 | 122 | ```yaml 123 | 124 | 125 | msg:string 126 | ``` 127 | 128 | ```pawn 129 | SendClientMessage(playerid, -1, yamlgetstr("file", "msg")); 130 | ``` 131 | - Player will receive a message saying `"string"`. 132 | 133 | ### "Set" functions 134 | - Used to get key values. 135 | 136 | ### `yamlsetint` 137 | - Set a integer key. 138 | 139 | ```pawn 140 | yamlsetint("file", "adminlvl", 1); 141 | ``` 142 | 143 | ### `yamlsetbool` 144 | - Set a boolean key. 145 | 146 | 147 | ```pawn 148 | yamlsetbool("file", "player", true); 149 | ``` 150 | 151 | ### `yamlsetfloat` 152 | - Set a float key. 153 | 154 | ```pawn 155 | yamlsetfloat("file", "coords", 24.36); 156 | ``` 157 | 158 | 159 | ### `yamlsetstr` 160 | - Set a string key. 161 | 162 | ```pawn 163 | yamlsetstr("file", "msg", "Hello World."); 164 | ``` 165 | 166 | ## Extras 167 | - Extra functions. 168 | ### `yamlwritecomment` 169 | - Write a YAML comment. 170 | 171 | ```pawn 172 | yamlwritecomment("file", "This is a comment."); 173 | ``` 174 | - Your YAML should look like this: 175 | 176 | ```yaml 177 | # This is a comment. 178 | ``` 179 | -------------------------------------------------------------------------------- /pawn.json: -------------------------------------------------------------------------------- 1 | { 2 | "user": "samp-api", 3 | "repo": "DETUtils", 4 | "dependencies": [ 5 | "pawn-lang/pawn-stdlib", 6 | "pawn-lang/samp-stdlib", 7 | "se8870/samp-command-guess", 8 | "Y-Less/code-parse.inc", 9 | "maddinat0r/samp-discord-connector", 10 | "Zeex/amx_assembly" 11 | ], 12 | "entry": "DETUTILS_TESTS.pwn", 13 | "output": "DETUTILS_TESTS.amx", 14 | "contributors": [ 15 | "DEntis-T" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | # Outdated 2 | 3 | - These scripts were used on older versions of DETUtils and may not work anymore. Check the testing mode script used by me to test instead. 4 | -------------------------------------------------------------------------------- /tests/a_commands_tests.inc: -------------------------------------------------------------------------------- 1 | #define DEV_MODE // Tells the library that we're testing it, so it includes a_samp.inc itself! 2 | 3 | #include "a_commands" // We include a_commands. 4 | 5 | main() 6 | { 7 | print("GameMode loaded."); // This is just to avoid bad-entry-point runtime error. 8 | } 9 | 10 | command cmd(playerid,params[]) 11 | { 12 | return 1; // We made a command. 13 | } 14 | 15 | alias command test( playerid , params [ ] ) = cmd; // We make command alias. Don't mind that spacing in these alias commands 16 | // below, I was testing will messing with syntax give out 17 | // errors - since this is a macrofunction. 18 | 19 | alias command test1( playerid ,params[] )= cmd; 20 | 21 | alias command test2(playerid, params [ ] ) =cmd; 22 | 23 | alias command test3(playerid ,params [ ] )=cmd; 24 | 25 | debug command test() 26 | { 27 | printf("Command %s successfully called.", GetDebuggedCommandName ( )); // We "attach" debug function to a command. 28 | // So all code between brackets will be executed 29 | // after player submits to perform specific command. 30 | return 1; 31 | } 32 | 33 | debug command test1() 34 | { 35 | printf("Command %s successfully called.", GetDebuggedCommandName( )); 36 | return 1; 37 | } 38 | 39 | debug command test2() 40 | { 41 | printf("Command %s successfully called.", GetDebuggedCommandName()); 42 | return 1; 43 | } 44 | 45 | debug command test3() 46 | { 47 | printf("Command %s successfully called.", GetDebuggedCommandName ()); 48 | return 1; 49 | } 50 | 51 | debug command cmd() 52 | { 53 | printf("Command %s successfully called.", GetDebuggedCommandName ( )); 54 | return 1; 55 | } -------------------------------------------------------------------------------- /tests/a_interiors_tests.inc: -------------------------------------------------------------------------------- 1 | #define DEV_MODE // Tells the library that we're testing it, so it includes a_samp.inc itself! 2 | 3 | #include "a_interiors" // We include the library. 4 | 5 | main() 6 | { 7 | print("GameMode loaded."); // To prevent runtime error 4. 8 | } 9 | 10 | public OnGameModeInit() 11 | { 12 | CreateCustomInterior("PoliceStation", 243.66, 345.21, 12.78, 9.0, 4564.8, 12.8, 1, 0, 1, 0); // Create interior named PoliceStation. 13 | 14 | SetInteriorEntranceCustomAngles(GetLastInterioridUsed(), 234.453, 0.23); // Set int enter and exit angles 15 | 16 | CreateCustomInterior("Bank", 243.66, 345.21, 12.78, 9.0, 4564.8, 12.8, 1, 0, 1, 0); // Create interior named Bank 17 | 18 | SetInteriorEntranceCustomAngles(GetLastInterioridUsed(), 234.453, 0.23); // Set interior entrance and exit angles. - (again) 19 | 20 | return 1; 21 | } 22 | 23 | 24 | interior PoliceStation(playerid) //we declare literal interior function 25 | { 26 | if(IsInteriorActionPerformed(INTERIOR_ACTION_ENTER)) //when player enter the police station 27 | { 28 | SendClientMessage(playerid, -1, "You entered police station."); // it does this 29 | } 30 | else if(IsInteriorActionPerformed(INTERIOR_ACTION_ENTER)) // when exit 31 | { 32 | SendClientMessage(playerid, -1, "You exited police station."); // does this 33 | } 34 | return 1; 35 | } 36 | 37 | interior Bank(playerid) // we declare literal interior function 38 | { 39 | if(IsInteriorActionPerformed( INTERIOR_ACTION_EXIT )) 40 | return SendClientMessage(playerid, -1, "See you again!"); // when player exit bank it returns a message 41 | return 1; 42 | } 43 | 44 | /* 45 | 46 | Compilation results: 47 | 48 | Pawn compiler 3.10.4 Copyright (c) 1997-2006, ITB CompuPhase 49 | 50 | Header size: 864 bytes 51 | Code size: 7964 bytes 52 | Data size: 65436 bytes 53 | Stack/heap size: 16384 bytes; estimated max. usage=316 cells (1264 bytes) 54 | Total requirements: 90648 bytes 55 | [Finished in 0.4s] 56 | 57 | Debug output: 58 | 59 | [13:35:27] Interior 'PoliceStation' successfully created, entrance is set to: 243.660003, 345.209991, 12.779999. 60 | [13:35:27] Interior 'PoliceStation' has an id 1. 61 | [13:35:27] Interior 'Bank' successfully created, entrance is set to: 243.660003, 345.209991, 12.779999. 62 | [13:35:27] Interior 'Bank' has an id 2. 63 | [13:35:27] |======================================| 64 | [13:35:27] a_interiors.inc 65 | [13:35:27] Successfully loaded! 66 | [13:35:27] 67 | [13:35:27] By: DEntisT 68 | [13:35:27] |======================================| 69 | [13:35:27] GameMode loaded. 70 | 71 | */ -------------------------------------------------------------------------------- /tests/a_interiors_tests_ingame.pwn: -------------------------------------------------------------------------------- 1 | #include 2 | #define detutils_debug 3 | #include "DETUTILS\d_commands" 4 | #include "DETUTILS\d_interiors" 5 | 6 | main() 7 | { 8 | print("gamemode loaded"); 9 | } 10 | 11 | public OnGameModeInit() 12 | { 13 | DisableDefaultInteriors(); 14 | CreateCustomInterior("Bank", 811.1299,-1616.0647,13.5469, 644.6613,-1496.7572,14.8386, 0,0,0,0); 15 | return 1; 16 | } 17 | 18 | public OnPlayerConnect(playerid) 19 | { 20 | SetSpawnInfo(playerid, 0, 0, 811.1299,-1616.0647,13.5469, 0, 0,0,0,0,0,0); 21 | SpawnPlayer(playerid); 22 | return 1; 23 | } 24 | 25 | interior Bank(playerid) 26 | { 27 | if(IsInteriorActionPerformed(INTERIOR_ACTION_ENTER)) 28 | { 29 | SendClientMessage(playerid, -1, "You entered bank."); 30 | return 1; 31 | } 32 | else if(IsInteriorActionPerformed(INTERIOR_ACTION_EXIT)) 33 | { 34 | SendClientMessage(playerid, -1, "You exited bank."); 35 | return 1; 36 | } 37 | return 1; 38 | } 39 | 40 | /* 41 | 42 | Everything works fine as it should. 43 | 44 | */ 45 | --------------------------------------------------------------------------------