AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   table in motd window (https://forums.alliedmods.net/showthread.php?t=58412)

ch3cker 07-25-2007 15:00

table in motd window
 
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 :)

raa 07-25-2007 17:21

Re: table in motd window
 
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>")

ch3cker 07-26-2007 09:48

Re: table in motd window
 
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

purple_pixie 07-26-2007 11:30

Re: table in motd window
 
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.

raa 07-26-2007 17:13

Re: table in motd window
 
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)

ch3cker 07-27-2007 07:17

Re: table in motd window
 
yes
this works good but i want to show these things in a nice styled table :(

hmmm.....

ch3cker 07-27-2007 07:20

Re: table in motd window
 
Quote:

Originally Posted by purple_pixie (Post 508516)
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" ?

owned 07-27-2007 14:55

Re: table in motd window
 
When you print the name, replace spaces with "&nbsp;"

gallucci 07-28-2007 20:51

Re: table in motd window
 
"&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.

ch3cker 07-30-2007 18:34

Re: table in motd window
 
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


All times are GMT -4. The time now is 21:26.

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