Approved Breakable Hint

Gameplay Addons
User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

Breakable Hint

#1

Post by Raheem » 2 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:
  • 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:
You don't know? Learn and you will know.

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#2

Post by Raheem » 2 Years Ago

New version available: 1.1
You don't know? Learn and you will know.

User avatar
ArminC
Senior Member
Senior Member
Romania
Posts: 137
Joined: 1 Year Ago
Location: Bucharest
Has thanked: 0
Been thanked: 2 times
Age: 17
Contact:

#3

Post by ArminC » 1 Year 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: 533
Joined: 2 Years Ago
Has thanked: 19 times
Been thanked: 1 time
Contact:

#4

Post by czirimbolo » 1 Year 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
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#5

Post by Raheem » 1 Year 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 on 06 Aug 2018, 11:35, edited 1 time in total.
Reason: Removed engine include, Fixed new line message, Added screenshots
You don't know? Learn and you will know.

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 533
Joined: 2 Years Ago
Has thanked: 19 times
Been thanked: 1 time
Contact:

#6

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

User avatar
Mohamed Alaa
Mod Developer
Mod Developer
Egypt
Posts: 622
Joined: 2 Years Ago
Location: Egypt
Has thanked: 34 times
Been thanked: 48 times
Age: 19
Contact:

#7

Post by Mohamed Alaa » 1 Year Ago

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>
Want your own mod edition? PM me.
Accepting web projects.
CS 1.6 hosting: powergamingtech.com

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 533
Joined: 2 Years Ago
Has thanked: 19 times
Been thanked: 1 time
Contact:

#8

Post by czirimbolo » 1 Year Ago

Compiled but dont see HP of entity
Image

User avatar
Raheem
Mod Developer
Mod Developer
Egypt
Posts: 1972
Joined: 2 Years Ago
Location: Egypt
Has thanked: 32 times
Been thanked: 108 times
Age: 22
Contact:

#9

Post by Raheem » 1 Year Ago

Please try now, updated the post.
You don't know? Learn and you will know.

czirimbolo
Veteran Member
Veteran Member
Poland
Posts: 533
Joined: 2 Years Ago
Has thanked: 19 times
Been thanked: 1 time
Contact:

#10

Post by czirimbolo » 1 Year Ago

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

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests