Page 1 of 1

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:

  1. ze_breakhint_mode 2                // Breakable Hint Message mode (0 = Disabled | 1 = Text Message | 2 = HUD | 3 = DHUD).
  2. ze_breakhint_hud_rand_colors 1     // Breakable Hint Message HUD random colors (1 = Enabled | 0 = Disabled).
  3. ze_breakhint_hud_red 0             // Breakable Hint Message HUD Red color (0..255).
  4. ze_breakhint_hud_green 200         // Breakable Hint Message HUD Green color (0..255).
  5. ze_breakhint_hud_blue 0            // Breakable Hint Message HUD Blue color (0..255).
  6. ze_breakhint_distance "500.0"      // Required distance to detect Breakable entity (0.0 = Distance exceeded)

Installation & Instructions:

  • Simply install it like any plugin.

  • Copy this translation key and put it in zombie_escape.txt in section [en]

Translation Key:

  1. MSG_BREAK_HINT = "You can break this Entity!"

Changelog:

  • Spoiler!

    Version: 1.0

    • First Release.

    Version: 1.1

    • Optimization: Code optimized to use ReAPI engine functions.

    Version: 1.2 [Current Version]

    • Fix bug: Ignoring entities that have a spawnflag: '1' (TRIGGER ONLY)

    • Optimization: Optimize code with ReAPI functions.

    • Addition: Add new Cvars for HUD colors + random colors.

    • Addition: Add new HUD type "Director HUD / Text Message".

    • Improvement: Add translation key 'MSG_BREAK_HINT'.

    • Removal: Delete mode "Chat".

Screenshots:

  • Text Message (print_center)
    Text Message (print_center)
    HUD
    HUD
    DHUD
    DHUD

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 Night Fury
czirimbolo wrote: 5 years 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

Re: Breakable Hint

Posted: 02 Sep 2018, 17:38
by th3_king
There is a problem with print_chat in this plugin Hint Break, and It causes problems to players game also in other servers it appears at map changes ... so please fix it.

Re: Breakable Hint

Posted: 03 Sep 2018, 13:19
by Raheem
Try:
    1. #include <zombie_escape>
    2.  
    3. // Defines
    4. #define AIMTASK 500
    5.  
    6. // Cvars
    7. new cvar_message_type
    8.  
    9. public plugin_init()
    10. {
    11.     register_plugin("[ZE] Breakable Hint", "1.2", "Raheem")
    12.    
    13.     // Cvars
    14.     cvar_message_type = register_cvar("ze_break_hint_type", "1")
    15.    
    16.     // Tasks
    17.     set_task(0.5, "Check_AimTask", AIMTASK, _, _, "b")
    18. }
    19.  
    20. public Check_AimTask()
    21. {
    22.     if (get_pcvar_num(cvar_message_type) == 0)
    23.     {
    24.         remove_task(AIMTASK, 0)
    25.         return
    26.     }
    27.    
    28.     for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
    29.     {
    30.         if (!is_user_alive(id))
    31.             continue
    32.        
    33.         new iEntIndex, iBody
    34.         get_user_aiming(id, iEntIndex, iBody)
    35.        
    36.         if(pev_valid(iEntIndex) && !is_user_connected(iEntIndex))
    37.         {
    38.             new szClassName[32], iHealth
    39.            
    40.             iHealth = floatround(get_entvar(iEntIndex, var_health))
    41.            
    42.             get_entvar(iEntIndex, var_classname, szClassName, charsmax(szClassName))
    43.            
    44.             if(equal(szClassName, "func_breakable"))
    45.             {
    46.                 if (get_pcvar_num(cvar_message_type) == 1)
    47.                 {
    48.                     set_hudmessage(random(256), random(256), random(256), 0.1, -0.3, 2, 2.0, 2.0)
    49.                     show_hudmessage(id, "[Hint] You can break this Entity!^n Health: %i", iHealth)
    50.                 }
    51.                 else if (get_pcvar_num(cvar_message_type) == 2)
    52.                 {
    53.                     static szMessage[64]
    54.                     formatex(szMessage, charsmax(szMessage), "[Hint] You can break this Entity!^n Health: %i", iHealth)
    55.                    
    56.                     engclient_print(id, engprint_center, szMessage)
    57.                 }
    58.             }
    59.         }
    60.     }
    61. }

