s1lentq / reapi Goto Github PK
View Code? Open in Web Editor NEWAMX Mod X module, using API regamedll & rehlds
Home Page: https://dev-cs.ru/resources/73/
License: GNU General Public License v3.0
AMX Mod X module, using API regamedll & rehlds
Home Page: https://dev-cs.ru/resources/73/
License: GNU General Public License v3.0
Console: [ReAPI]: VTC Api major version mismatch; expected 1, real 3
New version (2017 RC): http://cs.rin.ru/forum/viewtopic.php?p=1362835#p1362835
When using rg_set_user_team or rg_join_team for a player from SPECTATOR to (TEAM_CT or TEAM_TERRORIST), followed by rg_respawn_round(player), default weapons don't get spawned.
rg_find_bpack_item_by_name Vs rg_find_item_bpack_by_name
..
..
..
/*
* Find the item by name in the player's inventory.
*
* @param index Client index
* @param item Item name
*
* @return Entity-index of item, 0 otherwise
*
* native rg_find_bpack_item_by_name(const index, const item[]);
*/
cell AMX_NATIVE_CALL rg_find_item_bpack_by_name(AMX *amx, cell *params)
..
..
..
AMX_NATIVE_INFO Misc_Natives_RG[] =
{
..
..
..
{ "rg_find_item_bpack_by_name", rg_find_item_bpack_by_name },
..
..
..
1>------ Build started: Project: reapi, Configuration: Release Win32 ------
1> can't locate git.exe - auto-versioning step won't be performed
1> interface.cpp
1> amxxmodule.cpp
1> api_config.cpp
1> dllapi.cpp
1> engine_api.cpp
1> hook_manager.cpp
1> hook_callback.cpp
1> hook_list.cpp
1>..\src\hook_list.cpp(40): fatal error C1001: An internal error has occurred in the compiler.
1> (compiler file 'msc1.cpp', line 1325)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1> Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1> ..\src\hook_list.cpp(37) : while compiling class template member function 'regargs<>::regargs(void (__cdecl *)(void))'
1> ..\src\hook_list.cpp(53) : see reference to function template instantiation 'regargs<>::regargs(void (__cdecl )(void))' being compiled
1> ..\src\hook_list.cpp(53) : see reference to class template instantiation 'regargs<>' being compiled
1> ..\src\hook_list.cpp(142) : see reference to function template instantiation 'regfunc::regfunc<void,IReGameHook_CSGameRules_ServerDeactivate,>(R (__cdecl *)(T))' being compiled
1> with
1> [
1> R=void
1> , T=IReGameHook_CSGameRules_ServerDeactivate *
1> ]
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
https://github.com/s1lentq/reapi/blob/master/reapi/src/hook_list.cpp#L40
Visual Studio Ultimate 2013 (12.0.21005.1 REL)
CBasePlayer_DropPlayerItem : pszItemName parameter always returns empty string!
Is there any way of doing stuffs like this using ReAPI? If not, is it going to be implemented?
Because the frags gone to 0 and minus with get_entvar(id, var_frags) ....
bjallamo/Reapi_AMXX_Plugins@71ce06a?diff=split
rg_send_bartime(const index, const Float:duration, const bool:observer = true)
to
rg_send_bartime(const index, const duration, const bool:observer = true)
If it's with duration as float it's doesn't works
Can we have RH_Cvar_Init like RH_Cvar_DirectSet so we can hook it and do changes there and ty.
Hello
I'm thinking to make my AMXMODx plugins to use reAPI as I'd heard that reAPI is faster
So any place where I can learn it ?
I want to block the change name for the players. I try with the following but dont work
RegisterHookChain(RG_CBasePlayer_SetClientUserInfoName, "fw_PlayerChangeName");
/* Player change name */
public fw_PlayerChangeName( const iPlayerID, const iBuffer, const szNewName[] )
{
console_print(iPlayerID, "*** You can't change your name ***");
SetHookChainReturn(ATYPE_INTEGER, 0);
return HC_SUPERCEDE;
}
Нужно API для вызова следующих функций:
Пример в okapi:
// radius damage a little more potent in multiplayer.
if(RadiusDamage)
{
okapi_call(RadiusDamage,vecEndPos, ent, player, WEAPON_DAMAGE / 4.0, 128.0, 0, DMG_ENERGYBEAM | DMG_BLAST | DMG_ALWAYSGIB)
}
Пример в hl_wpnmod.inc:
wpnmod_fire_bullets(player,player,7,VECTOR_CONE_20DEGREES,4096.0,WEAPON_DAMAGE,DMG_NEVERGIB|DMG_BULLET,7)
Hello,
Please can someone make me a weapons restriction plugin with ReAPI
I know there's one by @s1lentq but that doesn't have features like amx_restrict on "weapon name"....
So., please if possible maybe can you make it like amxmodx provided weapon restriction plugin so that i can use it as map specific
DeathNotice uses inflictor from here:
https://github.com/s1lentq/ReGameDLL_CS/blob/e57371d0f4d6c35381c0d1e6a0a5550aa7acd48e/regamedll/dlls/player.cpp#L2019
But g_pevLastInflictor can be nullptr when suicide:
https://github.com/s1lentq/ReGameDLL_CS/blob/21b0689030ea393b1b57b8a73faef90a96f304dd/regamedll/dlls/client.cpp#L172
There is no check for nullptr in inflictor and this causes a crash: (in DeathNotice callback)
https://github.com/s1lentq/reapi/blob/master/reapi/src/hook_callback.cpp#L507
public plugin_init()
{
RegisterHookChain(RG_BuyGunAmmo, "BuyGunAmmo", .post = true)
}public BuyGunAmmo(const pPlayer, const pWeapon, const bool:blinkMoney)
{
server_print("BuyGunAmmo return: %i", GetHookChainReturn(ATYPE_INTEGER))
// or
server_print("BuyGunAmmo return: %s", GetHookChainReturn(ATYPE_INTEGER) ? "true" : "false")
}
result:
BuyGunAmmo return: 1635841
BuyGunAmmo return: true
BuyGunAmmo return: 1635841
BuyGunAmmo return: true
BuyGunAmmo return: 1635841
BuyGunAmmo return: true
BuyGunAmmo return: 1635840
BuyGunAmmo return: true
BuyGunAmmo return: 1635840
BuyGunAmmo return: true
BuyGunAmmo return: 1635840
BuyGunAmmo return: true
BuyGunAmmo return: 1635840
BuyGunAmmo return: true
I made a modification to serfreeman's plugin, but when i'm in the second jump, the character don't move anywhere.
I have tried the code with bitstop flag "~" too.
Here's a video of the problem:
https://www.youtube.com/watch?v=yXIYLEyuuG4
#include <amxmodx>
#include <reapi>
#define MAXJUMPS 2 // maximum jumps
#define IN_JUMP (1<<1)
#define FL_ONGROUND (1<<9)
new const PLUGIN[] = "Multijump"
new const VERSION[] = "1.0"
new const AUTHOR[] = "serfreeman1337" // Reapi modification by mforce
enum _:jdata {
bool:DOJUMP,
JUMPCOUNT
}
new player_jumps[33][jdata]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHookChain(RG_CBasePlayer_Jump, "Hook_PlayerJump");
}
public Hook_PlayerJump(id) {
static oldButtons
oldButtons = get_entvar(id, var_oldbuttons)
if(!(get_entvar(id, var_flags) & FL_ONGROUND) && !(oldButtons & IN_JUMP)) {
if(player_jumps[id][JUMPCOUNT] < MAXJUMPS - 1) {
player_jumps[id][DOJUMP] = true
player_jumps[id][JUMPCOUNT] ++
}
}
else if(get_entvar(id, var_flags) & FL_ONGROUND) {
player_jumps[id][JUMPCOUNT] = 0
}
if(player_jumps[id][DOJUMP]) {
static Float:velocity[3]
get_entvar(id, var_velocity, velocity)
velocity[2] = random_float(265.0,285.0)
set_entvar(id, var_velocity, velocity)
player_jumps[id][DOJUMP] = false
}
}
public client_disconnect(id) {
arrayset(player_jumps[id], 0, jdata)
}
Title, eg:
ExecuteHamB(Ham_CS_Player_ResetMaxSpeed, iPlayerID);
I want to do the same with reapi
EDIT: i dont see it, it's already on: #9
Не помешало бы API для след. функций:
del
I can't get the m_rgAmmo from the player on ItemPostFrame, i get all 0 with it.
Plugin to test
#include <amxmodx>
#include <reapi>
#include <hamsandwich>
#define MAX_CLIP 10
public plugin_init()
{
for (new WeaponIdType: iWeaponID = WEAPON_P228, szEntity[32]; iWeaponID <= WEAPON_P90; iWeaponID++)
{
/* Ignore invalid weapons */
if (iWeaponID == WEAPON_GLOCK || iWeaponID == WEAPON_C4)
continue;
/* Get the weapon ent class */
rg_get_weapon_info(iWeaponID, WI_NAME, szEntity, charsmax(szEntity));
/* Hook the weapon deploy */
RegisterHam(Ham_Item_PostFrame, szEntity, "fw_WeaponPostFrame");
}
}
public fw_WeaponPostFrame( const iEntityID )
{
/* Invalid entity? */
if (is_nullent(iEntityID))
return HAM_IGNORED;
/* Get the player */
new iPlayerID = get_member(iEntityID, m_pPlayer);
/* Weapon end reloading? */
if (get_member(iEntityID, m_Weapon_fInReload) && get_member(iPlayerID, m_flNextAttack) <= get_gametime())
{
/* Get weapon data */
new iClip, iAmmoType;
iClip = get_member(iEntityID, m_Weapon_iClip);
iAmmoType = get_member(iEntityID, m_Weapon_iPrimaryAmmoType);
/* Get player rgAmmo */
new rgAmmo[32];
get_member(iPlayerID, m_rgAmmo, rgAmmo);
/* Print rgAmmo to the player console */
for (new iIndex = 0; iIndex < 32; iIndex++)
{
console_print(iPlayerID, "rgAmmo[ %d ]: %d", iIndex, rgAmmo[ iIndex ]);
}
/* Complete the reload */
new iAdd = min(MAX_CLIP - iClip, rgAmmo[ iAmmoType ]);
client_print_color(iPlayerID, iPlayerID, "iEntityID: %d | iClip: %d | iAmmoType: %d | iAmmo: %d - %d | iAdd: %d", iEntityID, iClip, iAmmoType, rgAmmo[ iAmmoType ], rg_get_user_bpammo(iPlayerID, get_member(iEntityID, m_iId)), iAdd);
/* Add them to the clip */
set_member(iEntityID, m_Weapon_iClip, iClip + iAdd);
/* Update the player ammo */
set_member(iPlayerID, m_rgAmmo, (rgAmmo[ iAmmoType ] - iAdd), iAmmoType);
set_member(iEntityID, m_Weapon_fInReload, false);
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
Output:
rgAmmo[ 0 ]: 0
rgAmmo[ 1 ]: 0
rgAmmo[ 2 ]: 0
rgAmmo[ 3 ]: 0
rgAmmo[ 4 ]: 0
rgAmmo[ 5 ]: 0
rgAmmo[ 6 ]: 0
rgAmmo[ 7 ]: 0
rgAmmo[ 8 ]: 0
rgAmmo[ 9 ]: 0
rgAmmo[ 10 ]: 0
rgAmmo[ 11 ]: 0
rgAmmo[ 12 ]: 0
rgAmmo[ 13 ]: 0
rgAmmo[ 14 ]: 0
rgAmmo[ 15 ]: 0
rgAmmo[ 16 ]: 0
rgAmmo[ 17 ]: 0
rgAmmo[ 18 ]: 0
rgAmmo[ 19 ]: 0
rgAmmo[ 20 ]: 0
rgAmmo[ 21 ]: 0
rgAmmo[ 22 ]: 0
rgAmmo[ 23 ]: 0
rgAmmo[ 24 ]: 0
rgAmmo[ 25 ]: 0
rgAmmo[ 26 ]: 0
rgAmmo[ 27 ]: 0
rgAmmo[ 28 ]: 0
rgAmmo[ 29 ]: 0
rgAmmo[ 30 ]: 0
rgAmmo[ 31 ]: 0
iEntityID: 108 | iClip: 15 | iAmmoType: 10 | iAmmo: 0 - 40 | iAdd: -5
Line: https://github.com/s1lentq/reapi/blob/master/reapi/src/reapi_utils.h#L137
I notice this, because this gives me an error with the WEAPON_KNIFE
for (new WeaponIdType: iWeaponID = WEAPON_P228, szName[32]; iWeaponID <= WEAPON_P90; iWeaponID++)
{
/* Ignore invalid weapons */
if (iWeaponID == WEAPON_GLOCK || iWeaponID == WEAPON_C4) continue;
/* Get the weapon name */
rg_get_weapon_info(iWeaponID, WI_NAME, szName, charsmax(szName));
/* Hook the weapon deploy */
RegisterHam(Ham_Item_Deploy, szName, "fw_Item_Deploy_Post", true);
}
All details in the plugin:
http://s000.tinyupload.com/index.php?file_id=33047781887617630396
Hi, I need to use
engfunc(EngFunc_GetAttachment, ent, 0, AttachmentOrigin, angles);
But I don't want to include fakemeta only for this function. Please add this.
Thank You.
This function doesn't work on ReGameDLL_CS due to a compatibility broke.
alliedmodders/amxmodx#278 (comment)
EDIT: i find how to hook it, delete the issue :D
RegisterHookChain(RG_CBasePlayer_HasRestrictItem, "clientOnBuyAttemp");
Since ReAPI already includes the function rg_find_ent_by_class and nothing (yet) for any other keyvalues, it makes me think - wouldn't it be better to have one function which would allow looking for any keyvalue?
By this, I mean something similar to fakemeta's EngFunc_FindEntityByString function, as in something like this:
rg_find_ent_by_keyvalue(start_index, const keyvalue[], const value[])
e.g.
rg_find_ent_by_keyvalue(-1, "targetname", "teleport1")
If not, would it be possible to add an equivalent function for all (most common) other keyvalues?
floatround(get_gametime() - get_member_game(m_iRoundTimeSecs), floatround_floor); --> -1 (in uint32)
floatround(get_gametime() - 105, floatround_floor); --> correct value!
when I print using
server_print("%d", get_member_game(m_iRoundTimeSecs))
I get result as 105 only.
Hello,
Is that possible to disable buying for one round only usind ReAPI ? I'm creating my custom Special round plugin where I want to disable BUYING when special round is going on.
Please let me know if possible.
Thanks!
DIFFERENCE BETWEEN WI_BUY_CLIP_SIZE & WI_GUN_CLIP_SIZE ?
Может быть стоит сменить тип данных, просто мне не понятно зачем значение float передавать?
Since ReGameDLL seems to break the functionality of Fakemeta's EngFunc_RunPlayerMove, would it be possible to add an equivalent function for controlling fakeplayers into ReAPI?
If not, is there some way to fix the original function?
Some extra information: Using EngFunc_RunPlayerMove works fine with the 'pure' version of ReGameDLL. However, using it with the 'bugfixed' version does not give any errors, but seems to effectively crash the fakeplayer, since it becomes unspectatable and after reconnecting it also appears as DEAD on the scoreboard.
The only one who works is VGUI_Menu_Buy_Item with the command "buyequip"
#include <amxmodx>
#include <reapi>
public plugin_init()
RegisterHookChain(RG_ShowVGUIMenu, "fw_ShowVGUIMenu");
public fw_ShowVGUIMenu( const iPlayerID, VGUIMenu: iMenu, const iBitsSlots, const szOldMenu[], const bool: bForceOldMenu )
{
client_print_color(iPlayerID, iPlayerID, "iMenu: %d | iBitsSlots: %d | szOldMenu: %s | bForceOldMenu: %d", iMenu, iBitsSlots, szOldMenu, bForceOldMenu)
}
OS Centos 6.8 final
ReHLDS version: 3.0.0.414-dev Bugfix
ReGameDLL version: 5.2.0.176-dev
ReAPI 5.1.0.103-dev
I see this module is awesome with useful functions, but where is the function that similar too ExecuteHam/ExecuteHamB?
In Hamsandwich module:
/**
* Executes the virtual function on the entity.
* Look at the Ham enum for parameter lists.
*
* @param function The function to call.
* @param id The id of the entity to execute it on.
*/
native ExecuteHam(Ham:function, this, any:...);
/**
* Executes the virtual function on the entity, this will trigger all hooks on that function.
* Be very careful about recursion!
* Look at the Ham enum for parameter lists.
*
* @param function The function to call.
* @param id The id of the entity to execute it on.
*/
native ExecuteHamB(Ham:function, this, any:...);
what are the values of inflictor in this hook ?
Also not related to this but please can there be HAM_DEPLOY implemented in ReAPI
Как можно будет менять параметры в хуке?
В Hamsandwich для этого есть нативы SetHamParam. Например, для изменения урона мы хукаем TakeDamage в pre и:
SetHamParamFloat(4,1337.0)
Can add this?
GetHookChainReturn возвращает 0 если жертва умер от последнего урона. Это является нормальным ? Или это баг?
I compile the module on the virtualbox (Ubuntu 16.04 LTS)
But i have an error on the dedicated server with the servers
[AMXX] Module "cstrike/addons/amxmodx/modules/reapi_amxx_i386.so" failed to load (./libstdc++.so.6: version `CXXABI_1.3.8' not found (required by cstrike/addons/amxmodx/modules/reapi_amxx_i386.so))
Новые нативы:
RadiusFlash
ShootTimed/ShootTimed2/ShootSmokeGrenade
ShootSatchelCharge
==============================
CGrenade members:
m_flC4Blow, m_flDefuseCountDown, m_bIsC4 etc..
==============================
Исправить:
/*
- Description: -
- Member type: struct RebuyStruct
- Get params: get_member(index, member);
- Set params: set_member(index, member, value);
*/
m_rebuyStruct,
/*
- Description: -
- Member type: struct RebuyStruct
- Get params: get_member(index, member, element);
- Set params: set_member(index, member, value, element);
*/
m_rebuyStruct,
If i use is_entity(0) it's return TRUE
Must fix in this line
reapi/reapi/src/natives/natives_misc.cpp
Line 1850 in 6508375
if (nIndex < 0 || nIndex > gpGlobals->maxEntities) {
to
if (nIndex < 1 || nIndex > gpGlobals->maxEntities) {
При отправки данных set_member и получение их, меняются данные на игроке, на клиенте же HUD не меняется, так задумано?
Так же при изменение hp через set_entvar(id,var_health,iHp+1.0),то при получение его через get_member(id,m_iClientHealth) не будет отображено добавленное, и опять же разные типы данных если через set_entvar то float, если через set_member то integer.
код для теста примитивный:
#include <amxmodx>
#include <cstrike>
#include <reapi>
public plugin_init() {
register_plugin("reapitest", "1", "111");
register_clcmd( "say /retest2", "retest2" )
}
public retest2(id)
{
cs_set_user_money(id,9999)
new Float:iHp = Float:get_entvar(id,var_health)
new Float:iArmor = Float:get_entvar(id,var_armorvalue)
set_entvar(id,var_health,iHp+1.0)
set_entvar(id,var_armorvalue,iArmor+1)
new iHp2 = get_member(id,m_iClientHealth)
client_print(id,print_console,"%d",iHp2)
set_member(id,m_iClientHealth,iHp2-15)
iHp2 = get_member(id,m_iClientHealth)
client_print(id,print_console,"%d",iHp2)
}
Any idea why not include compiled binary here? I cannot download from that site, it must register first and for sure failed as always.. IP bans everywhere..
This function is used on most servers, it would be good if it include in reapi too.
From engine module:
https://github.com/alliedmodders/amxmodx/blob/master/modules/engine/entity.cpp#L1531
Hello there.
I'm hacking into AMXModX code to make an ARM architecture support. In it's source code I found many scary hacks, like runtime function replacing, code in x86 opcodes(especially in hamsandwitch module) and so on.
It was actual back in these days, when ReGameDLL_CS and even CS16ND not existed, where original cs.so/mp.dll was the only implementation of Counter-Strike server library.
These hacks are platform-specific and obviously does not work on ARM. So I am asking, can this module, at least theoretically, provide methods from cstrike and hamsandwich modules with an extended API of ReGameDLL_CS?
Я ничего такого не употреблял, но хотелось бы работать с CBaseAnimating и иметь хук на CBasePlayer::SetAnimation :D
For use with RG_CBasePlayer_SetClientUserInfoModel and RG_CBasePlayer_SetClientUserInfoName
For my plugins (and I'm sure many other people's aswell), touch seems to be the single most hooked thing. However, since there seems to be no equivalent to it in ReAPI, that's often the only reason I also need to use an additional module.
Would it be possible to add a hookchain for touch?
If so, it would be preferred to do it similar to the engine way (allowing to register it for only a certain classname toucher and touched entity or * for all entities) since Touch gets triggered on every frame and for most cases this would likely be much more efficient. I do realize if it was done this way, it would probably need a separate function for registering the hookchain, since no arguments can be passed into the RegisterHookchain function.
When setting update_index to true rg_set_user_model glitches.
It does set the model however internally something is broken or overflowed. If you attempt to get the player model through (var/pev)_model you get random characters and they randomly change.
In the includes rg_reset_user_model does not contain the update_index argument yet the native in natives_misc.cpp seems to support it.
when you use RH_SV_DropClient function to change drop client reason:
SetHookChainArg(3, ATYPE_STRING, "I hope you enjoyed playing here.")
the drop client message will be: You have been diconnected from game.Reason: I hope you enjoyed playing here.
can you modify message to only using defined text (I hope you enjoyed playing here.) without You have been disconnected ... ?
Is it possible to block/replace host commands (https://github.com/dreamstalker/rehlds/blob/master/rehlds/engine/host_cmd.cpp#L2969)
using ReAPI?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.