Raised This Month: $32 Target: $400
 8% 

Breakable things


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ArminC
Senior Member
Join Date: Apr 2016
Old 02-01-2018 , 06:01   Breakable things
Reply With Quote #1

So this can show you wich entity is breakable like wood ramp, or some box.. but this is showing the Bomb Site Green boxes (https://www.johnsto.co.uk/i/design/m...alpha_b_01.jpg) that are breakable but in fact they are only by the C4/RPG. Can you make an ignore for these type of entitiy?

HTML Code:
#include <amxmodx>
#include <engine>
#include <reapi>

// Defines
#define AIMTASK 500

// Cvars
new cvar_message_type

public plugin_init()
{
	register_plugin("Breakable Hint", "1.1", "Raheem")
	
	// Cvars
	cvar_message_type = register_cvar("break_hint_type", "2")
	
	// Tasks
	set_task(0.5, "Check_AimTask", AIMTASK, _, _, "b")
}

public Check_AimTask()
{
	if (get_pcvar_num(cvar_message_type) == 0)
	{
		remove_task(AIMTASK, 0)
		return
	}
	
	for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
	{
		if (!is_user_alive(id))
			continue
		
		new iEntIndex, iBody
		get_user_aiming(id, iEntIndex, iBody)
		
		if(is_valid_ent(iEntIndex) && !is_user_connected(iEntIndex))
		{
			new szClassName[32]
			
			get_entvar(iEntIndex, var_classname, szClassName, charsmax(szClassName))
			
			if(equal(szClassName, "func_breakable"))
			{
				if (get_pcvar_num(cvar_message_type) == 1)
				{
					set_hudmessage(random(256), random(256), random(256), 0.1, -0.3, 2, 2.0, 2.0)
					show_hudmessage(id, "You can break this entity!")
				}
				else if (get_pcvar_num(cvar_message_type) == 2)
				{
					client_print(id, print_center, "You can break this entity!")
				}
			}
		}
	}
}
ArminC is offline
ArminC
Senior Member
Join Date: Apr 2016
Old 02-04-2018 , 07:33   Re: Breakable things
Reply With Quote #2

Bump!?
ArminC is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-04-2018 , 08:06   Re: Breakable things
Reply With Quote #3

Instead of
PHP Code:
if(equal(szClassName"func_breakable")) 
put
PHP Code:
if(equal(szClassName"func_breakable") && !(entity_get_int(iEntIndexEV_INT_flags) & SF_BREAK_TRIGGER_ONLY)) 
Also what's the reason for using get_entvar()? I don't get this madness lately with people unnecessarily using ReAPI.
__________________
klippy is offline
ArminC
Senior Member
Join Date: Apr 2016
Old 02-04-2018 , 08:10   Re: Breakable things
Reply With Quote #4

Thanks, it's not my plugin.. was edited at my request at a Forum that use often ReHLDS&ReAPI.. Is there any efficency problem or is that you don't like so much ReAPI ?
ArminC is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-04-2018 , 09:36   Re: Breakable things
Reply With Quote #5

The problem is that there are 2 existing ways in AMXX that do the exact same thing, just as fast, and someone chooses to use something that not everybody has on their server.
__________________
klippy is offline
ArminC
Senior Member
Join Date: Apr 2016
Old 02-04-2018 , 11:51   Re: Breakable things
Reply With Quote #6

@KliPPy I tested it and still show at BombSite Green Box that they are breakable :\
ArminC is offline
ArminC
Senior Member
Join Date: Apr 2016
Old 02-07-2018 , 07:18   Re: Breakable things
Reply With Quote #7

Bump?!
ArminC is offline
ArminC
Senior Member
Join Date: Apr 2016
Old 02-26-2018 , 10:20   Re: Breakable things
Reply With Quote #8

up!
ArminC is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 05-11-2022 , 14:16   Re: Breakable things
Reply With Quote #9

3 years later, but fixing the wrong solution.

It is spawnflags, not flags
PHP Code:
if(equal(szClassName"func_breakable") && !(entity_get_int(iEntIndexEV_INT_spawnflags) & SF_BREAK_TRIGGER_ONLY)) 

Last edited by baneado; 05-11-2022 at 14:16.
baneado is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:34.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode