Raised This Month: $51 Target: $400
 12% 

MOTD Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TheDOO
Member
Join Date: Nov 2007
Old 12-20-2007 , 04:42   MOTD Help
Reply With Quote #1

Ok I've been trying to make a chat triggered motd display but I am having some problems. I make it so when a person says !motd it displays the contents of rules.txt.

I want it to read rules.txt but server side. When I test the plugin with a dedicated server having rules.txt, but the client doesn't, when they say !motd nothing shows up. The only way I fixed around it is having the client download rules.txt when they join but there has to be a way to display it to them without them actually having the file. Am I going the wrong way about this?

Here's the code, bare with because it's my 1st one.

Code:
public OnPluginStart()
{
	RegConsoleCmd("say", Command_OnSay);
}

public Action:Command_OnSay(client, args)
{
	decl String:text[192];
	GetCmdArgString(text, sizeof(text));
	
	new startidx;
	
	if (text[strlen(text)-1] == '"')
	{
		text[strlen(text)-1] = '\0';
		startidx = 1;
	}

	if (strcmp(text[startidx], "!motd", false) == 0)
	{
		ShowMotd(client);
	}

	return Plugin_Continue;
}

public Action:ShowMotd(client)
{
	ShowMOTDPanel(client, "Server rules", "rules.txt", MOTDPANEL_TYPE_FILE);

	return Plugin_Handled;
}
TheDOO is offline
KMFrog
Senior Member
Join Date: Oct 2007
Old 12-20-2007 , 13:19   Re: MOTD Help
Reply With Quote #2

humm looks ok to me, the rules.txt would have to be located next to the original motd.txt on the server though.. is this your problem?

you could also try things like "\rules.txt"
__________________
Was I helpful or not? Rate Me!
KMFrog is offline
TheDOO
Member
Join Date: Nov 2007
Old 12-20-2007 , 19:07   Re: MOTD Help
Reply With Quote #3

Yeah the rules.txt is in the same folder as motd.txt. But when someone says !motd it just shows a blank MOTD panel, but when I do it, since I have the file, it shows up.
TheDOO is offline
TheDOO
Member
Join Date: Nov 2007
Old 12-21-2007 , 18:53   Re: MOTD Help
Reply With Quote #4

Ok the more I look at it, it seems it has something to do with the Source engine? Does it handle the MOTD different than in Half-life? I look at an AMX mod X plugin that shows the motd from chat trigger and the code is pretty much just like mine, but the file it reads is from the server, while mine is reading clientside.
TheDOO is offline
TheDOO
Member
Join Date: Nov 2007
Old 12-23-2007 , 01:56   Re: MOTD Help
Reply With Quote #5

No one has any ideas?
TheDOO is offline
TFN|Nick
Senior Member
Join Date: Sep 2007
Old 12-23-2007 , 05:03   Re: MOTD Help
Reply With Quote #6

Does your rules.txt have html in it?? I know on my server my MOTD file has been really picky about html and what/how it shows. Usually if we make a change that it doesn't like it just won't display It may be worth just running some basic phrases in rules.txt and seeing if they show up.
TFN|Nick is offline
Send a message via MSN to TFN|Nick
KMFrog
Senior Member
Join Date: Oct 2007
Old 12-23-2007 , 14:42   Re: MOTD Help
Reply With Quote #7

you may have to change the file extension to .html as well?
__________________
Was I helpful or not? Rate Me!
KMFrog is offline
TheDOO
Member
Join Date: Nov 2007
Old 12-23-2007 , 15:04   Re: MOTD Help
Reply With Quote #8

Even if I put just one word in rules.txt, it doesn't show to anyone other than me. If i make it .html, instead of a blank MOTD panel, it shows a blank webpage.
TheDOO is offline
TheDOO
Member
Join Date: Nov 2007
Old 12-24-2007 , 05:15   Re: MOTD Help
Reply With Quote #9

I'm guessing the only solution is hosting on a website and make it point to that? I'd really rather have it read from the server, but nothing I try seems to work.

I look at some old amx mod x plugins and they seemed to display files from the server fine in a motd, but my code seems unable.
TheDOO is offline
TFN|Nick
Senior Member
Join Date: Sep 2007
Old 12-24-2007 , 07:04   Re: MOTD Help
Reply With Quote #10

You could try it a different way:

PHP Code:
public Action:ShowMotd(client)
{
    new 
Handle:f_MOTD OpenFile("rules.txt""rt");
     
    
ShowMOTDPanel(client"Server rules"f_MOTDMOTDPANEL_TYPE_FILE);
    
    
CloseHandle(f_MOTD)
    return 
Plugin_Handled;

Worth a try...
TFN|Nick is offline
Send a message via MSN to TFN|Nick
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 16:33.


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