Commit Graph

5250 Commits

Author SHA1 Message Date
KliPPy
5632420827 Add wrappers for natives with string flags (#389)
* Add wrappers for natives with string flags

* Add default/none constants, update docs
2017-12-08 00:06:37 +01:00
Karol Szuster
d6e71c8f4f Little cleanup (#461)
* Remove FAKEMETA leftovers

* Move "require_module" native to where it belongs

* Remove broken AMX module support

* Remove useless natives

* Remove "alloc_amxmemory" and "free_amxmemory" functions

* Remove "strip_name" function

* Clean engine a bit

* Export "GiveFnptrsToDll" (Windows) (Core)

* memcpy -> ke::SafeStrcpy

* Export GiveFnptrsToDll in modules

* Update msvc project files
2017-12-07 18:45:16 +01:00
KliPPy
d2e736b10a Strip whitespace when reading product.version (#470) 2017-12-06 15:29:06 +01:00
Vincent Herbet
a69a015189
Fix open_dir not working properly when called recursively (#467) 2017-11-27 12:08:51 +01:00
Vincent Herbet
ac3e2f48d1
Fix mac build 2017-11-26 20:43:20 +01:00
Vincent Herbet
6d8975f9fc
Add -ltr flag to mysql in order to lower glibc requirement (#468) 2017-11-26 20:34:40 +01:00
Vincent Herbet
175d49293c
Bump MySQL version to 5.5 (#466)
* Bump MySQL version to 5.5

* Let's see how Travis-CI goes

* Let's see how AppVeyor goes

* Adjust windows library path
2017-10-31 23:06:30 +01:00
Dmitry Novikov
7fe7cd746f Fix unreachable code (#465) 2017-10-28 16:27:39 +02:00
Vincent Herbet
5a2d940631 Fix utf8rewind compilation with GCC 2017-10-14 14:25:21 +02:00
Artem Golubikhin
0689c664d7 Fixed passing a temporary string to LIGHT_STYLE (#464) 2017-10-08 21:57:12 +02:00
Vincent Herbet
779a4d9e59 Fix #395 backward compatibility issue by adding SetParamEntity2 native (#463) 2017-10-05 11:46:05 +02:00
Vincent Herbet
97df408d51 Fix a crash on the same newmenu overlapping (#462) 2017-10-03 20:43:30 +02:00
Karol Szuster
361a6cc9e0 Introduce a JSON module (#379)
* Add JSON module

* Merge upstream changes

Fix memory leaks

* Add json include to PackageScript

* Merge upstream changes

Fix memory leaks and increase max nesting

* Fix documentation

* Use AutoPtr in managing JSON handles

* Merge upstream changes

Order of items in an array is preserved after removing an item.

* Merge upstream

* Fix crash

* Add VS projects files and fix mixed tab/spaces

* Remove erroring on "json_free"

* Add comments to "json.inc" file

* Remove overloaded operators

* Use of "override" keyword where needed

* Fix parameter's name
2017-09-30 20:23:12 +02:00
Karol Szuster
f96cb9a3b6 Use smart pointers in NativeHandle class (#457)
* Use AutoPtr in natives handles

* Use size_t type instead of int in natives handles

* Use pre decrement operator in destroy method
2017-09-25 16:52:12 +02:00
Karol Szuster
604ecbd31e Fix build clang 3.9+ (#458)
* clang 4.0: fix ordered comparison between pointer and zero

* clang 4.0: fix taking address of packed member

Maybe someday someone will properly fix it

* clang 3.9: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior

Someday proper fix?
2017-09-25 15:22:53 +02:00
Vincent Herbet
feba821306 Fix a typo in equali, strcmp and strncmp natives (#459) 2017-09-12 21:00:26 +02:00
Freeman-AM
4fc58e6afd Minor fixes in configs files. (#455)
* Missing amx_help_display_msg_time var in amxx.cfg

* Missing vars in CS DOD TFC and TS core.ini

* Standardization to others file location comments in clcmds.ini

* Missing account flag comments + typo errors in NS users.ini
2017-09-01 15:23:49 +02:00
KliPPy
38008a8e03 Fix amx_plugins throwing errors (#456) 2017-09-01 15:18:23 +02:00
Vincent Herbet
ba58cb045f Adjust 'amxx cvars' command output (#453) 2017-08-07 23:42:41 +02:00
Vincent Herbet
8e7eb94e50 Overhaul Restrict Weapons plugin - part 1 (#347)
* Restmenu: Use CS_OnBuyAttempt forward to detect any buy attempt - part 1

- Removed any useless code which won't be needed anymore with forward. A lot!

* Restmenu: Use CS_OnBuyAttempt forward to detect any buy attempt - part 2

- Added the actual forward
- Because of forward passing a CSI_* constant, it's needed to refactor how is saved a blocked item. Not fully implemented everywhere because menu is going to be refactored later as well.

* Restmenu: Replace findAliasId() by cs_get_item_id()

* Restmenu: Use cvar pointers

* Restmenu: Refactor menu - part 1

Purpose:
  - Convert old menus to new menus.
  - Instead of having one menu with several pages, having one main menu (item types) and sub-menus (items list). More readable, more easy to naviguate and no pagination.
  - Move hardcoded strings to ML

* Restmenu: Refactor menu - part 2

Purpose:
  - Convert old menus to new menus.
  - Instead of having one menu with several pages, having one main menu (item types) and sub-menus (items list). More readable, more easy to naviguate and no pagination.
  - Move hardcoded strings to ML
  - Minor visual improvements

* Restmenu: Refactor podbot stuff

- Factorized code
- Used a more direct way to set restrictions

* Restmenu: Refactor load/save config file

- Used new file natives
- Moved harcoded message header to ML
- QoL: saved restricted items will be grouped per type
- Cleaned up few things

* Restmenu: Refactor amx_restrict command

- Minor improvements on how are retrieved/handled arguments from command.
- Same as menu, it displays first classes list, then it lists associated items. No more pagination.
- Minor visual changes.

* Restmenu: Remove unused stuffs

* Restmenu: Move more harcoded messages to ML

* Restmenu: Move MAPSETTINGS define to cvar

- Don't forget me in changelog
- There is room for improvements but for now keep the same behavior

* Restmenu: Add some consistency, no code change

- Renamed some variables
- Changed functions order
- Removed extra spaces
- Fixed leading tabs

* Restmenu: Use inline formatting at various places

* Restmenu: Make command descriptions multilingual for player

* Restmenu: Refresh opened menus if the command is used to save/load/set.

Also, I've removed the renaming of "exit" item because it was misleading as it returns MENU_EXIT when it's named with "back" and handling the action wiht that doesn't make much sense.

* Restmenu: Adjust minor things (consistency, readability, safety)

* Restmenu: Show the current category when items are listed through the command

* Restmenu: Display admin activity on loading/saving

+ load: reset blocked items only if file has been loaded
+ load: ignored if no arguments
+ save: added a silly fix because of the cvars
2017-08-05 10:45:29 +02:00
Vincent Herbet
ab854ec035 Improve UTF-8 support in some natives (bug 6475) (#407)
* Compile as static library, update AMBuildScript and link to core

* Update VS project files to include the library

* Add UTF-8 Rewind library (v1.5.1) to third_party directory

* Update ACKNOWLEDGEMENTS.txt

* Move AMXX buffer in its own function

* Move constants from string.inc to string_const.inc and update project files

* Move stocks from string.inc to string_stocks.inc and update project files

* Improve UTF-8 support in containi() and update documentation

* Improve UTF-8 support in strcmp() and update documentation

* Improve UTF-8 support in strfind() and update documentation

Worth to be noted that this native with ignorecase set was not working properly. So broken that no one reported the issue.
This adds also a safety check for "pos" parameter to not go < 0.

* Improve UTF-8 support in strncmp() and update documentation

* Improve UTF-8 support in equali() and update documentation

* Add an option to some UTF-8 Rewind functions for avoiding invalid data to be replaced

By default it replaces any invalid byte or sequence of bytes by 0xFFFD (3 bytes). It can be problematic when the input buffer is not changed (from a plugin) and that some natives need to calculate a position from the converted string. With such replacement, the position is displaced due the final string length being larger.

This compiles the library as C++, because I added some silly param with a default default value which is not supported by C.

* Improve UTF-8 support in replace_string/ex() and update documentation

* Add is_string_category() and update documentation

* Update a little testsuite plugin (and fix linux compilation)

* Add mb_strotolower/upper() and update documentation

* Add mb_ucfirst() and update documentation

* Add mb_strtotile() and update documentation

* Improve UTF-8 support in get_players() and find_player() with name/case insenstive flags set

* Fix KliPPy's complain
2017-08-05 10:32:16 +02:00
Vincent Herbet
07c3d49cfa Add amx_searchcmd command in adminhelp plugin and do some clean up (#415)
* AdminHelp: Use semicolon everywhere

* AdminHelp: Translate amx_help description

* AdminHelp: Use the available ADMIN_ALL define in register_concmd

* AdminHelp: Bind the cvars

* AdminHelp: Replace %L by %l

* AdminHelp: Remove task only when necessary

* AdminHelp: Reorder some lines to prepare next commit

* AdminHelp: Use read_arg_int() on the first argument and clamp the value

* AdminHelp: Use read_arg_int() on the second argument and clamp the value

* AdminHelp: Rename few variables and callback

* AdminHelp: Use constants for buffers max length

* AdminHelp: Add amx_searchcmd command, and update the multilingual file

* AdminHelp: Adjust spacing a little for readability

* AdminHelp: Add amx_help_display_msg_time cvar

* AdminHelp: Add the new command in the help message (and fix missing return)

* AdminHelp: Add a check if provided entry no. goes above the total found entries

* AdminHelp: Don't show the help message for begin if all commands are already displayed

* AdminHelp: Make sure the server command use amx_help_amount_per_page value
2017-08-01 22:56:21 +02:00
PartialCloning
24e56d0476 Add elog_message native (#451)
* elog_message

Like "log_message". Logs a message to the current server log file, however the messages sent are also sent to all plugins and can be hooked using "register_logevent".

* Update amxmodx.cpp

* Update Editor.sci

* Update UnitfrmMain.dfm
2017-08-01 15:14:53 +02:00
Vincent Herbet
1dc1f1b9c4 Introduce Trie Iterators (#413)
* TrieIter: Add possibility to obtain a new'd HashTable iterator

* TrieIter: Add CellTrieIter and storage

* TrieIter: Implement TrieIterCreate

* TrieIter: Implement TrieIterEnded

* TrieIter: Implement TrieIterMore

* TrieIter: Implement TrieIterGetKey

* TrieIter: Implement TrieIterGetSize

* TrieIter: Implement TrieIterGetCell

* TrieIter: Implement TrieIterGetString

* TrieIter: Implement TrieIterGetArray

* TrieIter: Implement TrieIterDestroy

* TrieIter: Invalidate any mutating change that is key addition or key removal

* TrieIter: Clean up the handles at map change

* TrieITer; Add iter tests to trietest.sma

* TrieIter: Fix linux compilation

* TrieIter: Rename TrieIterMore to TrieIterNext

* TrieIter: Adjust documentation

* TrieITer; Adjust trietest.sma

* TrieIter: Create a custom StringHashMap class instead

+ used a copy of |iterator| instead of dynamic allocation
+ initialized vars directly in constructor
+ added a nested iteration test
2017-08-01 15:05:27 +02:00
Vincent Herbet
304e992942 Fix broken cs_set_user_model update_index parameter for the default engine (#450) 2017-07-29 17:01:34 +02:00
Vincent Herbet
4fcfc913d3 Fix Ham_Item_GetItemInfo incorrect associated handler (#449) 2017-07-26 20:36:17 +02:00
Vincent Herbet
6bd2f1feec Fix a engclient_cmd and amxclient_cmd buffer issue (#438) 2017-07-21 23:44:05 +02:00
Artem Golubikhin
aa9ec3f872 Fix client_disconnected isn't called on mapchange when ReHLDS API enabled (#446) 2017-07-03 21:52:38 +02:00
In-line
f7f86fb040 Rename suki to key_index (#445) 2017-06-28 18:31:59 +02:00
In-line
5ad72374cd Cstrike: Get offset for m_bMapHasBombTarget (#443)
* Cstrike: Get offset for m_bMapHasBombTarget

* Add mising entities to common.games/master.games.txt
2017-06-21 10:07:26 +02:00
Vincent Herbet
b7cb555cee Fix a comment typo in core.ini 2017-05-28 22:48:56 +02:00
IgnacioFDM
66cc8dcdaf Minor flagman cleanups (#442)
* Document disableflagman

* Add disabled check, random cleanups
2017-05-28 22:39:44 +02:00
KliPPy
c0011891e6 Fix temporary ban flags, add lang keys (#440) 2017-05-27 21:47:24 +02:00
KliPPy
ac7de68ac7 Fix amx_addban and amx_unban, make them safe (#441) 2017-05-27 16:28:15 +02:00
In-line
df4e4949c8 Fix #427, AMTL Code porting (#436)
* Fix crash in CTaskMngr::startFrame()

* Fix crash in EventsMngr::executeEvents()

* Fix loops

* Fix loop iterators signess
2017-05-11 09:35:38 +02:00
Artem Golubikhin
7794f27dc2 Fixed bug in cmd_access with usage printing (#434) 2017-05-02 12:54:07 +02:00
Vincent Herbet
1a56577f7a Fix inc/dec operators not returning an iEXPRESSION (#429)
* Fix inc/dec operators not returning an iEXPRESSION

* Fix inc/dec operators in return statement
2017-04-29 23:33:09 +02:00
Vadim
be3ae83c44 Update get_func_id description (#430)
Return id 0 on success too
2017-04-29 21:13:29 +02:00
justgo97
398983fc49 Update amxmodx.inc (#432) 2017-04-29 20:56:20 +02:00
In-line
e9f501c250 Allow value be empty in lang files (#431)
* Allow value be empty in lang files

* Refactor solution.
2017-04-29 20:55:34 +02:00
Karol Szuster
123246cc84 Port code to AMTL (#427)
* Remove CQueue

* Remove duplicated files

* Move sh_tinyhash to public/

* Remove sm_queue

Make NVault use of ke::Deque

* Remove sh_string (unused)

* Remove CList dependency from CTask

* Remove CList dependency from CEvent

* Remove CList dependency from modules' functions

* Remove CList dependency ForceObject

* Remove CList dependency Player Auth

* Remove left CList dependencies

* Fix msvc project files

* Update AMTL

* Use InlineList for CScript

* Use InlineList for CModule

* Use Vector for Player Auth
2017-04-14 19:36:59 +02:00
IgnacioFDM
2d049b7ff3 Fix signed/unsigned mismatch warning (#428)
* Fix signed/unsigned mismatch warning

* Fix GCC type warnings
2017-04-04 10:32:04 +02:00
KliPPy
2863455185 Add menu pagination callback (#420)
* Add menu pagination callback

* Update test plugin
2017-04-04 10:29:18 +02:00
IgnacioFDM
ff488dd81f Add new xs stocks (#426)
xs_vec_len_2d returns the length of a 2D vector

xs_vec_distance returns the distance between two vectors
xs_vec_distance_2d returns the distance between two 2D vectors

xs_vec_add_scaled and xs_vec_sub_scaled do two operations
in one for convenience and performance. They add/subtract a vector
scaled by a scalar to another vector. Very useful when working with
unit vectors.
2017-04-03 18:41:46 +02:00
Vincent Herbet
da80667fb0 Ignore ReHLDS initialization on listenserver (#425)
* Remove duplicated files

* Ignore ReHLDS initialization if not a dedicated server
2017-03-19 14:12:07 +01:00
Karol Szuster
9551c70c59 Rework build pathname functions (#422)
* Rework build_pathname* functions

* Replace old platform defines with the new ones

* Correct usage of build_pathname_r()

* Fix inconsistencies (white spaces)

* Remove useless defines
2017-03-11 19:26:25 +01:00
Freeman-AM
fa3d28872e Replace s/get_pdata* with s/get_ent_data* in plmenu.sma (#424) 2017-03-11 14:58:10 +01:00
Vincent Herbet
d23d9b1ba8 Fix missing ReGameDLL check in GetItemPrice() (#423) 2017-03-11 10:49:37 +01:00
Vincent Herbet
55c9143b2b Fix a cs_set_user_model issue with model not being persistent set on a 32th player
Related to some PR fixing cs_set_user_model() crash.
2017-03-10 18:33:19 +01:00
Vincent Herbet
115916d753 Add basic ReHLDS and ReGameDLL support (#417)
* Add ReHLDS API files and its dependencies

Note: This has been stolen from ReAPI AMXX module and modified/adjusted to match AMXX existing includes and to provide as less dependencies as possible as well

* Add the necessary files to get ReHLDS interface

* Split SV_DropClient into pre/post code

* Init ReHLDS API and add SV_DropClient hook

* Add Cvar_DirectSet hook and adjust code with helpers

Note: we don't need to split code here. This is pretty much the naive and straight way, but fairly enough for our case. If it happens we got a lot more hooks, we may consider to use some class to manage better the things.

* Move platform and interface stuff in their own files in public directory

* Make sure to init cvar stuff after ReHLDS

* Add ReGameDLL API files and its dependencies in cstrike module

* Init ReHLDS in cstrike module and adjust code

Note: About cs_uset_set_model(). ReHLDS API doesn't offer a way to know directly the precached models, so instead of looping through all the ressources, the models list is saved one time at map change into a hashmap.

* Init ReGameDLL and adjust code

* Fix linux compilation

* Init ReGameDLL in fakemeta module and adjust code

* Rename /reapi directory to /resdk to avoid confusion

* Retrieve gamerules pointer through InstallGameRules in fakemeta module

* Retrieve gamerules pointer through InstallGameRules in cstrike module

Note: actually gamerules is not used if regamedll is enabled, but it could be used in future natives.

* Fix a typo when ReGameDLL is not enabled

* Fix missing interface check for ReHLDS.

I'm pretty sure I was checking at the very first since I worked first on vanilla version of engine, looks like change has been lost.
2017-03-09 19:59:38 +01:00