Raised This Month: $ Target: $400
 0% 

@@@ message, changing it?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragonshadow
BANNED
Join Date: Jun 2008
Old 06-12-2009 , 21:10   @@@ message, changing it?
Reply With Quote #1

Is it hardcoded or can I change it so it shows playername:message instead of ADMIN:message?
Dragonshadow is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 06-12-2009 , 22:18   Re: @@@ message, changing it?
Reply With Quote #2

Im sure its possible since it shows the names to admins. Youd just have to figure out what code that was and show the name to all, instead of just admins.
retsam is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 06-12-2009 , 23:11   Re: @@@ message, changing it?
Reply With Quote #3

I can't find the file it uses -.-
It would be better if I could create an entirely new plugin instead of modifying a base sourcemod component.
Dragonshadow is offline
BrutalGoerge
AlliedModders Donor
Join Date: Jul 2007
Old 06-13-2009 , 04:07   Re: @@@ message, changing it?
Reply With Quote #4

i think sm_show_activity 15 will do it, not sure though, that cvar always confuses me. lol
__________________
My Pluggies If you like, consider to me.
BrutalGoerge is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 06-13-2009 , 08:17   Re: @@@ message, changing it?
Reply With Quote #5

I found the file is basechat.sp (Lol, I just woke up, opened the folder, and saw it, seriously), but I'm trying to find out what to take out of it to make a new plugin.

This is the entire contents of the smcsay action:
PHP Code:
public Action:Command_SmCsay(clientargs)
{
 if (
args 1)
 {
  
ReplyToCommand(client"[SM] Usage: sm_csay <message>");
  return 
Plugin_Handled
 }
 
 
decl String:text[192];
 
GetCmdArgString(textsizeof(text));
 
 
DisplayCenterTextToAll(clienttext);
 
 
LogAction(client, -1"%L triggered sm_csay (text %s)"clienttext);
 
 return 
Plugin_Handled;  


I guess all I need to do (if modifying basechat.sp) is add in

PHP Code:
decl String:name[64];
 
GetClientName(clientnamesizeof(name)); 
And change some small things, so it is now:

PHP Code:
public Action:Command_SmCsay(clientargs)
{
 if (
args 1)
 {
  
ReplyToCommand(client"[SM] Usage: sm_csay <message>");
  return 
Plugin_Handled
 }
 
 
decl String:text[192];
 
GetCmdArgString(textsizeof(text));
 
 
decl String:name[64];
 
GetClientName(clientnamesizeof(name));
 
 
DisplayCenterTextToAll(nametext);
 
 
LogAction(client, -1"%L triggered sm_csay (text %s)"clienttext);
 
 return 
Plugin_Handled;  

And change this in command_saychat

PHP Code:
 else if (msgStart == && CheckCommandAccess(client"sm_csay"ADMFLAG_CHAT)) // sm_csay alias
 
{
  
DisplayCenterTextToAll(clientmessage);
  
LogAction(client, -1"%L triggered sm_csay (text %s)"clienttext);  
 } 
to
PHP Code:
 else if (msgStart == && CheckCommandAccess(client"sm_csay"ADMFLAG_CHAT)) // sm_csay alias
 
{
  
DisplayCenterTextToAll(namemessage);
  
LogAction(client, -1"%L triggered sm_csay (text %s)"clienttext);  
 } 
Now, how can I turn this into a standalone plugin that overwrites (overtakes?) control to itself instead of using basechat?

Edit:

come to think of it, since they are exactly the same except for these 2-3 changes, si there a way to prevent a plugin from loading and load another instead?

Last edited by Dragonshadow; 06-13-2009 at 08:42.
Dragonshadow is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 06-13-2009 , 10:40   Re: @@@ message, changing it?
Reply With Quote #6

Bah, I've screwed something up in my modified script.

PHP Code:
basechatmod2.sp(137) : error 035argument type mismatch (argument 1)
basechatmod2.sp(246) : error 035argument type mismatch (argument 1
Said lines are:

PHP Code:
DisplayCenterTextToAll(namemessage); 
Both on lines 137 and 246.

If I change it to

PHP Code:
DisplayCenterTextToAll(clientnamemessage); 

I get an error 92

PHP Code:
basechatmod2.sp(137) : error 092number of arguments does not match definition 
(I added a cvar to enable/disable the new style, but I'm pretty sure that isn't what is screwing this up)
Attached Files
File Type: sp Get Plugin or Get Source (basechatmod2.sp - 223 views - 13.5 KB)

Last edited by Dragonshadow; 06-13-2009 at 10:48.
Dragonshadow is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 06-13-2009 , 12:27   Re: @@@ message, changing it?
Reply With Quote #7

Quote:
Originally Posted by Dragonshadow View Post
PHP Code:
DisplayCenterTextToAll(namemessage); 
PHP Code:
DisplayCenterTextToAll(clientnamemessage); 
DisplayCenterTextToAll() takes in an integer (client index) and a string (message) as parameters. From basechat.sp:

PHP Code:
DisplayCenterTextToAll(clientString:message[])
{
    new 
String:nameBuf[MAX_NAME_LENGTH];

    for (new 
1MaxClientsi++)
    {
        if (!
IsClientInGame(i) || IsFakeClient(i))
        {
            continue;
        }
        
FormatActivitySource(clientinameBufsizeof(nameBuf));
        
PrintCenterText(i"%s: %s"nameBufmessage);
    }

As you can see, the function formats the name of the player with FormatActivitySource, which is controlled by the sm_show_activity cvar. Either change the value of that cvar to show the names to all players, or replace the function with your own code.

Offtopic: for some reason the string param isnt const and the loop doesnt include the last player slot
__________________
plop
p3tsin is offline
retsam
Veteran Member
Join Date: Aug 2008
Location: so-cal
Old 06-13-2009 , 12:56   Re: @@@ message, changing it?
Reply With Quote #8

Yeah, as stated above, you just need to edit the sm_show_activity cvar to show the names.

I did not even know this. Learn something new everyday.
retsam is offline
antihacker
Member
Join Date: Feb 2009
Old 06-13-2009 , 14:10   Re: @@@ message, changing it?
Reply With Quote #9

p3tsin i think its an bug, you should fill an bug report.
antihacker is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 06-14-2009 , 08:33   Re: @@@ message, changing it?
Reply With Quote #10

Well, since this is still here, and I've already asked the question, Can someone answer this?:

Quote:
is there a way to prevent a plugin from loading and load another instead?
I want my plugin to override the normal basechat plugin, because if both were running I'm sure it would screw stuff up.
Dragonshadow is offline
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 02:26.


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