Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › DoD Plugins › Trash › cvars in a motd
3 posts, 2 people · 6,000 views Thread Rating: ★★★★★
closedcvars in a motd
Started by Dr.G on 02-12-2009, 04:00 PM
Dr.G
started this thread
Posts: 776
Threads: 75
Joined: Nov 2007
02-12-2009, 04:00 PM #1

well lately ive been working a some bonus shit for own server, and i ended up have more then 40 adjustable cvars and even tho i made it all myself i wasnt able to remember them all. So what to do? Well came up with an idea about makeing a say command to a motd and get them all printed there, so i did. And this is how i did it, its actully pretty easy, check this out:rnrn

/* Plugin generated by AMXX-Studio */rnrn#include <amxmodx>rn#include <amxmisc>rnrn#define PLUGIN_NAME "Motd test"rn#define VERSION "1.0"rn#define AUTHOR "Dr.G"rnrn/* extra macros to print */rn#define WEB_SITE ".:: dodplugins.net ::."rn#define OWNER "Zor"rnrnnew p_onrnrn// only test pointersrnnew p_one, p_two, p_three, p_fourrnrnpublic plugin_init() rn{rn	register_plugin(PLUGIN_NAME, VERSION, AUTHOR)rn	rn	p_on = register_cvar("dod_motd_test","1") //on/offrn	rn	p_one = register_cvar("dod_motd_test_1","12")rn	p_two = register_cvar("dod_motd_test_2","21")rn	p_three = register_cvar("dod_motd_test_3","13")rn	p_four = register_cvar("dod_motd_test_4","31")rn	rn	/* rn	Say cmd'srn	NOTE that global say might not work for linux machines!!!rn	*/rn	register_clcmd("say /motdtest","motd_test",ADMIN_IMMUNITY)rn	register_clcmd("say_team /motdtest","motd_test",ADMIN_IMMUNITY)rn}rnrnpublic motd_test(id)rn{rn	if(get_pcvar_num(p_on))	rn	{rn		rn		new header[33]rn		/* the length on this array might be a bit big for this lol */rn		new motd[2048]rn		new lenrn		rn		/* server name = hostname :) */rn		new hostname[65]rn		get_cvar_string("hostname", hostname, 64)rn		rn		/* lets put the motd together */rn		formatex(header,32,"%s",PLUGIN_NAME)rn		rn		len = formatex(motd,2047,"<html><head><style type=^"text/css^">pre{color:#FFB000;}body{background:#000000;margin-left:8px;margin-top:0px;}</style></head><body><pre>")rn		rn		len += formatex(motd[len],2047-len,"[%s]^n<hr>^n",PLUGIN_NAME)rn		rn		len += formatex(motd[len],2047-len,"Current settings are:^n^n")rn		rn		len += formatex(motd[len],2047-len,"Testing @ %s^n^n",hostname)rn		rn		len += formatex(motd[len],2047-len,"dod_motd_test_1: %d^n^n",get_pcvar_num(p_one))rn		rn		len += formatex(motd[len],2047-len,"dod_motd_test_2: %d^n^n",get_pcvar_num(p_two))rn		rn		len += formatex(motd[len],2047-len,"dod_motd_test_3: %d^n^n",get_pcvar_num(p_three))rn		rn		len += formatex(motd[len],2047-len,"dod_motd_test_4: %d^n^n",get_pcvar_num(p_four))rn		rn		len += formatex(motd[len],2047-len,"<hr>^n^n %s says^n <i>^"is this smart or what!!!</i>^"",AUTHOR)rn		rn		len += formatex(motd[len],2047-len,"<b><center> %s^nHey have anybody seen %s?? lol</center></b>", WEB_SITE, OWNER)rn		rn		show_motd(id,motd,header)rn	}rn	return PLUGIN_HANDLEDrn}
rnrnBIG credit to xxavalanchexx i looked in his gungame and found the method. Ive attached a SS of how the motd will show...rnrnCheers!

Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
02-12-2009, 07:11 PM #2

Nice work but doesn't cvar.ini just show you what they are set at?

Dr.G
started this thread
Posts: 776
Threads: 75
Joined: Nov 2007
02-13-2009, 11:21 AM #3

u can add them in that cvar.ini and get them in the menu, but well thats something every server admin would need to do, in this way u can make a specific motd for each plugin, and maybe make a public one for e.g your melee bonus one and make a description and the settings will auto update... another example i just updated the bot damage one for testing, see the attachment... when u say /botdamage the motd will show u the current settings... however i think its pretty smart but iam just n00b with this lol

Archive › Old Forum Threads › DoD Plugins › Trash › cvars in a motd
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC