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

MOTD panel & strings


Post New Thread Reply   
 
Thread Tools Display Modes
CrancK
Senior Member
Join Date: Jan 2009
Location: Netherlands
Old 04-04-2009 , 06:50   Re: MOTD panel & strings
Reply With Quote #11

ahhhh, ok.... i'll concede.... i'll just have to relearn html/php and make a webpagethingamajig

still think it's strange that you can only have 192 bytes message text though, seeing as a text-file or url can contain more

ahwell...
CrancK is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 04-04-2009 , 08:03   Re: MOTD panel & strings
Reply With Quote #12

The regular MOTD panel uses stringtables. Here's how you do it in a plugin:

Code:
ShowLongMOTD(client,const String:title[],const String:panel[]) {     new Handle:kv = CreateKeyValues("data")     KvSetString(kv,"title",title)     KvSetString(kv,"type","1")     KvSetString(kv,"msg",panel)     ShowVGUIPanel(client,"info",kv)     CloseHandle(kv) } bool:SetLongMOTD(const String:panel[],const String:text[]) {     new table = FindStringTable("InfoPanel")     if(table != INVALID_STRING_TABLE) {         new len = strlen(text)         new str = FindStringIndex(table,panel)         new bool:locked = LockStringTables(false)         if(str == INVALID_STRING_INDEX || str == 65535) {   //for some reason it keeps returning 65535             AddToStringTable(table,panel,text,len)         }         else {             SetStringTableData(table,str,text,len)         }         LockStringTables(locked)         return true     }     return false }

First you got to save the data with SetLongMOTD, wait for it to be networked to clients (no idea how much time should be spent for that), and then send it to the clients. Example:

Code:
public OnPluginStart() {     RegConsoleCmd("sm_hello",CmdHello) } public OnMapStart() {     SetLongMOTD("motd2","<html><body>Hello</body></html>") } public Action:CmdHello(client,args) {     ShowLongMOTD(client,"Title","motd2")     return Plugin_Handled }

You could also make the client execute a command when he closes the window (to inform the server), but I didn't wanna include it in the above script.
__________________
plop

Last edited by p3tsin; 04-04-2009 at 08:08.
p3tsin is offline
CrancK
Senior Member
Join Date: Jan 2009
Location: Netherlands
Old 04-04-2009 , 10:43   Re: MOTD panel & strings
Reply With Quote #13

Thanks! i'll try this right away


btw, are the html tags needed?

edit: Perfect!! a million thanks to you and then a million more!

will post the plugin once i've cleaned up the code

Last edited by CrancK; 04-04-2009 at 18:00.
CrancK is offline
V0gelz
Senior Member
Join Date: Jun 2004
Old 04-05-2009 , 06:41   Re: MOTD panel & strings
Reply With Quote #14

It is not needed. You can just write stuff in it.
__________________
V0gelz is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 04-08-2009 , 13:07   Re: MOTD panel & strings
Reply With Quote #15

By the way, the HL2:DM Roleplay plugin is using \n in HUD text just fine, so it should work.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
Darkimmortal
Senior Member
Join Date: Aug 2008
Old 04-10-2009 , 13:50   Re: MOTD panel & strings
Reply With Quote #16

What about base-64 encoding the HTML and using a data: URI?
__________________
Darkimmortal 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 04:33.


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