Raised This Month: $ Target: $400
 0% 

Help with top15 MOTD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-02-2022 , 08:19   Re: Help with top15 MOTD
Reply With Quote #1

Replace each image name in the array with what it is named on the imgur site. When the code runs, it'll format it accordingly -- https://i.imgur.com/RankImg1.png, etc.

MOTD has a character limit of 1536, so you'll need to take that into consideration.

PHP Code:
new const RankImages[][] = 
{
    
"RankImg1.png",
    
"RankImg2.png",
    
"RankImg3.png",
    
"RankImg4.png",
    
"RankImg5.png",
    
"RankImg6.png",
    
"RankImg7.png",
    
"RankImg8.png",
    
"RankImg9.png",
    
"RankImg10.png",
    
"RankImg11.png",
    
"RankImg12.png",
    
"RankImg13.png",
    
"RankImg14.png",
    
"RankImg15.png"
};

public 
GiveTopInformation(FailStateHandle:QueryError[], ErrcodeDataPlayer[], DataSize)
{
    new 
idPlayerName2[32], Number[10], PlayerPointsiMOTDPosstring[3036], iNumResults;
    
    
id DataPlayer[0], string[0] = EOS;
    
iMOTDPos format(stringcharsmax(string), "<html><head><style>body{background:#FFF;font-family:Tahoma}th{background:#056B9E;color:#FFF;padding:3px;text-align:left;border-top:4px solid #3986AC}td{background:#CCCCCC;padding:2px 6px;border-bottom:1px dotted}table{color:#006699;background:#FFF;font-size:15px;border:2px solid #006699}</style></head><body><table width=100%% border=0 align=center cellpadding=0 cellspacing=1>");             
    
iMOTDPos += format(string[iMOTDPos], charsmax(string)-iMOTDPos"<center><img src='https://i.imgur.com/4kypRjN.png'></center><br/><tr><th>Rank<th>Nick<th>Points<th>Kills<th>Deaths<th>HS</tr>");
    
iNumResults SQL_NumResults(Query);
    
    if(
iNumResults
    {
        for(new 
iiNumResultsi++)
        {
            
SQL_ReadResult(Query1PlayerName2charsmax(PlayerName2)), PlayerPoints SQL_ReadResult(Query3), AddCommas(PlayerPointsNumbercharsmax(Number));
            
iMOTDPos += format(string[iMOTDPos], charsmax(string)-iMOTDPos"<tr><td><img src='https://i.imgur.com/%s'> %d<td>%s<td>%s<td>#<td>#<td>#</tr>"RankImages] , i+1PlayerName2Number);
            
SQL_NextRow(Query);
        }
    }
    
copy(string[iMOTDPos], charsmax(string)-iMOTDPos"</table><center><img src='https://i.imgur.com/XR2ZufG.png'></center></body></html>");
    
show_motd(idstring"PLOIESTI.LaLeagane.Ro");
    return 
PLUGIN_HANDLED;

__________________

Last edited by Bugsy; 05-02-2022 at 09:30.
Bugsy is offline
maNIaRO
Member
Join Date: Nov 2014
Old 05-02-2022 , 09:51   Re: Help with top15 MOTD
Reply With Quote #2

Quote:
Originally Posted by Bugsy View Post
Replace each image name in the array with what it is named on the imgur site. When the code runs, it'll format it accordingly -- https://i.imgur.com/RankImg1.png, etc.

MOTD has a character limit of 1536, so you'll need to take that into consideration.

PHP Code:
new const RankImages[][] = 
{
    
"RankImg1.png",
    
"RankImg2.png",
    
"RankImg3.png",
    
"RankImg4.png",
    
"RankImg5.png",
    
"RankImg6.png",
    
"RankImg7.png",
    
"RankImg8.png",
    
"RankImg9.png",
    
"RankImg10.png",
    
"RankImg11.png",
    
"RankImg12.png",
    
"RankImg13.png",
    
"RankImg14.png",
    
"RankImg15.png"
};

public 
GiveTopInformation(FailStateHandle:QueryError[], ErrcodeDataPlayer[], DataSize)
{
    new 
idPlayerName2[32], Number[10], PlayerPointsiMOTDPosstring[3036], iNumResults;
    
    
id DataPlayer[0], string[0] = EOS;
    
iMOTDPos format(stringcharsmax(string), "<html><head><style>body{background:#FFF;font-family:Tahoma}th{background:#056B9E;color:#FFF;padding:3px;text-align:left;border-top:4px solid #3986AC}td{background:#CCCCCC;padding:2px 6px;border-bottom:1px dotted}table{color:#006699;background:#FFF;font-size:15px;border:2px solid #006699}</style></head><body><table width=100%% border=0 align=center cellpadding=0 cellspacing=1>");             
    
iMOTDPos += format(string[iMOTDPos], charsmax(string)-iMOTDPos"<center><img src='https://i.imgur.com/4kypRjN.png'></center><br/><tr><th>Rank<th>Nick<th>Points<th>Kills<th>Deaths<th>HS</tr>");
    
iNumResults SQL_NumResults(Query);
    
    if(
iNumResults
    {
        for(new 
iiNumResultsi++)
        {
            
SQL_ReadResult(Query1PlayerName2charsmax(PlayerName2)), PlayerPoints SQL_ReadResult(Query3), AddCommas(PlayerPointsNumbercharsmax(Number));
            
iMOTDPos += format(string[iMOTDPos], charsmax(string)-iMOTDPos"<tr><td><img src='https://i.imgur.com/%s'> %d<td>%s<td>%s<td>#<td>#<td>#</tr>"RankImages] , i+1PlayerName2Number);
            
SQL_NextRow(Query);
        }
    }
    
copy(string[iMOTDPos], charsmax(string)-iMOTDPos"</table><center><img src='https://i.imgur.com/XR2ZufG.png'></center></body></html>");
    
show_motd(idstring"PLOIESTI.LaLeagane.Ro");
    return 
PLUGIN_HANDLED;

Thank you, i will try this option.
Character limit 1536 is maximum for MOTD? Where does it start the counting and where it ends? So in case of showing issues, maybe I can delete some unnecesary rows/columns/text.
Thanks
maNIaRO 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:23.


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