Commit Graph

1839 Commits

Author SHA1 Message Date
Relaxing
5b07b25d62
Added Albanian translation 2019-04-14 09:28:49 +02:00
KliPPy
7b3646a012 Update include files documentation (#360)
* Update include files documentation

* Fix inconcistencies with spaces/tabs, some changes

* Update fun, nvault, vector

* Update sqlx.inc
2017-12-09 00:22:43 +01:00
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
Vincent Herbet
779a4d9e59 Fix #395 backward compatibility issue by adding SetParamEntity2 native (#463) 2017-10-05 11:46:05 +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
KliPPy
38008a8e03 Fix amx_plugins throwing errors (#456) 2017-09-01 15:18:23 +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
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
Artem Golubikhin
7794f27dc2 Fixed bug in cmd_access with usage printing (#434) 2017-05-02 12:54:07 +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
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
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
1c3e8de57a Introduce a datapack position tag (#419) 2017-03-06 21:08:16 +01:00
Javivi
6a553122b1 Update sockets module (#301)
* Module rewrite

- WinSock version changed from 1.1 to 2.2.
- Properly check for WinSock initialization on OnAmxxAttach/Detach.
- Now natives will not be added if we can't start up WinSock.
- socket_open() is now IP version agnostic (both IPv4 and IPv6 are
supported).
- Error reporting has been changed on socket_open(), a new parameter
called _libc_errors has been added, and, if enabled, libc errors will be
returned instead of the previous made-up errors.
- socket_close() now returns a value on success/failure.
- Added non-blocking sockets at socket_open_nb().
- Added socket_is_writable() to check if a socket is ready for write.
- Added socket_is_readable() as an alias to socket_change().
- Code rewritten to be more readable, it should be self-explaining now.

* Update docs and fix AMBuild

Updated documentation following the guidelines

* Fixs for the module

- Fixed the backwards compatibility with the return codes
- Merged socket_connect and socket_connect_nb
- Added a 5th parameter to socket_open that takes bit flags to enable
the new features (libc errors & nonblocking sockets)
- Fixed an error on socket_send2 that caused the buffet not to start
from the beginning if multiple calls were made
- Updated docs
- [docs] Prefixed error codes with SOCK_
- [docs] Added the new flags SOCK_NON_BLOCKING and SOCK_LIBC_ERRORS
- [docs] Added a new stock called SOCK_ERROR_EINPROGRESS(error) to be
used when checking if a newly created nonblocking socket is connecting

* Fixes for the docs

Fix some typos, shorten lines, document SOCK_ERROR_EINPROGRESS

* Document magic numbers

No more magic

* Revert "Document magic numbers"

This reverts commit 0f23329206.

* More docs fixes

* Fix broken socket_send2()

* Add error checking in send2()

* Remove stock

It should not be needed because nb sockets should always be checked or
writability

* Fix some identations

* Fix return codes doc

* Fix socket_recv() regression

strncopy will stop on a null byte, that makes the function unusable to
receive binary data

* More docs typo fixes
2017-03-03 19:56:22 +01:00
Vincent Herbet
3568fb8747 Add client_remove() forward and fix a bug with client not internally disconnected (#414)
* Rename client_disconnected to client_disconnecting

* Add client_disconnected as post forward

* Fix client not properly disconnected internally

Introduced in #264.
Edict is reset once SV_DropClient is called, so that second check would be always false.

* Reflect changes on the concerned plugins

* Revert renaming, let's add only client_remove as post forward
2017-02-25 11:50:52 +01:00
KliPPy
828e74e6c3 Add RequestFrame() native (#412)
* Add RequestFrame() native

* Change underlying container from CQueue to ke::Deque

* CFrameAction: Fix PackageScript and MSVC project, wrap CFrameAction in AutoPtr
2017-02-23 12:55:53 +01:00
Nicholas Hastings
7bb1849968 Sanitize servercfgfile and lservercfgfile values with amx_cvar (bug 6578). 2017-01-22 08:01:08 -05:00
Nicholas Hastings
ed672847f3 Remove support for %name% replacement in plmenu (bug 6578). 2017-01-21 22:58:03 -05:00
Nicholas Hastings
56210f3e96 Quote custom vote winning value (bug 6578). 2017-01-21 22:57:37 -05:00
Nicholas Hastings
5519dd0a14 Do case-insensitive compare when filtering password vars in votes (bug 6578). 2017-01-21 22:38:38 -05:00
Nicholas Hastings
7589c6c578 Quote args in amx_addban, amx_unban, & amx_exec (bug 6578). 2017-01-21 22:36:57 -05:00
Vincent Herbet
9b3839de70 Fix missing CS_NORESET constant (#400) 2017-01-10 18:51:41 +01:00
IgnacioFDM
3e660011b2 Fix typo in TE_STREAK_SPLASH description (#398) 2017-01-06 21:05:36 +01:00
Evandro Coan
615ecdf7f3 Fixed grammar for Start Voting mapsmenu.txt lang (#393)
This is bad, what it currently means `Votacao Iniciada` (Votação Iniciada) in english is `The voting has been started`, instead of `Start voting`.

The translator translate it back as `Voting Started`.
Translator link: https://translate.google.com.br/#pt/en/Vota%C3%A7%C3%A3o%20Iniciada
2017-01-01 11:28:11 +01:00
Karol Szuster
e95099817b Allow execute forwards without need to create variable for returned value (#382)
We don't need to create variable to store value returned by forward when we ignore it.
2016-09-01 10:37:14 +02:00
IgnacioFDM
732a05dde0 Back out changes in #366 and introduce read_argv_int/float()
* Revert "Extend "read_argv" native"

This reverts commit aaa2934595.

This broke binary compatibility with either older, already compiled
plugins, or newly compiled plugins if you forgot to update .inc headers.

This happened because read_argv used to receive maxlen by value, and
after
this commit it receives it by reference. This causes read_argv either
to fail, or worse, to buffer overflow, resulting in a security vulnerability.

Newly introduced functionality for read_argv should be added with a new,
separate native.

* Add "read_argv_int" & "read_argv_float" natives
2016-08-31 20:34:02 +02:00
voed
575d215c77 Fixed some natives descriptions 2016-06-14 04:49:46 +03:00
Vincent Herbet
f3c58b7cd6 Merge pull request #369 from Ni3znajomy/forwards/value-by-reference
Values by reference in forwards
2016-06-05 19:50:40 +02:00
Vincent Herbet
2628ce8664 Merge pull request #349 from Arkshine/feature/command-ml
Add a param to register_*cmd() and get_*cmd() to indiquate info is a multilingual key + modify plugin
2016-04-16 13:12:21 +02:00
Arkshine
9054643fe8 Add a param to register_*cmd() and get_*cmd() to indiquate info is a multilingual key + modify plugin 2016-04-16 11:56:49 +02:00
Karol Szuster
53f9144fc3 Values by reference in forwards 2016-04-05 18:51:18 +02:00
Karol Szuster
aaa2934595 Extend "read_argv" native 2016-03-28 20:05:56 +02:00
Karol Szuster
5ad1efd698 Fix description of "set_user_info" native 2016-03-23 17:27:15 +01:00
Karol Szuster
5a3f4be04e message_stocks.inc: Cache messages id 2016-03-20 13:04:48 +01:00
Vincent Herbet
62a7fe0be5 Merge pull request #342 from Arkshine/feature/cs_get_item_alias
Add cs_get_item_alias(), improve cs_get_item_id() & cleanup alias datas
2016-03-16 15:15:00 +01:00
Arkshine
c3a52b366e Add cs_get_item_alias() native & cleanup alias datas 2016-03-16 12:29:33 +01:00
Arkshine
be06e2448b Add fmt() native to format and return inline a string 2016-02-23 19:56:02 +01:00
Karol Szuster
cb87fa12e1 Add extra parameters to cs_get_user_weapon native
Add clip & ammo as optional as get_user_weapon native has
2016-02-17 20:46:42 +01:00
Arkshine
2928c622f9 Add cs_set_ent_class native 2016-02-09 11:27:02 +01:00
Vincent Herbet
209ff4d527 Merge pull request #339 from IgnacioFDM/fix-whitespace
Normalize line endings and whitespace
2016-01-23 22:56:46 +01:00
Vincent Herbet
fa7391e814 Merge pull request #330 from WPMGPRoSToTeMa/csgetuserweapon
Add cs_get_user_weapon_entity() and cs_get_user_weapon() natives
2016-01-23 17:53:54 +01:00
IgnacioDM
e502e12e07 Normalize line endings and whitespace 2016-01-16 21:15:52 -03:00
WPMGPRoSToTeMa
b85b37192e New natives: cs_get_user_weapon_entity and cs_get_user_weapon 2016-01-06 23:10:31 +03:00