Commit Graph

5407 Commits

Author SHA1 Message Date
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
Vincent Herbet
1c3e8de57a Introduce a datapack position tag (#419) 2017-03-06 21:08:16 +01:00
Karol Szuster
b7773ba11f Fix sockets crash (#418) 2017-03-04 14:14:08 +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 0f233292063400ea7fdbcd5e5d5cd6e54f8cd71c.

* 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
7a7d0442aa Fix VS project file (#416) 2017-02-26 21:15:53 +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
Vincent Herbet
b973d24081 Add missing buffer size check to SQLite QuoteString implementation (#411) 2017-02-23 13:56:58 +01:00
Vincent Herbet
074af44ead Fix a potential crash in ArrayClone for too large arrays (#408) 2017-02-23 13:27:16 +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
3a73e12550 Update to the latest AMTL (#410) 2017-02-19 15:01:58 +01:00
Artem Golubikhin
c27bfcd7fe Fix client_death forward called on kill command if sent by a spectator (#404) 2017-02-18 19:53:58 +01:00
Vincent Herbet
38b8dc338d Fix missing backward compatibility check in TrieGetString() and TrieGetArray() (#406) 2017-02-05 11:52:04 +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
souvikdas95
a7c3e34fbe Fix Warning from MSVC: 'Double to Float precision loss' (#402) 2017-01-21 20:58:33 +01:00
Artem Golubikhin
f5e734f636 Fixed is_visible native (#392) 2017-01-17 15:52:49 +01:00
souvikdas95
a30172f8a6 Fix UTF-8 character parsing due to improper casting (#401)
Upcasting of -ve signed characters (char) to signed integers (cell) results in -ve signed integers which don't represent valid printable characters.
eg. UTF-8 Character '中' (0xE4 0xB8 0xAD) when casted results in 0xFFFFFFE4 0xFFFFFFB8 0xFFFFFFAD which are not valid printable characters.
2017-01-17 15:50:00 +01:00
Vincent Herbet
9b3839de70 Fix missing CS_NORESET constant (#400) 2017-01-10 18:51:41 +01:00
Vincent Herbet
faa9f6ea9f Fix returning strings from variadic functions (lost changes) (#399) 2017-01-09 20:40:28 +01:00
IgnacioFDM
3e660011b2 Fix typo in TE_STREAK_SPLASH description (#398) 2017-01-06 21:05:36 +01:00
Evandro Coan
e19f80cd3f Fix the modules/mysqlx/AMBuilder not building on Visual Studio 2015 (#397)
* Fix the modules/mysqlx/AMBuilder not building on Visual Studio 2015

Applied the same fix as in:

Fix building of MySQL DBI extension on VS 2015+ by psychonic:
94383d995d

* Removed the msvc15hack.c from the sources when not necessary.
2017-01-06 21:03:22 +01:00
Artem Golubikhin
6473118b24 Fixed entity param changing in hamsandwich (#395) 2017-01-02 09:38:43 +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
79d9fc530d Update AMTL (#390) 2016-12-31 23:49:46 +01:00
Karol Szuster
e3ae451c09 Add missing format param (#391) 2016-11-25 11:26:58 +01:00
s1lentq
4c8ef63383 Fix: leak memory from unregister_forward (#388) 2016-10-12 23:26:21 +02: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
Alexander Petrov
a9557fe53d Use exponentiation by squaring instead of n-times multiplications in power() (#385) 2016-08-27 10:12:02 +02:00
Karol Szuster
ea43a61094 Update hashing library (#384) 2016-08-22 11:21:46 +02:00
Vincent Herbet
e24b9548d4 Update to the latest AMTL (#381)
* Update to latest AMTL.

* Update .gitignore for VS2015
2016-08-12 15:30:06 +02:00
IgnacioFDM
b9997eb628 Fix a floatround bug (#376)
* Fix floatround overflow

floatround would overflow for floats greater than 2^30 because internally
it would double the number (therefore anything greater than 2^30 results
in something greater than 2^31 which would cause overflow of course)

floatround behaviour is left exactly identical otherwise (although I find
it very weird and wrong to deliberately avoid banker's rounding, it would
be a bad idea to change this behaviour due to compatibility)

Remember to reassemble amxexecn and amxjitsn

* Update the compiled object files
2016-06-27 12:23:08 +02:00
KliPPy
a53e7905db Extend amxx list command (#377) 2016-06-26 14:04:33 +02:00
Vincent Herbet
861011fa24 Merge pull request #375 from voed/patch-1
Fixed some natives descriptions
2016-06-14 08:52:36 +02:00
voed
575d215c77 Fixed some natives descriptions 2016-06-14 04:49:46 +03:00
Vincent Herbet
294066ca61 Merge pull request #374 from Arkshine/fix/util_replaceall
Fix UTIL_ReplaceAll not properly tracking length.
2016-06-10 15:29:33 +02:00
Arkshine
2099a88ddf Fix UTIL_ReplaceAll not properly tracking length. 2016-06-06 12:09:42 +02:00
Vincent Herbet
1662b47f7e Merge pull request #372 from Ni3znajomy/gcc6-fix-compilation
Fix compilation error for GCC 6
2016-06-05 19:51:27 +02: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
Karol Szuster
446a1a5108 Fix compilation error for GCC 6.1
Fix compilation error due -Wmisleading-indentation
2016-05-04 15:01:29 +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