Raised This Month: $51 Target: $400
 12% 

Chat Icon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 08-23-2020 , 08:55   Chat Icon
Reply With Quote #1

After a while, I will raise one not a big question

There is a moment when you press the Chat key - then the Enter or Esc key. Then again the Chat key - the Enter or Esc key. And the icon does not disappear.
The plugin is installed so that it disappears when any keys / movements are activated, including the mouse.

Hence:
How to set the icon to disappear after clicking / closing empty messages

Since there is no Code and the plugin is no longer supported, I ask for help from knowledgeable people

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

#define PLUGIN "Chat Icon"
#define VERSION "1.0"
#define AUTHOR "DJ_WEST"

#define CHAT_ICON "sprites/chat_icon1.spr"
#define BIND_TASKID 7829
#define ICON_SIZE 0.47
#define ICON_ALPHA 255

new bool:g_b_PlayerInChat[33]
new 
HamHook:g_h_PlayerPostThink[33]
new 
g_PlayerIcon[33]
new 
g_InfoTarget

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("chat""Start_Chat")
    
register_clcmd("chat_team""Start_Chat")
    
register_clcmd("say""Check_Chat")
    
register_clcmd("say_team""Check_Chat")

    
g_InfoTarget engfunc(EngFunc_AllocString"info_target")
}

public 
plugin_precache()
    
precache_model(CHAT_ICON)

public 
client_putinserver(id)
{
    if (
is_user_bot(id) || is_user_hltv(id))
        return
        
    
g_b_PlayerInChat[id] = false
    g_PlayerIcon
[id] = 0
    set_task
(5.0"Bind_Delay"id BIND_TASKID)
}

public 
client_disconnect(id)
    
remove_task(id BIND_TASKID)

