Raised This Month: $99 Target: $400
 24% 

Chat Revamp API V1.2b


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Technical/Development       
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-16-2017 , 19:52   Chat Revamp API V1.2b
Reply With Quote #1

I did not perfectly test it but there isn't a reason it won't work. My current suspicion is that SayText may be sent more than once per chat.

This plugin revamps the chat ( say/_team ) and allows with a single forward and a single native, allowing to stop a player from receiving chat from a specific player and even eavesdrop to team chat.

Despite being API, there are built in features.

API Forward:

Code:
public client_ChatPrintByPlayer(sender, receiver, bool:WillSend, bool:TeamChat, Message[], MessageTags[])

sender = player sending the chat message.

receiver = player receiving the chat message.

bool:WillSend = true if the message will be sent at all ( might be altered if return 2 is applied, causing eavesdropping of team chat only ).

bool:TeamChat = true if the chat is team chat.

Message[] = The message the sender wrote that the receiver is going to receive.

MessageTags[] = The tags accompanied with the message. Completely useless if you don't wish to block the message with return 1 and use the native to resend the message with censorship for example.

return 0 to ignore, return 1 to block the receiver from receiving the chat, return 2 to receive the chat even if it's team chat.
API Native:

Code:
native print_special_colorchat(index, sender, Message[], MessageTags[]);

index = index receiving the message.
sender = player sending the message. Used to display his name and team color.
Message[] = Message to send. Only this should be altered in general.
MessageTags[] = The tags accompanied with the message.
Current functions outside of API:

Code:
say /blockchat <target> - blocks / unblocks target from chatting to you. Doesn't affect ADMIN_IMMUNITY. You can't send chat messages to blocked targets in addition to receiving them.

say /stopchat - blocks / unblocks all chat messages. Doesn't affect chat sent by ADMIN_IMMUNITY.

Dead to alive chat modified by cvar.

Team chat disable by cvar. In disable of team chat, all team chats are sent as normal chats.

Allow blocking players from chatting by cvar.

Allow blocking the general chat by cvar.
CVARs:

Note: All cvars are set in the beginning of the map.

Code:
chat_revamp_enabled - Enables entire plugin. Default 1.
chat_allow_dead_to_alive - Allows dead player to chat alive players if set to 1. Default 0.
chat_allow_team_chat - Allows player to chat to their team if set to 1. Default 1.
chat_allow_block - Allows player to block chat from specific players if set to 1. Doesn't apply on sending ADMIN_IMMUNITY. Default 1.
chat_allow_stop_chat - Allows player to disable receiving chat. Doesn't apply on sending ADMIN_IMMUNITY. Default 1.
Sorry for giving a plugin that might not even work but it'll take a day for people to evaluate whether or not it's working ( I generally need a server with 2 real players to test it properly ).
Attached Files
File Type: sma Get Plugin or Get Source (ChatRevamp.sma - 395 views - 7.8 KB)

Last edited by eyal282; 07-19-2017 at 14:04.
eyal282 is offline
Mistrick
Senior Member
Join Date: Aug 2012
Location: Russia
Old 07-18-2017 , 13:13   Re: Chat Revamp API V1.1b
Reply With Quote #2

Why do you do all stuff in hook message?

https://github.com/s1lentq/ReGameDLL....cpp#L726-L770

Say command generate message for all players on server. One command -> 32(max) messages.
In hook you do cycle with send message for players and block original message but then you can get another 31 messages, again own cycle for players. You did chat spammer.
Why your stock func for SayText send message in unreliable channel? You can lost messages.
Mistrick is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 07-18-2017 , 14:12   Re: Chat Revamp API V1.1b
Reply With Quote #3

use pcvars instead.
__________________
Ayman Khaled is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-18-2017 , 14:44   Re: Chat Revamp API V1.1b
Reply With Quote #4

Quote:
Originally Posted by Ayman Khaled View Post
use pcvars instead.
And how are you going to use pcvars in his situation?
__________________
edon1337 is offline
Send a message via Skype™ to edon1337
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 07-18-2017 , 15:56   Re: Chat Revamp API V1.1b
Reply With Quote #5

if i'm not wrong :/

PHP Code:
new enabledeadtoalive;

public 
plugin_init()
{
    
enable register_cvar("chat_revamp_enabled""1");
    
deadtoalive register_cvar("chat_allow_dead_to_alive""0");

}

public 
plugin_cfg()
{
    if(!
get_pcvar_num(enable))
        
pause("a");
        
    else
    {
        
pDeadChat get_pcvar_num(deadtoalive);
    }

__________________
Ayman Khaled is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-18-2017 , 17:37   Re: Chat Revamp API V1.1b
Reply With Quote #6

Quote:
Originally Posted by Ayman Khaled View Post
if i'm not wrong :/

PHP Code:
new enabledeadtoalive;

public 
plugin_init()
{
    
enable register_cvar("chat_revamp_enabled""1");
    
deadtoalive register_cvar("chat_allow_dead_to_alive""0");

}

public 
plugin_cfg()
{
    if(!
get_pcvar_num(enable))
        
pause("a");
        
    else
    {
        
pDeadChat get_pcvar_num(deadtoalive);
    }

Sorry, my mistake, I didn't actually pay attention to the code, you're right.
__________________
edon1337 is offline
Send a message via Skype™ to edon1337
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-18-2017 , 18:45   Re: Chat Revamp API V1.1b
Reply With Quote #7

I suspect that whenever someone writes in the chat, it's printed x times players connected.
eyal282 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-19-2017 , 03:10   Re: Chat Revamp API V1.1b
Reply With Quote #8

You can ALWAYS use pcvars(and you must)
__________________

Last edited by HamletEagle; 07-19-2017 at 03:11.
HamletEagle is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 07-19-2017 , 07:02   Re: Chat Revamp API V1.1b
Reply With Quote #9

Quote:
Originally Posted by HamletEagle View Post
You can ALWAYS use pcvars(and you must)
Will be done. Is it possible that the chat is printed more than once equal to the players connected?
eyal282 is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 07-19-2017 , 07:16   Re: Chat Revamp API V1.1b
Reply With Quote #10

Quote:
Originally Posted by eyal282 View Post
Will be done. Is it possible that the chat is printed more than once equal to the players connected?
Quote:
Originally Posted by Mistrick View Post
In hook you do cycle with send message for players and block original message but then you can get another 31 messages, again own cycle for players. You did chat spammer.
__________________
Ayman Khaled 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 20:33.


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