• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[PHP5][POT]Player graphic details script . Uses GD

kofel

Quietly
Joined
Aug 19, 2007
Messages
74
Reaction score
1
Hello!

I was maked player info scipt, which use GD for graphic. :)

Here is a scipt (That use POT for geting player info) :
PHP:
<?
header("Content-type: image/png");
include('PATH/TO/POT/OTS.php');
$ID=(int)$_GET['uid'];

$vocs=array(1=>'Sorcerer',2=>'Druid',3=>'Paladin',4=>'Knight',5=>'Master Sorcerer',6=>'Elder Druid',7=>'Royal Paladin',8=>'Elite Knight');
//LOADING A PLAYER ;p
$cfg['db']=array(
    'driver' => 'MySQL',
    'host' => 'localhost',
    'user' => '',
    'password' => '',
    'database' => 'otserv'
);
$driver = array('MySQL' => POT::DB_MYSQL, 'SQLite' => POT::DB_SQLITE, 'PostgreSQL' => POT::DB_PGSQL);
$cfg['db']['driver']=$driver[$cfg['db']['driver']];
$lnk=POT::getInstance()->connect(null, $cfg['db']);
$player=POT::getInstance()->createObject('Player');
$player->load($ID);

if(!$player->getAccount()->getCustomField('premdays'))
$pacc='Free account';
else
$pacc='Premium account';
$image=imagecreatefrompng('img.png');
$white=imagecolorallocate($image, 255, 255, 255);
if($player->isLoaded())
{
	Imagestring($image,2,(imagesy+18),(imagesy+18),'Nick:      '.$player->getName(),$white);
	Imagestring($image,2,(imagesy+18),(imagesy+28),'Level:     '.$player->getLevel(),$white);
	Imagestring($image,2,(imagesy+18),(imagesy+38),'Profesion: '.$vocs[$player->getVocation()],$white);
	Imagestring($image,2,(imagesy+18),(imagesy+48),'Account:   '.$pacc,$white);
}
else
{
	Imagestring($image,2,(imagesy+18),(imagesy+18),'Player don\'t exists!',$white);
}
imagepng($image);
imagedestroy($image);
?>
This a example image.

Yours,
Kofel.

[Sorry for my english :p]
 
Last edited:
same problem here
and i'm sorry for my noobnes with php but i couldn't install it >.<
what is this "include('PATH/TO/POT/OTS.php');"? i don't know any path to put there
what is this POT? i've heard in another topic about it, is it good? :p
ty

i know i'm kind of reviving the topic, but i guess it worth it as even the img is not working
 
same problem here
and i'm sorry for my noobnes with php but i couldn't install it >.<
what is this "include('PATH/TO/POT/OTS.php');"? i don't know any path to put there
what is this POT? i've heard in another topic about it, is it good? :p
ty

i know i'm kind of reviving the topic, but i guess it worth it as even the img is not working
You must put somewhere POT in your directory with WWW and then write path to OTS.php file in POT directory.
"POT is a toolkit/library for accessing OTServ database from PHP. It provides PHP classes that represents OTServ database inforation as an objects."
All about POT, official site
Newest version of POT you can download:
http://sourceforge.net/project/showfiles.php?group_id=32523&package_id=251784
Image generate is like:
http://radonia.net/Signature.php?name=Empty
You must create image in background.
Your image is loaded here:
Code:
$image=imagecreatefrompng('img.png');
You must put img.png in same directory with this script.
 
You must put somewhere POT in your directory with WWW and then write path to OTS.php file in POT directory.
"POT is a toolkit/library for accessing OTServ database from PHP. It provides PHP classes that represents OTServ database inforation as an objects."
All about POT, official site
Newest version of POT you can download:
http://sourceforge.net/project/showfiles.php?group_id=32523&package_id=251784
Image generate is like:
http://radonia.net/Signature.php?name=Empty
You must create image in background.
Your image is loaded here:
Code:
$image=imagecreatefrompng('img.png');
You must put img.png in same directory with this script.

oh, pretty cool, thanks for the explanation
btw... i posted some stuff at your acc maker topic, some ideas to improve it, talking in a graphic way.... maybe u can take some idea from there =)
 
PHP:
<?
header("Content-type: image/png");
include('d:/apachefriends/xampp/htdocs/pot/pot/OTS.php');
$ID=(int)$_GET['uid'];

$vocs=array(1=>'Sorcerer',2=>'Druid',3=>'Paladin',4=>'Knight',5=>'Master Sorcerer',6=>'Elder Druid',7=>'Royal Paladin',8=>'Elite Knight');
//LOADING A PLAYER ;p
$cfg['db']=array(
    'driver' => 'MySQL',
    'host' => 'localhost',
    'user' => 'root',
    'password' => 'fgerte324',
    'database' => 'woot'
);
$driver = array('MySQL' => POT::DB_MYSQL, 'SQLite' => POT::DB_SQLITE, 'PostgreSQL' => POT::DB_PGSQL);
$cfg['db']['driver']=$driver[$cfg['db']['driver']];
$lnk=POT::getInstance()->connect(null, $cfg['db']);
$player=POT::getInstance()->createObject('Player');
$player->load($ID);

if(!$player->getAccount()->getCustomField('premdays'))
$pacc='Free';
else
$pacc='Premium';
$skit='open-tibia.se';
$image=imagecreatefrompng('img.png');
$white=imagecolorallocate($image, 255, 255, 255);
if($player->isLoaded())
{
    Imagestring($image,2,(imagesy+18),(imagesy+18),'Name:      '.$player->getName(),$white);
    Imagestring($image,2,(imagesy+18),(imagesy+28),'Level:     '.$player->getLevel(),$white);
    Imagestring($image,2,(imagesy+18),(imagesy+38),'Profesion: '.$vocs[$player->getVocation()],$white);
    Imagestring($image,2,(imagesy+18),(imagesy+48),'Account status:   '.$pacc,$white);
    Imagestring($image,2,(imagesy+18),(imagesy+58),'IP:   '.$skit,$white);
}
else
{
    Imagestring($image,2,(imagesy+18),(imagesy+18),'Player doesn\'t exist!',$white);
}
imagepng($image);
imagedestroy($image);
?>
Error: Bilden “http://localhost/siggy.php” kan inte visas, då den innehåller fel.
Means like The picture http://localhost/siggy.php” can not be shown, because it contains errors.

wut?
pot is at that directory and all, databse& pass etc is correct.

edit:
the PNG picture is there too! (siggy.php directory)
 
If i understand this correctly this script uses Pot to get information about characters in the server and places them on a image with live data about that character?
 
Very nice script :) Thanks I use it at the moment (look siggy ;)).
 
Last edited:
Back
Top