Re: Breakable Hint

Posted: 31 Jul 2019, 08:10
by tmv
Raheem wrote: 5 years ago Try:
    1. #include <zombie_escape>
    2.  
    3. // Defines
    4. #define AIMTASK 500
    5.  
    6. // Cvars
    7. new cvar_message_type
    8.  
    9. public plugin_init()
    10. {
    11.     register_plugin("[ZE] Breakable Hint", "1.2", "Raheem")
    12.    
    13.     // Cvars
    14.     cvar_message_type = register_cvar("ze_break_hint_type", "1")
    15.    
    16.     // Tasks
    17.     set_task(0.5, "Check_AimTask", AIMTASK, _, _, "b")
    18. }
    19.  
    20. public Check_AimTask()
    21. {
    22.     if (get_pcvar_num(cvar_message_type) == 0)
    23.     {
    24.         remove_task(AIMTASK, 0)
    25.         return
    26.     }
    27.    
    28.     for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
    29.     {
    30.         if (!is_user_alive(id))
    31.             continue
    32.        
    33.         new iEntIndex, iBody
    34.         get_user_aiming(id, iEntIndex, iBody)
    35.        
    36.         if(pev_valid(iEntIndex) && !is_user_connected(iEntIndex))
    37.         {
    38.             new szClassName[32], iHealth
    39.            
    40.             iHealth = floatround(get_entvar(iEntIndex, var_health))
    41.            
    42.             get_entvar(iEntIndex, var_classname, szClassName, charsmax(szClassName))
    43.            
    44.             if(equal(szClassName, "func_breakable"))
    45.             {
    46.                 if (get_pcvar_num(cvar_message_type) == 1)
    47.                 {
    48.                     set_hudmessage(random(256), random(256), random(256), 0.1, -0.3, 2, 2.0, 2.0)
    49.                     show_hudmessage(id, "[Hint] You can break this Entity!^n Health: %i", iHealth)
    50.                 }
    51.                 else if (get_pcvar_num(cvar_message_type) == 2)
    52.                 {
    53.                     static szMessage[64]
    54.                     formatex(szMessage, charsmax(szMessage), "[Hint] You can break this Entity!^n Health: %i", iHealth)
    55.                    
    56.                     engclient_print(id, engprint_center, szMessage)
    57.                 }
    58.             }
    59.         }
    60.     }
    61. }
Not Fixed
Can be seen Breakable Hint print_chat in other servers

Re: Breakable Hint

Posted: 31 Jul 2019, 11:20
by Raheem
Got idea, to send empty message as a reset, TRY:
    1. #include <zombie_escape>
    2.  
    3. // Defines
    4. #define AIMTASK 500
    5.  
    6. // Cvars
    7. new cvar_message_type
    8.  
    9. public plugin_init()
    10. {
    11.     register_plugin("[ZE] Breakable Hint", "1.2", "Raheem")
    12.    
    13.     // Cvars
    14.     cvar_message_type = register_cvar("ze_break_hint_type", "1")
    15.    
    16.     // Tasks
    17.     set_task(0.5, "Check_AimTask", AIMTASK, _, _, "b")
    18. }
    19.  
    20. public Check_AimTask()
    21. {
    22.     if (get_pcvar_num(cvar_message_type) == 0)
    23.     {
    24.         remove_task(AIMTASK, 0)
    25.         return
    26.     }
    27.    
    28.     for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
    29.     {
    30.         if (!is_user_alive(id))
    31.             continue
    32.        
    33.         new iEntIndex, iBody
    34.         get_user_aiming(id, iEntIndex, iBody)
    35.        
    36.         if(pev_valid(iEntIndex) && !is_user_connected(iEntIndex))
    37.         {
    38.             new szClassName[32], iHealth
    39.            
    40.             iHealth = floatround(get_entvar(iEntIndex, var_health))
    41.            
    42.             get_entvar(iEntIndex, var_classname, szClassName, charsmax(szClassName))
    43.            
    44.             if(equal(szClassName, "func_breakable"))
    45.             {
    46.                 if (get_pcvar_num(cvar_message_type) == 1)
    47.                 {
    48.                     set_hudmessage(random(256), random(256), random(256), 0.1, -0.3, 2, 2.0, 2.0)
    49.                     show_hudmessage(id, "[Hint] You can break this Entity!^n Health: %i", iHealth)
    50.                 }
    51.                 else if (get_pcvar_num(cvar_message_type) == 2)
    52.                 {
    53.                     static szMessage[64]
    54.                     formatex(szMessage, charsmax(szMessage), "[Hint] You can break this Entity!^n Health: %i", iHealth)
    55.                    
    56.                     engclient_print(id, engprint_center, szMessage)
    57.                    
    58.                     set_task(0.5, "Reset", id)
    59.                 }
    60.             }
    61.         }
    62.     }
    63. }
    64.  
    65. public Reset(id)
    66. {
    67.     engclient_print(id, engprint_center, "")
    68. }

