Page 1 of 2

Breakable Hint

Posted: 21 Jun 2017, 21:36
by Raheem
Breakable Hint

Description:
  • This plugin will print a hint when you aim at breakable entity tell you that you can break it. This may help in new maps and new players who don't know about maps. Idea suggested by sammy6369 so thanks to him.
Cvars:
  • ze_break_hint_type 1 0 = Disabled | 1 = Hud | 2 = Chat
Installation & Instructions:
  • Simply install it like any plugin.
Changelog:
  • Spoiler!
    Version: 1.0
    • First Release.
    Version: 1.1 [Current Version]
    • Code optimized to use ReAPI engine functions.
Screenshots:
  • ImageImage
Downloads:

Re: Breakable Hint

Posted: 29 Jul 2017, 05:38
by Raheem
New version available: 1.1

Re: Breakable Hint

Posted: 29 Jan 2018, 20:36
by ArminC
For normal mod (or other):

Code: Select all

#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", "1")
	
	// 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!")
				}
			}
		}
	}
}

Re: Breakable Hint

Posted: 03 Aug 2018, 13:49
by czirimbolo
I would like to see HP of Entity when I aim to it. Is it possible to make it Raheem?

Re: Breakable Hint

Posted: 03 Aug 2018, 14:21
by Raheem
Here it's (I consider this a new version 1.2, i'll update main post soon):
  • Code: Select all

    #include <zombie_escape>
    
    // Defines
    #define AIMTASK 500
    
    // Cvars
    new cvar_message_type
    
    public plugin_init()
    {
    	register_plugin("[ZE] Breakable Hint", "1.2", "Raheem")
    	
    	// Cvars
    	cvar_message_type = register_cvar("ze_break_hint_type", "1")
    	
    	// 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(pev_valid(iEntIndex) && !is_user_connected(iEntIndex))
    		{
    			new szClassName[32], iHealth
    			
    			iHealth = floatround(get_entvar(iEntIndex, var_health))
    			
    			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, "[Hint] You can break this Entity!^n Health: %i", iHealth)
    				}
    				else if (get_pcvar_num(cvar_message_type) == 2)
    				{
    					static szMessage[64]
    					formatex(szMessage, charsmax(szMessage), "[Hint] You can break this Entity!^n Health: %i", iHealth)
    					
    					engfunc(EngFunc_ClientPrintf, id, engprint_center, szMessage)
    				}
    			}
    		}
    	}
    }
Screenshots:
  • hint-1.png
  • hint-2.png

Re: Breakable Hint

Posted: 05 Aug 2018, 18:52
by czirimbolo
I cant compile:

//// ze_breakable_hint.sma
//
// C:\Users\macie\Desktop\Compiler v1.8.3\scripting\ze_breakable_hint.sma(36) : error 017: undefined symbol "is_valid_ent"
//
// 1 Error.
// Could not locate output file compiled\ze_breakable_hint.amx (compile failed).
//
// Compilation Time: 0,75 sec
// ----------------------------------------

Re: Breakable Hint

Posted: 05 Aug 2018, 19:35
by Mohamed Alaa
czirimbolo wrote:
1 Year Ago
I cant compile:

//// ze_breakable_hint.sma
//
// C:\Users\macie\Desktop\Compiler v1.8.3\scripting\ze_breakable_hint.sma(36) : error 017: undefined symbol "is_valid_ent"
//
// 1 Error.
// Could not locate output file compiled\ze_breakable_hint.amx (compile failed).
//
// Compilation Time: 0,75 sec
// ----------------------------------------
Add

Code: Select all

#include <engine>

Re: Breakable Hint

Posted: 05 Aug 2018, 20:16
by czirimbolo
Compiled but dont see HP of entity

Re: Breakable Hint

Posted: 06 Aug 2018, 11:36
by Raheem
Please try now, updated the post.

Re: Breakable Hint

Posted: 06 Aug 2018, 20:59
by czirimbolo
ze_break_hint_type 2 in cfg. and its working like on screens. THanks