Code Monkey home page Code Monkey logo

reapi's People

Contributors

afwn90cj93201nixr2e1re avatar aleeperezz16 avatar bionext03 avatar d3m37r4 avatar darthman avatar dystopm avatar etojuice avatar fant1kua avatar federicomb96 avatar fl0werd avatar francoromaniello avatar giferns avatar in-line avatar javekson avatar justgo97 avatar lopol2010 avatar nord1cwarr1or avatar ocixcrom avatar overl4y avatar raulitop avatar s008nyx avatar s1lentq avatar shadowsadi avatar smiteistrashbro avatar theasmodai avatar vaqtincha avatar wopox1337 avatar wpmgprostotema avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reapi's Issues

Issue with default weapon spawn

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.

[TYPO] natives_misc.cpp

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 },
..
..
..

msvc compiler crash

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)

Fix rg_send_bartime

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

Add Cvar_init

Can we have RH_Cvar_Init like RH_Cvar_DirectSet so we can hook it and do changes there and ty.

How block change name?

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;
}

[Предложение] FireBullets3 и RadiusDamage

Нужно API для вызова следующих функций:

  • FireBullets
  • RadiusDamage
  • ApplyMultiDamage
  • ClearMultiDamage

Пример в 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)

WEAPON RESTRICTION PLUGIN REQUEST

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 hook crashes server when suicide

RG_BuyGunAmmo returned wrong value

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

don't move, when var_velocity modified.

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)
}

Original: http://1337.uz/download/plugins/sf_multijump.sma

[Предложение] Добавить функции

Не помешало бы API для след. функций:

  1. rg_is_valid_ent
  2. rg_find_ent_in_sphere
  3. deploy weapon (пример Ham_Item_Deploy)
  4. emit sound (пример FM_EmitSound)
  5. voice client listening (пример FM_Voice_SetClientListening) - чтобы вызывалось, когда нажата именно клавиша микрофона.
  6. is_hull_vacant - возможность перемещения игрока в заданные координаты.
  7. Выполнить функцию (пример ExecuteHamB)

m_rgAmmo on ItemPostFrame

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

Question: why the knife is set as invalid index with rg_get_weapon_info?

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);
	}

Add/Edit rg_find_ent_by_keyvalue

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?

Issue with floatround parsing of get_member_game

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.

Disable buying for 1 round.

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!

Member type: var_frags Float -> Integer

Может быть стоит сменить тип данных, просто мне не понятно зачем значение float передавать?

Add EngFunc_RunPlayerMove equivalent

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.

RG_ShowVGUIMenu doesn't work with the buys menu

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)
}

IMG: http://imgur.com/a/ZsNeA

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

[Request] Call function just like in Hamsandwich (ExecuteHam/ExecuteHamB).

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:...);

RG_CSGameRules_DeathNotice

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)

[question] GetHookChainReturn в TakeDamage

GetHookChainReturn возвращает 0 если жертва умер от последнего урона. Это является нормальным ? Или это баг?

How to compile the module?

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))

[Request] Natives

Новые нативы:

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,

Fix is_entity

If i use is_entity(0) it's return TRUE

Must fix in this line

if (nIndex < 0 || nIndex > gpGlobals->maxEntities) {

if (nIndex < 0 || nIndex > gpGlobals->maxEntities) {

to

if (nIndex < 1 || nIndex > gpGlobals->maxEntities) {

m_iClientHealth & m_iAccount no HUD update on client

При отправки данных 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) 
}

[Question] Can ReAPI potentially replace cstrike and hamsandwich modules?

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

Я ничего такого не употреблял, но хотелось бы работать с CBaseAnimating и иметь хук на CBasePlayer::SetAnimation :D

Add a hookchain for Touch

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.

rg_set_user_model update_index

  1. 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.

  2. 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.

[Suggestion] RH_SV_DropClient Reason Format

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 ... ?

@s1lentq

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.