Re: Breakable Hint

Posted: 31 Jul 2019, 13:58
by tmv
Unfortunately it didn't work
The moment when this message appears I connect to another server and the message is still there in the new server. Could it be bug of cs 1.6?

Re: Breakable Hint

Posted: 31 Jul 2019, 14:12
by Raheem
tmv wrote: 4 years ago Unfortunately it didn't work
The moment when this message appears I connect to another server and the message is still there in the new server. Could it be bug of cs 1.6?
The issue in engclient_print(id, engprint_center, szMessage), i'm using it so i be able to go to new line with ^n, it seems like this message is saved in game cache, if player disconnected then out of game and enter again it disappears, but for now try this:

  1. #include <zombie_escape>
  2.  
  3. // Defines
  4. #define AIMTASK 500
  5.  
  6. // Cvars
  7. new cvar_message_type
  8.  
  9. public plugin_init()
  10. {
  11.     register_plugin("[ZE] Breakable Hint", "1.2", "Raheem")
  12.    
  13.     // Cvars
  14.     cvar_message_type = register_cvar("ze_break_hint_type", "1")
  15.    
  16.     // Tasks
  17.     set_task(0.5, "Check_AimTask", AIMTASK, _, _, "b")
  18. }
  19.  
  20. public Check_AimTask()
  21. {
  22.     if (get_pcvar_num(cvar_message_type) == 0)
  23.     {
  24.         remove_task(AIMTASK, 0)
  25.         return
  26.     }
  27.    
  28.     for (new id = 1; id <= get_member_game(m_nMaxPlayers); id++)
  29.     {
  30.         if (!is_user_alive(id))
  31.             continue
  32.        
  33.         new iEntIndex, iBody
  34.         get_user_aiming(id, iEntIndex, iBody)
  35.        
  36.         if(pev_valid(iEntIndex) && !is_user_connected(iEntIndex))
  37.         {
  38.             new szClassName[32], iHealth
  39.            
  40.             iHealth = floatround(get_entvar(iEntIndex, var_health))
  41.            
  42.             get_entvar(iEntIndex, var_classname, szClassName, charsmax(szClassName))
  43.            
  44.             if(equal(szClassName, "func_breakable"))
  45.             {
  46.                 if (get_pcvar_num(cvar_message_type) == 1)
  47.                 {
  48.                     set_hudmessage(random(256), random(256), random(256), 0.1, -0.3, 2, 2.0, 2.0)
  49.                     show_hudmessage(id, "[Hint] You can break this Entity!^n Health: %i", iHealth)
  50.                 }
  51.                 else if (get_pcvar_num(cvar_message_type) == 2)
  52.                 {
  53.                     static szMessage[64]
  54.                     formatex(szMessage, charsmax(szMessage), "[Hint] You can break this Entity!^n Health: %i", iHealth)
  55.                    
  56.                     engfunc(EngFunc_ClientPrintf, id, engprint_center, szMessage)
  57.                 }
  58.             }
  59.         }
  60.     }
  61. }
  62.  
  63. public client_disconnected(id)
  64. {
  65.     engfunc(EngFunc_ClientPrintf, id, engprint_center, "")
  66. }

I tried here reset in player disconnect, if not worked then you will need to use client_print(id, print_center, "") but in this you can't go to new line, it's only one line.

Re: Breakable Hint

Posted: 22 Feb 2024, 00:51
by z0h1r-LK

Updated v1.2