Raised This Month: $ Target: $400
 0% 

Motd


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 07-12-2010 , 21:39   Motd
Reply With Quote #1

Hi again.
I have this:
PHP Code:
public ShowAllAchievements(id) {
    
    new 
ach[64], msg[2047], len
    format
(ach,63"All Achievements")
    
len format(msg,2046,"<body bgcolor=%s><font face=^"Tahoma^" size=1 color=%s>"BGColorTitleColor)
    
len += format(msg[len],2046-len,"<center><h2>%s</h2><table></center>"ShowAllAchTitle)
    
len += format(msg[len],2046-len,"<tr>")
    
len += format(msg[len],2046-len,"<td width=^"300^"><b>Name</b></td>")
    
len += format(msg[len],2046-len,"<td width=^"99^"><b>%L</b></td>"id"AWARDS_GOALS"
    
len += format(msg[len],2046-len,"<td width=^"99^"><b>%L</b></td>"id"AWARDS_AUTOGOALS")
    
len += format(msg[len],2046-len,"<td width=^"99^"><b>%L</b></td>"id"AWARDS_ASSISTS")
    
len += format(msg[len],2046-len,"<td width=^"99^"><b>%L</b></td>"id"AWARDS_STEALS")
    
len += format(msg[len],2046-len,"<td width=^"99^"><b>%L</b></td>"id"AWARDS_BALLKILLS")
    
len += format(msg[len],2046-len,"<td width=^"99^"><b>%L</b></td>"id"AWARDS_LONGESTGOAL")
    
len += format(msg[len],2046-len,"<td width=^"99^"><b>%L</b></td><tr>"id"AWARDS_DISARMS")
    for (new 
i=1i<=maxplayersi++) {
        if (
is_user_bot(i) || !is_user_connected(i))
            continue
        
        new 
name[32]
        
get_user_name(iname31)
        
len += format(msg[len],2046-len,"<tr><td>%s</td><br>"name)
        
        for(new 
1x<=RECORDSx++) {
            if (
== 7)
                continue
                
            if (
!= RECORDS)
                
len += format(msg[len],2046-len,"<td>%i</td>",MadeRecord[i][x])
            else
                
len += format(msg[len],2046-len,"<td>%i</td></tr>",MadeRecord[i][x])
        }
    }
    
len += format(msg[len],2046-len,"</tr><br></table></font>")
    
len += format(msg[len],2046-len,"<br><center><font color=%s>Plugin by Mxnn</font></center>"MadeByColor)
    
    
show_motd(id msgach)
    
    return 
PLUGIN_HANDLED

But exists a problem.. When the motd is shown the title and the last msg (Plugin by Mxnn) appears in white, but all the table appears in black :S

Vars value = #FFFFFF

Anyone can help me whit this?
Mxnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-12-2010 , 22:22   Re: Motd
Reply With Quote #2

Maybe show us where the color variables are assigned. I would probably clean up the html before anything.

FYI, Change 2047 to 1537 and 2046 to 1536 (motd max characters).

Use x<RECORDS and then add the </tr> after that loop so you can remove the if statement inside the loop. You could probably remove the x == 7 part too.

I made up some html for you to follow and it's about as efficient as it will get and you can still only do about 10 players at a time.

Code:
<html><head><style>
body{background-color:black;color:white}
h2{text-align:center}
p{text-align:center}
th{width:10%}
table{width:100%;border:1px solid black}
</style></head>

<body>
<h2>Header</h2>

<table>
<tr>
<th style="width:30%">Name</th>
<th>GOALS</th>
<th>AUTOGOALS</th>
<th>ASSISTS</th>
<th>STEALS</th>
<th>BALLKILLS</th>
<th>LONGESTGOAL</th>
<th>DISARMS</th>
<tr>
<tr>
<td>LongNameHere</td>
<td>11</td>
<td>21</td>
<td>31</td>
<td>41</td>
<td>51</td>
<td>61</td>
<td>71</td>
</tr>
<tr>
<td>LongNameHere</td>
<td>11</td>
<td>21</td>
<td>31</td>
<td>41</td>
<td>51</td>
<td>61</td>
<td>71</td>
</tr>
<tr>
<td>LongNameHere</td>
<td>11</td>
<td>21</td>
<td>31</td>
<td>41</td>
<td>51</td>
<td>61</td>
<td>71</td>
</tr>
<tr>
<td>LongNameHere</td>
<td>11</td>
<td>21</td>
<td>31</td>
<td>41</td>
<td>51</td>
<td>61</td>
<td>71</td>
</tr>
<tr>
<td>LongNameHere</td>
<td>11</td>
<td>21</td>
<td>31</td>
<td>41</td>
<td>51</td>
<td>61</td>
<td>71</td>
</tr>
<tr>
<td>LongNameHere</td>
<td>11</td>
<td>21</td>
<td>31</td>
<td>41</td>
<td>51</td>
<td>61</td>
<td>71</td>
</tr>
<tr>
<td>LongNameHere</td>
<td>11</td>
<td>21</td>
<td>31</td>
<td>41</td>
<td>51</td>
<td>61</td>
<td>71</td>
</tr>
<tr>
<td>LongNameHere</td>
<td>11</td>
<td>21</td>
<td>31</td>
<td>41</td>
<td>51</td>
<td>61</td>
<td>71</td>
</tr>
<tr>
<td>LongNameHere</td>
<td>11</td>
<td>21</td>
<td>31</td>
<td>41</td>
<td>51</td>
<td>61</td>
<td>71</td>
</tr>
<tr>
<td>LongNameHere</td>
<td>11</td>
<td>21</td>
<td>31</td>
<td>41</td>
<td>51</td>
<td>61</td>
<td>71</td>
</tr>
</table>
<p>Plugin by Mxnn</p>
</body></html>
So, I would suggest that you print only a fixed number of characters when printing player names to be sure that you avoid being limited to less than 10.
__________________

Last edited by fysiks; 07-12-2010 at 23:04.
fysiks is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 07-13-2010 , 12:50   Re: Motd
Reply With Quote #3

Mmhhh, i put exactly as you said but, the table don't appears 100%.. Appears only 50% (the other 50% in black).
Appears all the stuff, but takes 50%.
Mxnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-13-2010 , 16:53   Re: Motd
Reply With Quote #4

Quote:
Originally Posted by Mxnn View Post
Mmhhh, i put exactly as you said but, the table don't appears 100%.. Appears only 50% (the other 50% in black).
Appears all the stuff, but takes 50%.
Show your new code.
__________________
fysiks is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 07-13-2010 , 21:36   Re: Motd
Reply With Quote #5

PHP Code:
    new ach[64], msg[1537], len
    format
(ach,63"All Achievements")
    
len format(msg,1536,"<html><head><style>")
    
len += format(msg[len],1536-len,"body{background-color:black;color:white}")
    
len += format(msg[len],1536-len,"h2{text-align:center}")
    
len += format(msg[len],1536-len,"p{text-align:center}")
    
len += format(msg[len],1536-len,"th{width:20%}")
    
len += format(msg[len],1536-len,"table{width:100%;border:1px solid black}"
    
len += format(msg[len],1536-len,"</style></head>")
    
len += format(msg[len],1536-len,"<body><br><h2>Record's Title</h2>")
    
len += format(msg[len],1536-len,"<table><br><tr>")
    
len += format(msg[len],1536-len,"<th style=^"width:60%^">Name</th>")
    
len += format(msg[len],1536-len,"<th>%L</th>"id"AWARDS_GOALS")
    
len += format(msg[len],1536-len,"<th>%L</th>"id"AWARDS_AUTOGOALS")
    
len += format(msg[len],1536-len,"<th>%L</th>"id"AWARDS_ASSISTS")
    
len += format(msg[len],1536-len,"<th>%L</th>"id"AWARDS_STEALS")
    
len += format(msg[len],1536-len,"<th>%L</th>"id"AWARDS_BALLKILLS"
    
len += format(msg[len],1536-len,"<th>%L</th>"id"AWARDS_LONGESTGOAL")
    
len += format(msg[len],1536-len,"<th>%L</th>"id"AWARDS_DISARMS")
    
len += format(msg[len],1536-len,"<tr>")
    for (new 
i=1i<=maxplayersi++) {
        if (
is_user_bot(i) || !is_user_connected(i))
            continue
        
        new 
name[32]
        
get_user_name(iname31)
        
len += format(msg[len],1536-len,"<tr><td>%s</td>"name)
        
        for(new 
1x<=RECORDSx++) {
            if (
== 7)
                continue
                
            if (
!= RECORDS)
                
len += format(msg[len],1536-len,"<td>%i</td>",MadeRecord[i][x])
            else
                
len += format(msg[len],1536-len,"<td>%i</td></tr>",MadeRecord[i][x])
        }
    }
    
len += format(msg[len],1536-len,"</tr><br></table>")
    
len += format(msg[len],1536-len,"<p>Soccer Jam by OneEyed</p><br><p>Edited by Mxnn</p>")
    
len += format(msg[len],1536-len,"</body></html>")
    
    
show_motd(id msgach
Mxnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-14-2010 , 00:34   Re: Motd
Reply With Quote #6

Quote:
Originally Posted by Mxnn View Post
Mmhhh, i put exactly as you said but, the table don't appears 100%.. Appears only 50% (the other 50% in black).
Appears all the stuff, but takes 50%.
Such a lie! lol. Why did you add in all those <br>'s?????? They are not needed in any of the html that I gave you.

Ok, so I remade the function and you need to listen to me this time. Replace your function with my new function. Do not modify ANYTHING (unless it won't compile or give errors; in that case fix it and show your new code).

After you run my function with several people (however many people you had when you ran it last time) on your server there will be a HTML file called post_me_in_forums.html. Post that here.

PHP Code:
public ShowAllAchievements(id)
{
    new 
szTemp[64]
    
write_file("post_me_in_forums.html","<html><head><style>")
    
write_file("post_me_in_forums.html","body{background-color:black;color:white}")
    
write_file("post_me_in_forums.html","h2{text-align:center}")
    
write_file("post_me_in_forums.html","p{text-align:center}")
    
write_file("post_me_in_forums.html","th{width:20%}")
    
write_file("post_me_in_forums.html","table{width:100%;border:1px solid black}")
    
write_file("post_me_in_forums.html","</style></head>")
    
write_file("post_me_in_forums.html","<body><h2>Record's Title</h2>")
    
write_file("post_me_in_forums.html","<table><tr>")
    
write_file("post_me_in_forums.html","<th style=^"width:60%^">Name</th>")
    
formatex(szTempcharsmax(szTemp), "<th>%s</th>""GOALS")
    
write_file("post_me_in_forums.html"szTemp)
    
formatex(szTempcharsmax(szTemp), "<th>%s</th>""AUTOGOALS")
    
write_file("post_me_in_forums.html"szTemp)
    
formatex(szTempcharsmax(szTemp), "<th>%s</th>""ASSISTS")
    
write_file("post_me_in_forums.html"szTemp)
    
formatex(szTempcharsmax(szTemp), "<th>%s</th>""STEALS")
    
write_file("post_me_in_forums.html"szTemp)
    
formatex(szTempcharsmax(szTemp), "<th>%s</th>""BALLKILLS")
    
write_file("post_me_in_forums.html"szTemp)
    
formatex(szTempcharsmax(szTemp), "<th>%s</th>""LONGESTGOAL")
    
write_file("post_me_in_forums.html"szTemp)
    
formatex(szTempcharsmax(szTemp), "<th>%s</th>""DISARMS")
    
write_file("post_me_in_forums.html"szTemp)
    
write_file("post_me_in_forums.html","</tr>")
    
    new 
iPlayers[32], iNumPlayersname[32], index
    get_players
(iPlayersiNumPlayers)
    for(new 
0iNumPlayersi++)
    {
        
index iPlayers[i]
        
get_user_name(indexnamecharsmax(name))
        
formatex(szTempcharsmax(szTemp), "<tr><td>%.12s</td>"name)
        
write_file("post_me_in_forums.html",szTemp)

        for(new 
1<= RECORDSx++)
        {
            
formatex(szTempcharsmax(szTemp), "<td>%i</td>",MadeRecord[index][x])
            
write_file("post_me_in_forums.html",szTemp)
        }
        
write_file("post_me_in_forums.html","</tr>")
    }
    
write_file("post_me_in_forums.html","</table>")
    
write_file("post_me_in_forums.html","<p>Soccer Jam by OneEyed<br>Edited by Mxnn</p>")
    
write_file("post_me_in_forums.html","</body></html>")

    return 
PLUGIN_HANDLED

__________________
fysiks 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 07:10.


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