Raised This Month: $32 Target: $400
 8% 

Precache that MOTD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Vet
Veteran Member
Join Date: Jul 2006
Location: I|O wa
Old 09-24-2007 , 10:58   Precache that MOTD
Reply With Quote #1

This is kind of a luxury proceedure for the perfectionist server op with a somewhat involved or lengthy MOTD. What it does is precaches your MOTD to the client's machine and loads it from there. So your MOTD will display instantly. Eliminating that annoying blank screen that's displayed while your MOTD loads from wherever in the world you have it stored. As you may have noticed, I have way too much free time.

This proceedure won't do you a lot of good if...
-Your MOTD is relativly simple, because your load time is probably fairly short anyway.
-Your MOTD includes references to external content because the external content will not be precached.
-Your MOTD changes often, because its somewhat complicated and needs to be redone every time you change your MOTD.
-You don't know what's going on here, because this method requires a lot coordination between files and content.

What you need...
1) A simple motd.txt file stored on the server that directs the MOTD to load from the client's hard drive.
2) All your MOTD content. The main htm file, background, graphics, sounds etc.
3) A fastdownload server that mirrors the content (recommended but not required).
4) A plugin to precache the content.
5) Knowledge. Understand what's going on here or you're in for a headache.

Implementation...
1) The motd.txt file. Here's a sample. Notice the frame src parameter. It begins with ./ to direct the content to the local HD. The full path is where the content is stored on the HD and needs to be unique. Note the folders. The motds folder will be created by the plugin to store all MOTDs in a common place. The sample subfolder alphadogcs01 should be replaced with your unique folder name.
Code:
<frameset cols="*" framespacing="0" frameborder="no" border="0">
<frame name="frame_main" src="./motds/alphadogcs01/index_v1.htm">
</frameset>
2) All your MOTD content needs to be stored on your server in the SAME locations as denoted in the motd.txt file. In this example, it would be \cstrike\motds\alphadogcs01\. Store and refer to all content within the same single folder. DO NOT use subfolders. For this sample, the only content you have is grecloth.jpg, header2.jpg and the main htm file itself, index_v1.htm. If your MOTD changes, be sure to give the main file a new name (like index_v2.htm). Otherwise a client that already has the MOTD precached on his machine will still see the old version.
Code:
<html>
<body background="grecloth.jpg" text="#c1b689"> 
<center>
<img src="header2.jpg">
<h2>* Welcome to the Server *</h2>
</center>
<h4>Server Rules:<br>
<hr>
blah blah blah
<hr>
Thank You for Visiting Our Server!</h4>
</body>
</html>
3) Copy the content to your fastdownload server, if available, using the same folder structure.

4) Now all we need is a plugin to precache the files to the clients. You can write your own hard coded plugin if your MOTD will never change. But if it does change, you'll need to rewrite it. Here's a hard coded dedicated plugin applicable to the sample...
Code:
#include <amxmodx>
public plugin_precache()
{
 precache_generic("motds/alphadogcs01/index_v1.htm")
 precache_generic("motds/alphadogcs01/grecloth.jpg")
 precache_generic("motds/alphadogcs01/header2.jpg")
}
public plugin_init()
{
 register_plugin("Precache_MOTD", "0.1", "Vet")
}
Or, I've written a plugin (get below) that uses a file motdload.ini stored in the amxmodx/configs/ folder to read the unique folder name and content files. A motdload.ini file for this sample would look like...
Code:
// Your unique folder name
alphadogcs01
 
// MOTD files to precache
index_v1.htm
grecloth.jpg
header2.jpg
Its a lot of work for a small reward. But if you like things 'just so', its nice.
Attached Files
File Type: sma Get Plugin or Get Source (motdload.sma - 1293 views - 1.2 KB)
__________________
=====================================
- My Plugins -
=====================================

Last edited by Vet; 09-24-2007 at 11:07.
Vet is offline
Send a message via MSN to Vet
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 09-26-2007 , 03:33   Re: Precache that MOTD
Reply With Quote #2

Vet, you're a genious.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 09-27-2007 , 05:13   Re: Precache that MOTD
Reply With Quote #3

Seconded.

Sadly my MOTD's tend to be dynamic, but still some dashed good work, what.
purple_pixie is offline
Old 10-01-2007, 08:52
ConnorMcLeod
This message has been deleted by Hawk552. Reason: my delete button on your post is what's going on
Reply


Thread Tools
Display Modes

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 17:20.


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