PDA

View Full Version : Text chat Plugin


Ba5ic
11-23-2006, 07:24 AM
Hi

I'm looking for a plugin that periodically ( say every 20 mins ) displays a message? example:

[admin] We are recruiting , please visit www.mysite.com etc. For every player to see.

I have hud / scrolling messages setup but i'm looking for simething to be displayed in the player chat field?.

I have binds setup to do this but i want a random message when there are no members/ admins on.

I hope this makes sense and would appreciate any guidance.

Thanks!

=|[76AD]|= TatsuSaisei
11-23-2006, 02:22 PM
Hi

I'm looking for a plugin that periodically ( say every 20 mins ) displays a message? example:

[admin] We are recruiting , please visit www.mysite.com (http://www.mysite.com) etc. For every player to see.

I have hud / scrolling messages setup but i'm looking for simething to be displayed in the player chat field?.

I have binds setup to do this but i want a random message when there are no members/ admins on.

I hope this makes sense and would appreciate any guidance.

Thanks!

Would not be hard to do at all... give it a day or two for a follow-up response..

diamond-optic
11-23-2006, 08:37 PM
i believe theres a few plugins that do this on the amxmodx.org forums

like one plugin called like 'task scheduler' or something will let you do any commands including chat

Ba5ic
11-24-2006, 05:33 AM
i believe theres a few plugins that do this on the amxmodx.org forums

like one plugin called like 'task scheduler' or something will let you do any commands including chat


Hi Diamond

Thanks for the pointer , it's installed and working fine BUT is there a way i can remove the server name from the start of the message? as it stands it quite long winded

server name> message etc blah blah blah?.

Thanks

=|[76AD]|= TatsuSaisei
11-24-2006, 09:00 AM
Hi Diamond

Thanks for the pointer , it's installed and working fine BUT is there a way i can remove the server name from the start of the message? as it stands it quite long winded

server name> message etc blah blah blah?.

Thanks
post link to code....

Ba5ic
11-24-2006, 09:10 AM
|= TatsuSaisei;2372']post link to code....


/* AMX Mod script. (Nov 10th, 2002)
*
* Task Scheduler 0.2
* by JustinHoMi
*
* amx_task time "task" flags
* flags:
* m - time is in minutes
* s - time is in seconds
* r - repeat task
* t - specific time
*
*/

#include <amxmodx>

new task_cmds[32][108]
new task_times[32][16]
new numtasks = 0

public load_task()
{
if (read_argc() < 4) {
server_print("[AMX] Usage: amx_task < time > ^"command^" < flags >")
return PLUGIN_HANDLED
}

new args[128]
read_args(args,128)
new clock[6], cmd[108], flags[5]

parse(args,clock,6,cmd,108,flags,5)
new Float:time_f = floatstr(clock)

new flag[2] = ""
if (contain(flags,"r") != -1)
flag="b"
if (contain(flags,"m") != -1)
time_f = time_f * 60

if (contain(flags,"t") != -1)
{
copy(task_cmds[numtasks],108,cmd)
copy(task_times[numtasks],6,clock)
numtasks++
return PLUGIN_HANDLED
}

set_task(time_f,"run_task",0,cmd,108,flag)

return PLUGIN_CONTINUE
}

public run_task(cmd[])
{
server_cmd(cmd)
return PLUGIN_HANDLED
}

public check_time()
{
new curtime[16]
get_time("%H:%M",curtime,16)

for(new i=0; i<numtasks; i++)
if(equal(curtime,task_times[i]))
server_cmd(task_cmds[i])

return PLUGIN_CONTINUE
}

public plugin_init()
{
register_plugin("Task Scheduler","0.2","JustinHoMi")
register_srvcmd("amx_task","load_task")
set_task(60.0,"check_time",1,"",0,"b")
return PLUGIN_CONTINUE
}

=|[76AD]|= TatsuSaisei
11-24-2006, 09:17 AM
you know what it is... your amxx is reporting who executes a command... nothing in that code controls that...

in amxx.cfg change the following...


// Show admins activity
// 0 - disabled
// 1 - show without admin name
// 2 - show with name
amx_show_activity 0


otherwise no, you can not "remove" that by editing the code you provided...

=|[76AD]|= TatsuSaisei
11-24-2006, 09:39 AM
Try this... simple plugin...


#include <amxmodx>
#define PLUGIN "Simple Auto Text"
#define VERSION "76.0"
#define AUTHOR "TatsuSaisei"
new message, msg_time, msg_where
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
message = register_cvar("auto_message", "64.182.164.36:27016 ~ Home of the Damage Mod by: =|[76AD]|= TatsuSaisei ~ Questions, Comments, Fears welcome at forum.76AD.com")//the message to display
msg_time = register_cvar("auto_msg_time", "180")//amount of time in seconds between each showing
msg_where = register_cvar("auto_msg_where", "1")//0 = center 1 = lower left
set_task(get_pcvar_float(msg_time),"chat_something",1,"",0,"b")
return PLUGIN_CONTINUE
}
public chat_something()
{
new msg[256]
get_pcvar_string(message, msg, 256)
if(get_pcvar_num(msg_where) == 0)
{
client_print(0, print_center, msg)
}
else if(get_pcvar_num(msg_where) == 1)
{
client_print(0, print_chat, msg)
}
return PLUGIN_CONTINUE
}

Ba5ic
11-24-2006, 02:03 PM
Thanks TatsuSaisei

It works fine , however is there a way to make it display like a player chat rather than white text in the bottom centre of the screen?

Thank You

diamond-optic
11-24-2006, 08:00 PM
setting the cvar: auto_msg_where to "1" should make it show up down in the chat area

Ba5ic
11-27-2006, 04:24 PM
|= TatsuSaisei;2376']Try this... simple plugin...


#include <amxmodx>
#define PLUGIN "Simple Auto Text"
#define VERSION "76.0"
#define AUTHOR "TatsuSaisei"
new message, msg_time, msg_where
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
message = register_cvar("auto_message", "64.182.164.36:27016 ~ Home of the Damage Mod by: =|[76AD]|= TatsuSaisei ~ Questions, Comments, Fears welcome at forum.76AD.com")//the message to display
msg_time = register_cvar("auto_msg_time", "180")//amount of time in seconds between each showing
msg_where = register_cvar("auto_msg_where", "1")//0 = center 1 = lower left
set_task(get_pcvar_float(msg_time),"chat_something",1,"",0,"b")
return PLUGIN_CONTINUE
}
public chat_something()
{
new msg[256]
get_pcvar_string(message, msg, 256)
if(get_pcvar_num(msg_where) == 0)
{
client_print(0, print_center, msg)
}
else if(get_pcvar_num(msg_where) == 1)
{
client_print(0, print_chat, msg)
}
return PLUGIN_CONTINUE
}


Worked fine :)

Thanks