reapi icon indicating copy to clipboard operation
reapi copied to clipboard

rg_remove_item

Open JUNESYNGOTOFLEX opened this issue 2 years ago • 7 comments

Made a simple plugin for my server (on new round, remove players HE-nades on small maps)

#include <amxmodx>
#include <reapi>

public plugin_init()
{
	if (strcmp(MapName, "$2000") == 0 || containi(MapName, "fy_") != -1) {
		RegisterHookChain(RG_CBasePlayer_OnSpawnEquip, "CBasePlayer_OnSpawnEquip", true);
	}
	else {
		pause("ad");
	}
}

public CBasePlayer_OnSpawnEquip(id)
{
	if (rg_remove_item(id, "weapon_hegrenade"))
	{
		client_print(id, print_center, "*** Balance: Your HE was removed ***");
	}
}

Works fine but got a problem: after the item is removed from the player's inventory, he can no longer pick it up (armoury_entity, weaponbox) until he dies.

Would do you think about RemovePlayerItemEx?

JUNESYNGOTOFLEX avatar Mar 19 '22 10:03 JUNESYNGOTOFLEX

Try to use rg_remove_items_by_slot

ShadowsAdi avatar Mar 19 '22 10:03 ShadowsAdi

Try to use rg_remove_items_by_slot

i want to save flash smoke

JUNESYNGOTOFLEX avatar Mar 19 '22 12:03 JUNESYNGOTOFLEX

This fixes it, but devs did not get it, & the PR became too loud now, it emits "snore" sounds! @JUNESYNGOTOFLEX: Set second parameter (removeAmmo) of "rg_remove_item" to true to enforce ammo clean up & fix issue.

StevenKal avatar Mar 19 '22 13:03 StevenKal

This fixes it, but devs did not get it, & the PR became too loud now, it emits "snore" sounds! @JUNESYNGOTOFLEX: Set second parameter (removeAmmo) of "rg_remove_item" to true to enforce ammo clean up & fix issue.

no, i tried this too

JUNESYNGOTOFLEX avatar Mar 19 '22 13:03 JUNESYNGOTOFLEX

Did you tried that? rg_remove_item(id, "weapon_hegrenade", true)

Are you sure? Because it should fix the pick up & avoid the "You already have that item" (or "You can not carry anymore!") when trying to buy.

StevenKal avatar Mar 19 '22 13:03 StevenKal

"rg_remove_item(id, "weapon_hegrenade", true)" ? Are you sure? Because it should fix the pick up & avoid the "You already have that item" when trying to buy.

my bad, sorry, fixed

JUNESYNGOTOFLEX avatar Mar 19 '22 15:03 JUNESYNGOTOFLEX

Why not just find all the entities on the ground that are flashes and remove them? Save yourself the event calls.

deprale avatar Sep 04 '22 10:09 deprale

Try to use RG_CBasePlayer_HasRestrictItem, do the same job

SmileYzn avatar Jan 05 '23 11:01 SmileYzn

"Finally fixed here: https://github.com/s1lentq/ReGameDLL_CS/commit/d7b44099e763d2ed8784cc68b86f84c9a65ad539

Now, if removeAmmo = true, it will remove the item and its entire stock. If removeAmmo = false, then for grenades, it will remove one stock at a time, and if there is only one stock left, it will remove the grenade entirely."

After this fix, you will now be able to pick up or purchase additional grenades after deletion

Javekson avatar Oct 04 '23 11:10 Javekson

Closed as fixed #864

s1lentq avatar Oct 07 '23 15:10 s1lentq