Server Help

Bot Questions - mervbot banner code

Underlord - Tue Jan 27, 2009 1:16 am
Post subject: mervbot banner code
Mervbot code for the bot to grab player's banners and save them in .bmp files. You could save these in a web folder then load em easily on a website like http://stats.svszone.com . Doesn't work to do this code on playerentering event, I know playerleaving works. Needs template.bmp from continuum/banners in the bot folder.

Code: Show/Hide

// needs fstream
char buffer[1174];
char filename[99];
int x,y = 0;
bool is_blank = true;

strcpy(filename,p->name);
strncat(filename,".bmp",5);

ifstream is("template.bmp", ios::binary);
is.read(buffer, 1174);
is.close();

for(y = 0; y < 8; y++)
   for(x = 0; x < 12; x++)
   {
      buffer[1078+y*12+x] = p->banner[((7-y)*12)+x];

      if (p->banner[((7-y)*12)+x] != 0)
         is_blank = false;
   }

if (!is_blank)
{
   ofstream os(filename, ios::binary);
   os.write(buffer, 1174);
   os.close();
}


some sample php code to display them

Code: Show/Hide

<?php
$filename = "playerbanners//" .$row['player_name']. ".bmp";
                  
if (file_exists($filename))
   echo "<img src='" . $filename . "' width=12 height=8>";
?>


thx to DeathOnline for help getting it working

works in subgame and asss

hope this is useful to someone
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group