AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   custom say text :) (https://forums.alliedmods.net/showthread.php?t=119536)

Lure.d 02-22-2010 13:13

custom say text :)
 
Alrighty first some code then the question.
PHP Code:

...
new 
cSay;
...

public 
plugin_init() {
...

/* -- Chat handling -- */
    
register_clcmd("say""c_say");
    
register_clcmd("say_team""c_say");
    
    
cSay get_user_msgid("SayText");
}

public 
c_say(id) {
    new 
say_content[150],name[31];
    
    
read_args(say_contentsizeof(say_content));
    
remove_quotes(say_content);
    
get_user_name(idnamesizeof(name) -1);
    
    
format(say_content191"[%s] %s: %s",tag,name,say_content);
    
message_begin(MSG_ONEcSay_id);
    
write_byte(id);
    
write_string(say_content);
    
message_end();


So when i execute this code on "say" "say_team" commands,
it writes:
Code:

[TAG] Lure.d: some text
Lure.d: some text

And i need it to destroy original message, and replace it with my "custom" one.
Help!

hleV 02-22-2010 13:21

Re: custom say text :)
 
PHP Code:

public c_say(id) {
    new 
say_content[150],name[32];
 
    
read_args(say_contentsizeof(say_content));
    
remove_quotes(say_content);
    
get_user_name(idnamesizeof(name) - 1);
 
    
format(say_content191"[%s] %s: %s",tag,name,say_content);
    
message_begin(MSG_ONEcSay_id);
    
write_byte(id);
    
write_string(say_content);
    
message_end();
 
    return 
PLUGIN_HANDLED;


Also fixed name[].

Lure.d 02-22-2010 13:24

Re: custom say text :)
 
thanks! im still a "rookie" of amxx :P
LTU: Dekui, dar tik pradmenis++ moku tai daug dar mokintis reikia :crab:

EDIT:
Yeah i should do it, forgot that arrays start at 0 but you know i HAVE a little surprise for my new plugin,
so thats why i need certainly 31 in lenght of name.
Anyways thanks, the return of plugin_handled is working.


All times are GMT -4. The time now is 02:18.

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