Raised This Month: $ Target: $400
 0% 

table in motd window


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ch3cker
Veteran Member
Join Date: Jun 2005
Location: Deutschland / Baden-Würt
Old 07-25-2007 , 15:00   table in motd window
Reply With Quote #1

hey
i will show a table with the attackers with name,hits and damage. here is the code for to show the motd window
Code:
public hits(id, sBuffer[MAX_BUFFER_LENGTH + 1]) {     new izStats[8], izBody[8]     new iAttacker     //new iVictim     new iMaxPlayer = get_maxplayers()         new buffer[2048]     new line[256]         sBuffer[0] = 0     izStats[STATS_SHOTS] = 0     iAttacker = g_izKilled[id][KILLED_KILLER_ID]         if (iAttacker)         get_user_astats(id, iAttacker, izStats, izBody)         if (izStats[STATS_SHOTS] && ShowFullStats)         get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH)     new len = format( buffer, 2047, "<table border=1 cellspacing=1 cellpadding=10 width=100% align=center>")     len += format( buffer[len], 2047-len, "<tr><td align=left width=50%> Name <td align=center width=25%> Hits <td align=right width=25%> Damage" )     for (iAttacker = 1; iAttacker <= iMaxPlayer; iAttacker++)     {         if (get_user_astats(id, iAttacker, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH))         {             get_user_name(iAttacker, t_sName, 32)             len += format( buffer[len], 2047-len , "<tr><td align=left width=50%> %s <td align=center width=25%> %d <td align= rightwidth=25%> %d", t_sName, izStats[STATS_HITS], izStats[STATS_DAMAGE] )             //format(line, 255, "<tr><td align=left width=50%> %s <td align=center width=25%> %d <td align= rightwidth=25%> %d", t_sName, izStats[STATS_HITS], izStats[STATS_DAMAGE] )                         len += format( buffer[len], 2047-len, line )         }     }         format(line, 255, "</table>" )     len += format( buffer[len], 2047-len, line )         show_motd(id, buffer, "Attackers and Victims") }

but it will it not show correct. I`m not so good at scripting I just look at other plugins and try to put the things correctly together.
Here is a picture of th motd window

http://88.198.51.140/myhits.jpg

it should show the name in one line not on 3. Pleaze Help
__________________
SORRY 4 MY BAD ENGLISH
ch3cker is offline
raa
Senior Member
Join Date: Oct 2005
Old 07-25-2007 , 17:21   Re: table in motd window
Reply With Quote #2

in your html width values, try using pixels instead of percents..

ie..

Code:
new len = format( buffer, 2047, "<table border=1 cellspacing=1 cellpadding=10 width=400 align=center>")
__________________
raa is offline
ch3cker
Veteran Member
Join Date: Jun 2005
Location: Deutschland / Baden-Würt
Old 07-26-2007 , 09:48   Re: table in motd window
Reply With Quote #3

ok thanks for that
now the table has a firm size

Code:
    new len = format( buffer, 2047, "<table border=1 cellspacing=1 cellpadding=10 width=650 align=center>")     len += format( buffer[len], 2047-len, "<tr><td align=left width=450> Name <td align=center width=100> Hits <td align=right width=100> Damage" )     for (iAttacker = 1; iAttacker <= iMaxPlayer; iAttacker++)     {         if (get_user_astats(id, iAttacker, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH))         {             get_user_name(iAttacker, t_sName, 32)             len += format( buffer[len], 2047-len , "<tr><td align=left> %s <td align=center> %d <td align=right> %d", t_sName, izStats[STATS_HITS], izStats[STATS_DAMAGE] )
but is shows the name still on more lines.
When your name is "Ch3cker need help" it shows it like this:
Code:
 
Ch3cker
need
help
here is a new picture of it

http://88.198.51.140/myhits2.jpg
__________________
SORRY 4 MY BAD ENGLISH

Last edited by ch3cker; 07-26-2007 at 09:51.
ch3cker is offline
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 07-26-2007 , 11:30   Re: table in motd window
Reply With Quote #4

Just as a thought, you could try string replacing " " with "&nbsp" but I've no idea if it would actually help.

EDIT: That is, I'm fairly sure it should help ... "nbsp" = "non-breaking space" so I assume "non-breaking" means it won't break a line on this space.

Last edited by purple_pixie; 07-27-2007 at 05:11.
purple_pixie is offline
raa
Senior Member
Join Date: Oct 2005
Old 07-26-2007 , 17:13   Re: table in motd window
Reply With Quote #5

hmmmm..

I'm not sure man...

I see you have something that kinda worked here;
http://forums.alliedmods.net/showthr...ht=format+motd

anyway,, gonna need someone who knows about formatting (which I do not)
__________________

Last edited by raa; 07-26-2007 at 17:30.
raa is offline
ch3cker
Veteran Member
Join Date: Jun 2005
Location: Deutschland / Baden-Würt
Old 07-27-2007 , 07:20   Re: table in motd window
Reply With Quote #6

Quote:
Originally Posted by purple_pixie View Post
Just as a thought, you could try string replacing " " with "&nbsp" but I've no idea if it would actually help.

EDIT: That is, I'm fairly sure it should help ... "nbsp" = "non-breaking space" so I assume "non-breaking" means it won't break a line on this space.
hmm... where do you mean should i place this "nbsp" ?
__________________
SORRY 4 MY BAD ENGLISH
ch3cker is offline
ch3cker
Veteran Member
Join Date: Jun 2005
Location: Deutschland / Baden-Würt
Old 07-27-2007 , 07:17   Re: table in motd window
Reply With Quote #7

yes
this works good but i want to show these things in a nice styled table

hmmm.....
__________________
SORRY 4 MY BAD ENGLISH
ch3cker is offline
owned
Member
Join Date: Jul 2007
Old 07-27-2007 , 14:55   Re: table in motd window
Reply With Quote #8

When you print the name, replace spaces with "&nbsp;"
__________________
MARREC/OWNED = me.
owned is offline
gallucci
Junior Member
Join Date: Nov 2006
Old 07-28-2007 , 20:51   Re: table in motd window
Reply With Quote #9

"&nbsp;" means "non breaking space" in HTML, meaning that a browser or in your case the MOTD will not try to break for a newline there.
gallucci is offline
ch3cker
Veteran Member
Join Date: Jun 2005
Location: Deutschland / Baden-Würt
Old 07-30-2007 , 18:34   Re: table in motd window
Reply With Quote #10

hmm i see
but how can i change the space in the name with "&nbsp;" ?

i think 4 something like this:
Code:
get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH) replace(......

so i dont know the replace line.

and sorry i was very bussy
__________________
SORRY 4 MY BAD ENGLISH
ch3cker is offline
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 21:26.


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