Commit Graph

180 Commits

Author SHA1 Message Date
Vincent Herbet
f1f95425b6
Fix a crash with set_tr/2 when -1 is passed in TR_pHit + allow worldspawn (0) in set_tr/2 (#601)
* Fix a crash with set_ptr2 when -1 is passed in TR_pHit

* Allow wordspawn in set_tr|2(TR_pHit, ...)
2018-09-28 16:39:03 +02:00
Arkshine
e8c8111178 Put back <time.h> from previous commit 2018-09-23 23:14:33 +02:00
Duko
08213d8ead GeoIP: Add "reload" command (#588)
* Add reload option

* Adjust logic

* Modernize the code a little
2018-09-23 23:01:49 +02:00
Vincent Herbet
d2d121619f
Another attempt to fix windows compilation (#556) 2018-09-08 21:12:57 +02:00
Vincent Herbet
9a2c586720
Attempt to fix windows compilation (#555)
* Attempt to fix windows compilation

* Testing mysql-c-connector
2018-09-08 20:21:53 +02:00
Vincent Herbet
b4927bfb1f
Revert 1e3832a942ade577d39463979441651b13a5eee4 (#554) 2018-09-08 09:41:29 +02:00
HamletEagle
9a95fd9886 Add cs_get_weaponbox_item native (#548)
* Add cs_get_wpnbox_weapon native

* Rename native + fix strcmp check
2018-09-07 09:01:47 +02:00
Vincent Herbet
99ebd62653
Update Hamsandwich for Sven Coop 5.17 (#452)
* Remove dropped functions

* Update existing offsets

* Add some logic to prevent the use of removed functions.

* Add Ham_SC_AddPoints and Ham_SC_AddPointsToTeam

* Add Ham_SC_GiveAmmo

* Add Ham_SC_FVisibleFromPos

* Fix an old typos with CanPlaySentence for all mods

* Add Ham_SC_CanPlaySequence

* Add Ham_SC_PlayScriptSentence

* Add Ham_SC_StartPlayerFollowing

* Fix CanPlaySequence hamdata.ini (SC)

* Add Ham_SC_StopPlayerFollowing

* Fix handlers from previous commits

* Add Ham_SC_PreSpawn

* Add Ham_SC_PostSpawn

* Add Ham_SC_OnKeyValueUpdate

* Add Ham_SC_SetClassification

* Add Ham_SC_MyCustomPointer and Ham_SC_MyItemPointer

* Add Ham_SC_IsSneaking

* Add Ham_SC_IsAlive

* Add Ham_SC_IsBSPModel

* Add Ham_SC_ReflectGauss

* Add Ham_SC_HasTarget

* Add Ham_SC_IsInWorld

* Add Ham_SC_IsPlayer

* Add Ham_SC_IsNetClient

* Add Ham_SC_IsBreakable

* Fix Ham_SC_IsMonster, Ham_SC_IsPointEntity, Ham_SC_IsMachine and Ham_SC_CriticakRemove handlers

* Add Ham_SC_OnControls

* Fix Ham_SC_TakeHealth and Ham_SC_TakeArmor handlers

* Add Ham_SC_IsTriggered

* Add Ham_SC_RemovePlayerItem

* Fix typo

* Fix Ham_SC_IsMoving handler

* Add Ham_SC_SUB_UseTargets

* Ham_SC_IsLockedByMaster

* Add Ham_SC_FBecomeProne

* Fix Ham_SC_FVisible handler

* Add Ham_SC_FVecVisible

* Fix Ham_SC_FVisibleFromPos handler

* Fix Ham_SC_IsFacing handler

* Add Ham_SC_SetPlayerAlly

* Add Ham_SC_OnSetOriginByMap

* Add Ham_SC_IsRevivable

* Add Ham_SC_BeginRevive and Ham_SC_EndRevive

* Update offsets based on SvenCoop v5.17

* Add Ham_SC_Item_CanCollect and Ham_SC_Item_Collect

* Add Ham_SC_Item_AddToPlayer

* Add Ham_SC_Item_AddDuplicate

* Add Ham_SC_Item_AddAmmoFromItem

* Add Ham_SC_Item_GetItemInfo

* Add Ham_SC_Item_CanDeploy, Ham_SC_Item_Deploy and Ham_SC_Item_CanHolster

* Add Ham_SC_Item_UpdateClientData

* Add Ham_SC_Item_GetRespawnTime

* Add Ham_SC_Item_CanHaveDuplicates

* Add Ham_SC_Weapon_ExtractAmmoFromItem

* Add Ham_SC_Weapon_GetAmmo1Drop and Ham_SC_Weapon_GetAmmo2Drop

* Add Ham_SC_Weapon_FinishReload and Ham_SC_Weapon_ShouldReload

* Fix Ham_SC_IsMultiplayer, Ham_SC_FRunfuncs and Ham_SC_FCanRun handlers

* Add Ham_SC_Weapon_AddWeapon, _PlayEmptySound, _IsUsable, _ShouldWeaponIdle and _UseDecrement

* Add Ham_SC_Item_GetPickupSound

* Add Ham_SC_Item_InactiveItemPreFrame and Ham_SC_Item_InactiveItemPostFrame

* Add Ham_SC_Item_DetachFromPlayer

* Fix Ham_SC_Player_IsConnected handler

* Add Ham_SC_Player_EnteredObserver, Ham_SC_Player_LeftObserver and Ham_SC_Player_IsObserver

* Fix sc_postpawn typo (should be sc_postspawn)

* Add few more assert
2018-09-06 17:09:10 +02:00
Vincent Herbet
c16bd47b30
Remove GetModelCollisionBox, SetModelCollisionBox and SetModelBoundingBox natives (#536) 2018-09-03 18:49:49 +02:00
Vincent Herbet
80cf45d234
Adjust version for manual build and update VS projects (#543) 2018-09-02 20:34:40 +02:00
Vincent Herbet
e0ca2c967c
Fix a windows compilation warning in socket module (#538) 2018-09-01 12:30:12 +02:00
Vincent Herbet
1a2dd9e7ea
Update Fun module (#421)
* Fun: Replace ENTINDEX with TypeConversion for consistency

* Fun: Add a class wrapping player's data

* Fun: Make TraceLine a post forward

Reason: as it is it breaks plugins hooking TraceLine because of the original game call is being superceded and other modules can't catch it. It looks like it's this way from the very start fun module has been introduced 13 years ago before. Fakemeta module comes a little later.

* Fun: Clean up code

* Fun: Toggle PlayerPreThink forward on demand

* Fun: Toggle TraceLine forward on demand

* Fun: Add HITZONE* constants for use with set/get_user_hitzone()

* Fun: Refactor a litte the player class

* Fun: Clean up a little more

* Fun: Fix typo in set_user_hitzones from previous commit
2018-08-30 19:16:19 +02:00
Vincent Herbet
6e9947b64f
Sanitize load_amxscript() and add load_amxscript_ex/MF_LoadAmxScriptEx() requiring error max length (#530)
* Add a saner version of load_amxscript and use SafeStrcpy/Sprintf

* Reflect the change in core

* Add LoadAmxScriptEx API function

* Reflect the change in CSX

* Reflect the change in DodX

* Reflect the change in TFCX

* Reflect the change in TSX

* Add few comments
2018-08-30 18:49:42 +02:00
Vincent Herbet
9e2c76abdc
Update libmaxminddb to v1.3.2 (#526)
* Update libmaxminddb to v1.3.2

* Move PACKAGE_VERSION declaration
2018-08-27 15:42:35 +02:00
Vincent Herbet
9bcabfeb1f
Add or adjust a bunch of safety checks (#433) 2018-08-26 17:18:39 +02:00
OciXCrom
8aeefc3fca Add constants for stats functions (#509)
* Add constants for stats functions

* Changed STATS_ to STATSX_ and added 2 more defines

* Added constants for all games

* Add csstats_const.inc and add _MAX_ constats to enum

* Change bodyhits
2018-08-25 20:52:48 +02:00
Vincent Herbet
f822cc610f
Update ReSDK API to latest version (#520) 2018-08-25 09:20:06 +02:00
Vincent Herbet
ce14df0c77
CStrike: Fix a missing RemoveEntityHashValue function address check (#519) 2018-08-25 09:18:51 +02:00
OciXCrom
ac57ed5b44 Add get_user_rendering (#514)
* Add get_user_rendering

* Added & in arguments

* Changed zeroes to kRender constants

* Changed zeros to kRender constants
2018-08-25 09:18:25 +02:00
Vincent Herbet
faf7da4c2c
Fix a buffer issue in EngFunc_LightStyle (#508) 2018-07-28 21:35:34 +02:00
Vincent Herbet
5f5d6f1d5d
Fix a buffer issue in RegisterHam (#495)
* Fix a buffer issue in RegisterHam

* AString classname as well
2018-07-13 16:23:03 +02:00
IgnacioFDM
2559fcf00a Fix: fakemeta hook not being unregistered (#483) 2018-03-09 19:39:14 +01:00
IgnacioFDM
7c4688f557 Comment MODULE_RELOAD_ON_MAP_CHANGE on modules that use USE_METAMOD (#484)
Currently amxmodx doesn't reload modules that use metamod, so MODULE_RELOAD_ON_MAP_CHANGE being defined or not doesn't make any difference.
Even though this commit currently doesn't change any behavior, amxmodx might in the future support reloading modules that use metamod, and all these modules in their current state either fail completely because of erroneous cleanup, or are untested (and most likely leak stuff).
Furthermore, these changes make it clear that these modules are in fact not being reloaded.
2018-03-09 19:37:46 +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
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
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
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
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
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
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
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
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
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
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
b973d24081 Add missing buffer size check to SQLite QuoteString implementation (#411) 2017-02-23 13:56: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
Artem Golubikhin
f5e734f636 Fixed is_visible native (#392) 2017-01-17 15:52:49 +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
s1lentq
4c8ef63383 Fix: leak memory from unregister_forward (#388) 2016-10-12 23:26:21 +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
Vincent Herbet
09e49439bc Merge pull request #370 from Arkshine/fix/cs_set_user_model
Fix a crash after cs_set_user_model is used with model_index parameter set.
2016-04-16 11:45:37 +02:00