Raised This Month: $ Target: $400
 0% 

MOTD won't display right...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 08-21-2009 , 11:51   MOTD won't display right...
Reply With Quote #1

I have an old plugin "admin MOTD" that I've triyed to mod to fit my needs, but it won't display all of the HTML content right... (no scoll, so what's below the last line it can't be displayed correct...)

And this is the code:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "New AMXX Who"
#define VERSION "1.0"
#define AUTHOR "Alka"
#define CharsMax(%1) sizeof(%1)-1
#define MAX_GROUPS 14
new g_groupNames[MAX_GROUPS][] =
{
 
"-= OwneR =-",
 
" ",
 
"-= DevelopeR =-",
 
" ",
 
"-= Contribuitors =-",
 
" ",
 
"-= AdminS =-",
 
" ",
 
"- Level 5 -",
 
"- Level 4 -",
 
"- Level 3 -",
 
"- Level 2 -",
 
"- Level 1 -",
 
"- SlotS -"
}
new 
g_groupFlags[MAX_GROUPS][] =
{
 
"abcdefghijklmnopqrstu",
 
"1",
 
"abcdefghijklmnopqrsu",
 
"2",
 
"abcdefijklmnopqru",
 
"3",
 
"4",
 
"5",
 
"abcdefijklmnopqu",
 
"abcdefijmnopu",
 
"bcdefijmnou",
 
"bcefijmnu",
 
"bceim",
 
"b"
}
new 
g_groupFlagsValue[MAX_GROUPS];
public 
plugin_init()
{
 
register_plugin(PLUGINVERSIONAUTHOR);
 
 for(new 
MAX_GROUPS i++)
  
g_groupFlagsValue[i] = read_flags(g_groupFlags[i]);
 
 
register_clcmd("say /admins""cmdWho", -1"");
 
register_clcmd("say /admin""cmdWho", -1"");
}

public 
cmdWho(id)
{
 static 
sPlayers[32], iNumiPlayer;
 static 
sName[32], sBuffer[1024];
 
 static 
iLen;
 
iLen formatex(sBuffersizeof sBuffer 1"<body scroll=^"yes^" bgcolor=#000000><font color=#7b68ee><pre>");
 
 
get_players(sPlayersiNum"ch");
 
 for(new 
0MAX_GROUPS i++)
 {   
  
iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen"<center><h5><font color=^"red^"><<--<B>%s</B>-->>^n</font></h5></center>"g_groupNames[i]);
  
  for(new 
0iNum x++)
  {   
   
iPlayer sPlayers[x];
   
   if(
get_user_flags(iPlayer) == g_groupFlagsValue[i])
   {
    
get_user_name(iPlayersNamesizeof sName 1);
    
iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen"<center>%s^n</center>"sName);
   }
  }
 }
 
show_motd(idsBuffer"Online Admins");
 return 
0;

Attached Thumbnails
Click image for larger version

Name:	admins.JPG
Views:	183
Size:	53.8 KB
ID:	48106  
Costin83 is offline
Send a message via Yahoo to Costin83
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-21-2009 , 12:31   Re: MOTD won't display right...
Reply With Quote #2

Try this

PHP Code:
public cmdWho(id)
{
 static 
sPlayers[32], iNumiPlayer;
 static 
sName[32], sBuffer[1500];
 
 static 
iLen;
 
iLen formatex(sBuffersizeof sBuffer 1"<body scroll=^"yes^" bgcolor=#000000><font color=#7b68ee><pre><center>");
 
 
get_players(sPlayersiNum"ch");
 
 for(new 
0MAX_GROUPS i++)
 {   
  
iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen"<h5><font color=^"red^"><<--<B>%s</B>-->>^n</font></h5>"g_groupNames[i]);
  
  for(new 
0iNum x++)
  {   
   
iPlayer sPlayers[x];
   
   if(
get_user_flags(iPlayer) == g_groupFlagsValue[i])
   {
    
get_user_name(iPlayersNamesizeof sName 1);
    
iLen += formatex(sBuffer[iLen], CharsMax(sBuffer) - iLen"%s^n"sName);
   }
  }
 }
 
show_motd(idsBuffer"Online Admins");
 return 
0;

__________________
xPaw is offline
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 08-21-2009 , 15:11   Re: MOTD won't display right...
Reply With Quote #3

Thanks xPaw, it really works.

Now I wait for more admins on server to see if it displays right with alot more lines...

Q1: What had <center> </center> to do with the problem ?

Q2: What is the difference between sBuffer[1500] and sBuffer[1024] ?
Costin83 is offline
Send a message via Yahoo to Costin83
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 08-21-2009 , 17:02   Re: MOTD won't display right...
Reply With Quote #4

A1: nothing
A2: first array are bigger, because 1024 chars is not enough.
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-21-2009 , 17:10   Re: MOTD won't display right...
Reply With Quote #5

A1: Chars wasting.
__________________
xPaw is offline
Costin83
Senior Member
Join Date: Jul 2008
Location: Romania
Old 08-21-2009 , 21:07   Re: MOTD won't display right...
Reply With Quote #6

Quote:
Originally Posted by xPaw View Post
A1: Chars wasting.
So "<body scroll=^"yes^" bgcolor=#000000><font color=#7b68ee><pre><center>" was enough to "center" all HTML content..... doesn't it ?

No need to reply to this

Edit:

btw... It works with many admins on server, now it scrolls right.

Last edited by Costin83; 08-21-2009 at 21:10.
Costin83 is offline
Send a message via Yahoo to Costin83
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 15:14.


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