Raised This Month: $140 Target: $400
 35% 

type player name in chat when he is on a breakable entity.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Obada8
Junior Member
Join Date: May 2016
Old 08-12-2018 , 13:13   type player name in chat when he is on a breakable entity.
Reply With Quote #1

Hi guys, i need to detect a player who walk on a breakable entity and the output is a chat type his name.

For example:

If player walk on a breakable then the chat output is: PlayerName is on a breakable. and if he got a way from it chat msg said: PlayerName is away from breakable.

Thanks.
Obada8 is offline
Ghosted
Senior Member
Join Date: Apr 2015
Location: Georgia
Old 08-12-2018 , 13:24   Re: type player name in chat when he is on a breakable entity.
Reply With Quote #2

Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

#define BREAKABLE_KEY_OFFSET EV_INT_bInDuck
new const BREAKABLE_KEY = -581932; // random number for increase performance in check

new bool:PlayerTouchingBreakable[33];

public plugin_init()
{
	RegisterHam(Ham_Spawn, "func_breakable", "Ham_BreakableSpawn_Post", 1);
}

public Ham_BreakableSpawn_Post(EntityID)
{
	entity_set_int(EntityID, BREAKABLE_KEY_OFFSET, BREAKABLE_KEY);
}

public client_PreThink(PlayerID)
{
	if (!is_user_alive(PlayerID))
		return;
	
	static GroundEntity;
	
	if ((GroundEntity = entity_get_edict(PlayerID, EV_ENT_groundentity)) <= 0)
		return;
	
	if (entity_get_int(GroundEntity, BREAKABLE_KEY_OFFSET) != BREAKABLE_KEY)
	{
		if (PlayerTouchingBreakable[PlayerID])
			PlayerTouchingBreakable[PlayerID] = false;
		
		return;
	}
	
	if (!PlayerTouchingBreakable[PlayerID])
	{
		PlayerTouchingBreakable[PlayerID];
		// Touched, your code here...
	}
}
Not tested
__________________

[MOD] CS Weapon Mod V1.6 (100%) [Next Update - 6%]
[MOD]
CS NPC Mod (8%) [Paused]
[APP] Visual Plugin Studio (27%)
[MM]
Lua Engine (37%)

Donate
Ghosted is offline
Obada8
Junior Member
Join Date: May 2016
Old 08-13-2018 , 10:30   Re: type player name in chat when he is on a breakable entity.
Reply With Quote #3

Thanks, i'll test this, but how you know that bro?

Can you tell me?
Obada8 is offline
Obada8
Junior Member
Join Date: May 2016
Old 08-13-2018 , 10:43   Re: type player name in chat when he is on a breakable entity.
Reply With Quote #4

Not work bro
Obada8 is offline
Ghosted
Senior Member
Join Date: Apr 2015
Location: Georgia
Old 08-13-2018 , 11:24   Re: type player name in chat when he is on a breakable entity.
Reply With Quote #5

Quote:
Originally Posted by Obada8 View Post
Not work bro
Don't tell me that you haven't added anything in that code
__________________

[MOD] CS Weapon Mod V1.6 (100%) [Next Update - 6%]
[MOD]
CS NPC Mod (8%) [Paused]
[APP] Visual Plugin Studio (27%)
[MM]
Lua Engine (37%)

Donate
Ghosted is offline
Obada8
Junior Member
Join Date: May 2016
Old 08-13-2018 , 15:08   Re: type player name in chat when he is on a breakable entity.
Reply With Quote #6

Quote:
Originally Posted by Ghosted View Post
Don't tell me that you haven't added anything in that code
I do this,,,,

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <engine>

#define BREAKABLE_KEY_OFFSET EV_INT_bInDuck
new const BREAKABLE_KEY = -581932// random number for increase performance in check

new bool:PlayerTouchingBreakable[33];

public 
plugin_init()
{
    
RegisterHam(Ham_Spawn"func_breakable""Ham_BreakableSpawn_Post"1);
}

public 
Ham_BreakableSpawn_Post(EntityID)
{
    
entity_set_int(EntityIDBREAKABLE_KEY_OFFSETBREAKABLE_KEY);
}

public 
client_PreThink(PlayerID)
{
    if (!
is_user_alive(PlayerID))
        return;
    
    static 
GroundEntity;
    
    if ((
GroundEntity entity_get_edict(PlayerIDEV_ENT_groundentity)) <= 0)
        return;
    
    if (
entity_get_int(GroundEntityBREAKABLE_KEY_OFFSET) != BREAKABLE_KEY)
    {
        if (
PlayerTouchingBreakable[PlayerID])
            
PlayerTouchingBreakable[PlayerID] = false;
        
        return;
    }
    
    if (!
PlayerTouchingBreakable[PlayerID])
    {
        
PlayerTouchingBreakable[PlayerID];
        
client_print(idprint_chat"You touched breakable!")
    }

But the message didn't appear.

Last edited by Obada8; 08-13-2018 at 15:09.
Obada8 is offline
Ghosted
Senior Member
Join Date: Apr 2015
Location: Georgia
Old 08-13-2018 , 15:37   Re: type player name in chat when he is on a breakable entity.
Reply With Quote #7

Quote:
Originally Posted by Obada8 View Post
But the message didn't appear.
Ehm, an uncompillable code?

Code:
client_print(id, print_chat, "You touched breakable!")
__________________

[MOD] CS Weapon Mod V1.6 (100%) [Next Update - 6%]
[MOD]
CS NPC Mod (8%) [Paused]
[APP] Visual Plugin Studio (27%)
[MM]
Lua Engine (37%)

Donate

Last edited by Ghosted; 08-13-2018 at 15:38.
Ghosted is offline
Obada8
Junior Member
Join Date: May 2016
Old 08-13-2018 , 18:29   Re: type player name in chat when he is on a breakable entity.
Reply With Quote #8

Quote:
Originally Posted by Ghosted View Post
Ehm, an uncompillable code?

Code:
client_print(id, print_chat, "You touched breakable!")
No bro, I can compile it, i compile it and add the plugin to my server, but when i walk on the breakable there is no message appear.
Obada8 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 18:07.


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