Thread: [Solved] HTML not rendered in MOTD
View Single Post
Author Message
naz7
Junior Member
Join Date: Jun 2018
Location: Spain
Old 06-12-2018 , 13:38   HTML not rendered in MOTD
Reply With Quote #1

Hi, I want to use HTML in a MOTD to display things nicely, and finally display a webpage with meta refresh when I have the webpage done and some more database things implemented.
I need help with the MOTD, because it's not rendering any HTML. I'm guessing it should at least just display the text inside it with some formating like any basic web browser, but here it just leaves the HTML tags and everything, as plain text.

I created a tiny plugin to reproduce this. In the attached screenshot it can be seen the MOTD that pops up when saying /mymotdhtml. The other 2 commands show the an equal MOTD, no HTML rendered.
PHP Code:
#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
    
register_plugin("Testing MOTD""0.0.1""naz");
    
    
register_clcmd("say /mymotd""CmdMOTD");
    
register_clcmd("say /mymotdtxt""CmdMOTDFromTxt");
    
register_clcmd("say /mymotdhtml""CmdMOTDFromHTML");
}

// Passing a string to the show_motd
public CmdMOTD(id)
{
    
show_motd(id"<html><head></head><body><p>Test text</p></body></html>");
}

// Passing a .txt file to the show_motd
public CmdMOTDFromTxt(id)
{
    new 
motdPath[32];
    
get_configsdir(motdPathcharsmax(motdPath));
    
formatex(motdPathcharsmax(motdPath), "%s/motd.txt"motdPath);
    
show_motd(idmotdPath);
}

// Passing an HTML file to the show_motd
public CmdMOTDFromHTML(id)
{
    new 
motdPath[33];
    
get_configsdir(motdPathcharsmax(motdPath));
    
formatex(motdPathcharsmax(motdPath), "%s/motd.html"motdPath);
    
show_motd(idmotdPath);

I tried this in 2 different setups, but can't get it to display correctly in any of them:
  1. Client: Open Adrenaline Gamer (HL mod). Server: public (remote) ReHLDS server with AMXModX 1.8.3-dev+5154 and Metamod-r v1.3.0.126.
  2. Client: Half-Life. Server: listenserver with AMXModX 1.8.3-dev+5154 and Metamod 1.21.1-am.

Is it the plugin wrong? is there anything in those clients that prevent HTML from being rendered? because I've seen plugins in CS 1.6 render HTML in MOTD windows am I missing anything else?

Thanks for your attention!
Attached Images
File Type: jpg 20180612183324_1.jpg (90.9 KB, 436 views)

Last edited by naz7; 06-15-2018 at 05:28. Reason: Initial questions solved
naz7 is offline