public 
Bind_Delay(taskid)
{
    static 
id
    
    id 
taskid BIND_TASKID
    client_cmd
(id"bind y ^"chat;messagemode^";bind u ^"chat_team;messagemode2")
}

public Start_Chat(id)
{
    g_b_PlayerInChat[id] = true
    
    Enable_Icon(id)
    
    if (g_h_PlayerPostThink[id])
        EnableHamForward(g_h_PlayerPostThink[id])
    else
        g_h_PlayerPostThink[id] = RegisterHamFromEntity(Ham_Player_PostThink, id, "
Player_Moving", 1)
    
    return PLUGIN_HANDLED
}

public Player_Moving(id)
{
    static i_Buttons
    
    i_Buttons = pev(id, pev_button)
    
    if (i_Buttons)
        Disable_Icon(id)
}

public Check_Chat(id)
{
    if (g_b_PlayerInChat[id])
        Disable_Icon(id)
}

public Enable_Icon(id)
{
    new i_Ent
    
    i_Ent = engfunc(EngFunc_CreateNamedEntity, g_InfoTarget)
    engfunc(EngFunc_SetModel, i_Ent, CHAT_ICON)
    set_pev(i_Ent, pev_aiment, id)
    set_pev(i_Ent, pev_movetype, MOVETYPE_FOLLOW)
    set_pev(i_Ent, pev_scale, ICON_SIZE)
    set_rendering(i_Ent, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, ICON_ALPHA)
    g_PlayerIcon[id] = i_Ent
}

public Disable_Icon(id)
{
    static i_Ent
    
    if (g_h_PlayerPostThink[id])
        DisableHamForward(g_h_PlayerPostThink[id])
            
    g_b_PlayerInChat[id] = false

    i_Ent = g_PlayerIcon[id]

    if (i_Ent && pev_valid(i_Ent))
        remove_entity(i_Ent)

__________________
МультиМод CS 83.222.97.124:27015

MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
AnimalMonster
Senior Member
Join Date: May 2020
Old 08-25-2020 , 13:47   Re: Chat Icon
Reply With Quote #2

Quote:
Originally Posted by MayroN View Post
After a while, I will raise one not a big question

There is a moment when you press the Chat key - then the Enter or Esc key. Then again the Chat key - the Enter or Esc key. And the icon does not disappear.
The plugin is installed so that it disappears when any keys / movements are activated, including the mouse.

Hence:
How to set the icon to disappear after clicking / closing empty messages

Since there is no Code and the plugin is no longer supported, I ask for help from knowledgeable people

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

#define PLUGIN "Chat Icon"
#define VERSION "1.0"
#define AUTHOR "DJ_WEST"

#define CHAT_ICON "sprites/chat_icon1.spr"
#define BIND_TASKID 7829
#define ICON_SIZE 0.47
#define ICON_ALPHA 255

new bool:g_b_PlayerInChat[33]
new 
HamHook:g_h_PlayerPostThink[33]
new 
g_PlayerIcon[33]
new 
g_InfoTarget

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("chat""Start_Chat")
    
register_clcmd("chat_team""Start_Chat")
    
register_clcmd("say""Check_Chat")
    
register_clcmd("say_team""Check_Chat")

    
g_InfoTarget engfunc(EngFunc_AllocString"info_target")
}

public 
plugin_precache()
    
precache_model(CHAT_ICON)

public 
client_putinserver(id)
{
    if (
is_user_bot(id) || is_user_hltv(id))
        return
        
    
g_b_PlayerInChat[id] = false
    g_PlayerIcon
[id] = 0
    set_task
(5.0"Bind_Delay"id BIND_TASKID)
}

public 
client_disconnect(id)
    
remove_task(id BIND_TASKID)

public 
Bind_Delay(taskid)
{
    static 
id
    
    id 
taskid BIND_TASKID
    client_cmd
(id"bind y ^"chat;messagemode^";bind u ^"chat_team;messagemode2")
}

public Start_Chat(id)
{
    g_b_PlayerInChat[id] = true
    
    Enable_Icon(id)
    
    if (g_h_PlayerPostThink[id])
        EnableHamForward(g_h_PlayerPostThink[id])
    else
        g_h_PlayerPostThink[id] = RegisterHamFromEntity(Ham_Player_PostThink, id, "
Player_Moving", 1)
    
    return PLUGIN_HANDLED
}

public Player_Moving(id)
{
    static i_Buttons
    
    i_Buttons = pev(id, pev_button)
    
    if (i_Buttons)
        Disable_Icon(id)
}

public Check_Chat(id)
{
    if (g_b_PlayerInChat[id])
        Disable_Icon(id)
}

public Enable_Icon(id)
{
    new i_Ent
    
    i_Ent = engfunc(EngFunc_CreateNamedEntity, g_InfoTarget)
    engfunc(EngFunc_SetModel, i_Ent, CHAT_ICON)
    set_pev(i_Ent, pev_aiment, id)
    set_pev(i_Ent, pev_movetype, MOVETYPE_FOLLOW)
    set_pev(i_Ent, pev_scale, ICON_SIZE)
    set_rendering(i_Ent, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, ICON_ALPHA)
    g_PlayerIcon[id] = i_Ent
}

public Disable_Icon(id)
{
    static i_Ent
    
    if (g_h_PlayerPostThink[id])
        DisableHamForward(g_h_PlayerPostThink[id])
            
    g_b_PlayerInChat[id] = false

    i_Ent = g_PlayerIcon[id]

    if (i_Ent && pev_valid(i_Ent))
        remove_entity(i_Ent)

You missed a ^" at Bind if this does help=)
AnimalMonster is offline
MayroN
Senior Member
Join Date: Aug 2017
Location: Kyiv
Old 08-26-2020 , 16:43   Re: Chat Icon
Reply With Quote #3

Quote:
Originally Posted by AnimalMonster View Post
You missed a ^" at Bind if this does help=)
Yeah man
__________________
МультиМод CS 83.222.97.124:27015

MayroN is offline
Send a message via ICQ to MayroN Send a message via Skype™ to MayroN
Reply



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 07:40.


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