Approved Breakable Hint

Gameplay Addons


Post Reply
User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

Breakable Hint

#1

Post by Raheem » 6 years ago

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:

He who fails to plan is planning to fail

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#2

Post by Raheem » 6 years ago

New version available: 1.1
He who fails to plan is planning to fail

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 6 years ago
Location: Bucharest
Contact:

#3

Post by ArminC » 6 years ago

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

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#4

Post by czirimbolo » 5 years ago

I would like to see HP of Entity when I aim to it. Is it possible to make it Raheem?
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#5

Post by Raheem » 5 years ago

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
Last edited by Raheem 5 years ago, edited 1 time in total.
Reason: Removed engine include, Fixed new line message, Added screenshots
He who fails to plan is planning to fail

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#6

Post by czirimbolo » 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
// ----------------------------------------
Image

User avatar
Night Fury
Mod Developer
Mod Developer
Posts: 677
Joined: 7 years ago
Contact:

#7

Post by Night Fury » 5 years ago

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>
Want your own mod edition? PM me.
Accepting private projects.
Discord: Fury#7469
Image

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#8

Post by czirimbolo » 5 years ago

Compiled but dont see HP of entity
Image

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#9

Post by Raheem » 5 years ago

Please try now, updated the post.
He who fails to plan is planning to fail

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 598
Joined: 7 years ago
Contact:

#10

Post by czirimbolo » 5 years ago

ze_break_hint_type 2 in cfg. and its working like on screens. THanks
Image

User avatar
th3_king
VIP
VIP
Egypt
Posts: 35
Joined: 6 years ago
Location: Egypt
Contact:

#11

Post by th3_king » 5 years ago

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.

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#12

Post by Raheem » 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. }
He who fails to plan is planning to fail

User avatar
tmv
Member
Member
Russia
Posts: 36
Joined: 4 years ago
Contact:

#13

Post by tmv » 4 years ago

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

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#14

Post by Raheem » 4 years ago

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. }
He who fails to plan is planning to fail

User avatar
tmv
Member
Member
Russia
Posts: 36
Joined: 4 years ago
Contact:

#15

Post by tmv » 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?

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#16

Post by Raheem » 4 years ago

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.
He who fails to plan is planning to fail

User avatar
z0h1r-LK
Mod Developer
Mod Developer
Morocco
Posts: 473
Joined: 5 years ago
Location: The Red City ❤
Contact:

#17

Post by z0h1r-LK » 1 month ago

Updated v1.2


Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 5 guests