Raised This Month: $7 Target: $400
 1% 

External MOTD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 05-12-2019 , 20:12   External MOTD
Reply With Quote #1

Hello

I want to know if there's a way to edit the current MOTD of the server.

Context: I want a dynamic MOTD based on an uploaded text file somewhere. How can I achieve this?

Please do NOT suggest HTML redirection (the method most commonly used in CS1.6 servers) since the target games do not support HTML motd, only plain text.

Thanks in advance.
__________________

Last edited by gabuch2; 05-12-2019 at 20:40.
gabuch2 is offline
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 05-12-2019 , 22:31   Re: External MOTD
Reply With Quote #2

I tried this once, you need to do the following.

1. block original MOTD call https://forums.alliedmods.net/showpo...26&postcount=3
2. load custom content via sockets https://forums.alliedmods.net/showthread.php?t=41913
3. dynamically modify the data, put it in a buffer no larger than 1526(?) characters, and send it to the client.

PHP Code:
            else
            {
                new 
sztext[1536]
                new 
pos format(sztext,1535,"Invalid Argument: ^"%s^", here is a list of all commands availabile:^n^n"said)
                
pos += format(sztext[pos],1535-pos,"!blood [user] - Displays blood for the specified player (you if none specified)^n")
                
pos += format(sztext[pos],1535-pos,"!health [user] - functions the same as !blood [user]^n")
                
pos += format(sztext[pos],1535-pos,"!bank - opens bloobank^n")
                
pos += format(sztext[pos],1535-pos,"!toggleinfo - toggles the dusokat if the HUD info on events.^n")
                
pos += format(sztext[pos],1535-pos,"!buy (item) [amount] - Quickbuy an item from bloodbank (more info below)^n^n")
                
pos += format(sztext[pos],1535-pos,"Buying arguments:^n^nNotes:^n    amount is only required if specified^n    item's that have amounts support the words ^"max^" and ^"full^"^n^n")
                
pos += format(sztext[pos],1535-pos,"Quickbuy item list:^n^n")
                
pos += format(sztext[pos],1535-pos,"health (amount) - gives you (amount) health^n")
                
pos += format(sztext[pos],1535-pos,"armor (amount) - gives you (amount) armor [500 limit]^n")
                
pos += format(sztext[pos],1535-pos,"all weapons OR all guns - gives you all guns^n")
                
pos += format(sztext[pos],1535-pos,"nades - resets your nades to full^n")
                
pos += format(sztext[pos],1535-pos,"regen - greatly increases your regen rate^n")
                
pos += format(sztext[pos],1535-pos,"^n^n^n END OF FILE")
                
                
show_motd(id,sztext,"BB Help")
                
//client_print(x,print_chat,"[DEBUG] %d no input!",x)
                
return PLUGIN_HANDLED;
            } 
__________________
+|- KARMA Respectively


Last edited by HLM; 05-12-2019 at 22:57. Reason: added step 3
HLM is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-13-2019 , 22:07   Re: External MOTD
Reply With Quote #3

Quote:
Originally Posted by HLM View Post
a buffer no larger than 1526(?) characters
1536
__________________
fysiks is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 05-13-2019 , 22:41   Re: External MOTD
Reply With Quote #4

Also, it is 1536 chars if all of them are ASCII.
Most of Unicode char is equal to 2 ASCII chars. It's about languages like russian, greek, arabic, etc.
So, if all chars are Unicode you may have only 768 chars.
__________________
My English is A0

Last edited by E1_531G; 05-13-2019 at 22:46.
E1_531G is offline
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 06:55.


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