Commit Graph

915 Commits

Author SHA1 Message Date
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
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
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
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
Arkshine
17a31b75d7 Add enable/disable_logevent() natives 2015-12-24 19:08:00 +01:00
Vincent Herbet
01d703cdbb Merge pull request #323 from luxxxoor/patch-1
Adding flag parameter to user_silentkill.
2015-12-24 14:45:45 +01:00
Karol Szuster
62a5c54a18 Add client_connectex & extend client_authorized forward 2015-12-22 16:36:51 +01:00
luxxxoor
892f0519ad Adding flag parameter to user_silentkill.
The api says that the user_silentkill() "Kills a user without a message.",  that means it is just user_kill() without sending deathmsg.
But user_silentkill() automatically kills player without affecting the client's score (and that is not mentioned in api), so i'll add a second parameter to user_silnetkill() to let user to decide if he want to kill a player without or not affecting the table.
New parameter has the default value 1, so it won't break the compatibility.
2015-12-20 01:02:39 +02:00
Arkshine
a445e806ea Cstrike: Refactor - Simplify forwards logic, fix and improve few things
- The logic around CS_OnBuy forward has been simplified. Since there is no way to have a consistent way to hook/block for all items, the new logic is to have as less as possible code, especially in blocking mode where we want to avoid to do extra stuffs (e.g blocking sound, event, etc).

  * All guns + shield -> CanBuyThis()
  * Nvgs and Fefuser only -> CanPlayerBuy()
  * The others items -> GiveNamedItem() + AddAccount()
  * Ammos -> -> BuyGunAmmo() + GiveNamedItem() + AddAccount()

- Fixed missing buyzone check when alias from console are used (CS_OnBUy* were incorrectly fired).
- Fixed an infinite loop when buying of ammos are blocked. Sorted by hooking BuyGunAmmo().
- Fixed blocking mode for some items. Some game behaviors were not blocked (e.g. weapon drop).
- Fixed forwards being triggered even though errors were found. Detours are now a destroyed and associated variables resetted when necessary. Toggling forwards state is now based on detours state.
- Moved things in its own functions (game functions to execute, class members retrieval)
- Renamed CommandAliases -> ItemInfos (more generic)
2015-11-21 00:13:06 +01:00
Arkshine
e87976bc09 Cstrike: Remove CS_OnGetItemPrice forward (reverted from commit 33a7d74b6da2ca4dcb621e9b306c386ba040571e)
This is actually not possible to have a proper system to allow this.
This is two majors problems:
  - The item price text can't be changed, whatever old and VGUI menu (it's either harcoded in config file or in client binary)
  - Once you open VGUI menu, to know if user has enough money to select an item, client relies on the current HUD money value, this means, since we can't directly changed price, before opening the menu, money needs to be somehow faked and restored once closed. It's awful.

Overall it can't work properly, and at the end current forward doesn't make sense.

If an author wanted to have its own prices, the only only way would to force players to use old menu, then overwriting the whole buy menu, so you would be able to display what you want exactly.
2015-11-03 10:45:50 +01:00
Arkshine
ffe8b7761e Cstrike: Move CSW_* constants from amxconst.inc to cstrike_const.inc 2015-11-03 10:45:49 +01:00
Arkshine
2c5cc4289e Cstrike: Add cs_is_valid_itemid() stock 2015-11-03 10:45:49 +01:00
Arkshine
75853dae60 Cstrike: Add cs_find_ent_by_owner() native 2015-11-03 10:45:48 +01:00
Arkshine
23b0450938 Cstrike: Add cs_get_weapon_class() stock (weapon id -> class id)
Note: this has been modified a bit later in cs_is_valid_itemid() commit.
2015-11-03 10:45:47 +01:00
Arkshine
600a15a57b Cstrike: Add cs_get_weapon_info() native 2015-11-03 10:45:47 +01:00
Arkshine
60cdbeb219 Cstrike: Add CS_OnGetItemPrice forward to get/alter an item price on purchase 2015-11-03 10:45:46 +01:00
Arkshine
e6a2434887 Cstrike: Add cs_get_item_id() and cs_get_translated_item_alias() natives 2015-11-03 10:45:45 +01:00
Arkshine
c6628f22ee Cstrike: Add more known constants from game 2015-11-03 10:45:44 +01:00
Arkshine
d3e5957215 Cstrike: Add cstrike_const.inc and move existing constants there 2015-11-03 10:45:44 +01:00
Arkshine
dc6f171f20 Refactor 2 - Duplicate get_member_* for each set of natives for consistency 2015-11-02 20:10:38 +01:00
Arkshine
02c1b20ed7 Rename get_ent_data_size/info/basetype to be more generic 2015-11-02 20:10:37 +01:00
Arkshine
68f99bc2d5 Add get/Set_gamerules_* natives 2015-11-02 20:10:37 +01:00
Arkshine
16f65663dc Add new natives to read/write on entity's private data based off class/member name available from gamedata files 2015-09-19 20:07:48 +02:00
Vincent Herbet
57a5004f4e Fix typo
Related to #266. Looks like I've changed the prefix afterward at some point for some reason, but engine is retarded and with `plugin.something.cfg` it will understand extension is `something` instead  of `cfg` ; and will fail to execute as it's an invalid extension (only `cfg` and `rc` are allowed).
2015-09-05 08:42:31 +02:00
Vincent Herbet
224239f5a1 Merge pull request #266 from Arkshine/feature/autoexeccfg
Introduce automatic config file for plugins and two forwards
2015-08-26 10:42:59 +02:00