• 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!

Buy Characters Via Website I have example!

I have System by Magic,this is his script.
Execute this in your phpMyAdmin:
PHP:
ALTER TABLE `players` ADD `sell` tinyint(1) NOT NULL default '0'
ALTER TABLE `players` ADD `pp_sell` int(10) NOT NULL default '0'
Now create auctionchar.php
PHP:
<?
/*   `sell` tinyint(1) NOT NULL default '0',
  `pp_sell` int(10) NOT NULL default '0' */
$id = (int) $_GET['id'];
$buy = $_GET['buy'];
if ($logged){  
    $player = $SQL->query('SELECT * FROM players WHERE id = '.$id.' LIMIT 1')->fetch();
    if ($player){
        if (isset($id) && !isset($buy)){        
            if ($player['sell']){
                $main_content .= 'Czy jesteś peweien, że chcesz kupić postać o nicku <b>'.$player['name'].'</b> za <b>'.$player['pp_sell'].'</b> punktów premium? Jeśli tak, kliknij <a href="?subtopic=buycharacter&id='.$id.'&buy=true">tutaj</a>.';
            }
        }
        if (isset($id) && $player['sell']){
            if ($buy == 'true'){
            if ($account_logged->getCustomField('premium_points') > $player['pp_sell']){
                $points = $player['pp_sell'];
                $pl_id = $player['id'];
                $SQL->query('UPDATE accounts SET premium_points = premium_points + '.$points.' WHERE id = '.$pl_id.' LIMIT 1');
                $account_logged->setCustomField('premium_points', $account_logged->getCustomField('premium_points')-$player['pp_sell']);
                $SQL->query('UPDATE players SET account_id = '.$account_logged->getID().', sell = 0, pp_sell = 0 WHERE id = '.$id.' LIMIT 1');
                $main_content .= 'Kupiłeś postać <b>'.$player['name'].'</b>. Od teraz ta postać jest na twoim koncie.';
            }
        else{
            $errors [] = 'Masz za mało punktów premium aby zakupić tę postać.';
        }
        }
        }
        else{
            $errors [] = 'Ta postać nie jest na sprzedaż.';
        }
    }
    else{
        $errors [] = 'Nie ma takiej postaci w bazie.';
    }
    if (!empty($errors)){
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>Wystąpiły poniższe błędy:</b><br/>';
            foreach($errors as $error) {
                $main_content .= '<li>'.$error;
            }
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/>';
    }
}
else{
Header('Location: ?subtopic=accountmanagement');
}
?>
Next create sellchar.php
PHP:
<?PHP
if ($logged){
$main_content = '<fieldset><center>';
$account_players = $account_logged->getPlayersList();
    if ($account_players > 0){
        $main_content .= '<form action = "" method="post"><select name="player">';
        foreach($account_players as $acc_player){
            if ($acc_player->getCustomField('sell') == 0){
                $main_content .= '<option name="'.$acc_player.'">'.$acc_player.'</option>';
            }
        }
        $main_content .= '</select></br>Ile punktów premium ma kosztować postać:<br> <input type="text" name="pp"><br><input type="submit" value="Sprzedaj postać!" name="sub"></form>';
    }
    else{
        $errors[] = 'Nie masz żadnej postaci.';
    }
    $main_content .= '</center></fieldset>';
    $list_sell_char = $SQL->query('SELECT id, name, level, vocation, promotion, pp_sell FROM players WHERE sell = 1 AND group_id < 2 ORDER BY level')->fetchAll();
    if ($list_sell_char){
        $counter = 0;
        $main_content .='<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%></TABLE><TABLE BORDER=0 CELLPADDING=4 CELLSPACING=1 WIDTH=100%><TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD WIDTH=20% CLASS=white><B><center>Name</center></B></TD><TD WIDTH=15% CLASS=white><B><center>Level</center></B></TD><TD WIDTH=25% CLASS=white><b><center>Vocation</center></B></TD><TD WIDTH=15% CLASS=white><b><center>Buy</center></B></TD><TD WIDTH=20% CLASS=white><b><center>Price</center></B></TD></TR>';
        foreach($list_sell_char as $sell_char){
            $counter++;
            if(is_int($counter / 2))
                $bgcolor = $config['site']['darkborder'];
            else
                $bgcolor = $config['site']['lightborder'];
            $voc = $player_voc = $vocation_name[0][$sell_char['promotion']][$sell_char['vocation']];
            $main_content .= '<tr bgcolor="'.$bgcolor.'"><td><a href="?subtopic=characters&name='.$sell_char['name'].'"><center>'.$sell_char['name'].' </center></a></td><td><center>'.$sell_char['level'].'</center></td><td><center>'.$voc.'</center></td><td><center><a href="?subtopic=buycharacter&id='.$sell_char['id'].'">Buy</a></center></td><td>'.$sell_char['pp_sell'].' premium points!</td>';
        }
        $main_content .= '</table>';
    }
    else{
        $main_content .= 'Nie ma żadnej postaci na sprzedaż.';
    }
    if (isset($_POST['sub'])){
        if (is_numeric($_POST['pp'])){
            if ($SQL->query('UPDATE players SET sell = true, pp_sell = '.$_POST['pp'].'+100 WHERE name = "'.$_POST['player'].'" LIMIT 1')){
                $main_content .= 'Twoja postać została dodana do listy.';
            }
        }
        else{
            $errors[] = 'Ilość punktów premium musi być liczbą!.';
        }
    }
    if (!empty($errors)){
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>Wystąpiły poniższe błędy:</b><br/>';
            foreach($errors as $error) {
                $main_content .= '<li>'.$error;
            }
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/>';
    }
}
else{
Header('Location: ?subtopic=accountmanagement');
}
$main_content .= '<p align = "right"><small>System created by <a href="http://tibia.net.pl/members/kowol.html">Kowol</a>.</small></p>';    
?>
Add to config:
PHP:
$config['site']['char_cost_plus'] = 100;
where 100 is price for character
Add in index.php:
PHP:
    case "buycharacter":
        $topic = "Buy Character";
        $subtopic = "buycharacter";
        include("auctionchar.php");
    break;
        case "sellchar";
        $topic = "Sell character";
        $subtopic = "sellchar";
        include("sellchar.php");
    break;
Add this in laout near SMS Shop or somewhere.
Now go to /data/creaturescripts/scripts/ and make sellCheck.lua:
PHP:
function onLogin(cid)
local sellquery = db.getResult("SELECT sell FROM players WHERE name = '"..getCreatureName(cid).."' LIMIT 1")
local sell = sellquery:getDataInt("sell")
sellquery:free()
if sell == 1 then
  doPlayerPopupFYI(cid, "Twoja postac zostala wystawiona na sprzedaz, nie mozesz sie na nia teraz zalogowac")
  doRemoveCreature(cid)
end
return TRUE
end
and add to creaturescripts:
PHP:
<event type="login" name="sellCheck" event="script" value="sellCheck.lua"/>

This is all.
 
EDIT:
Opps.. double post.
----------------------------
@kudzu1988
PHP:
function onLogin(cid)
local sellquery = db.getResult("SELECT sell FROM players WHERE name = '"..getCreatureName(cid).."' LIMIT 1")
local sell = sellquery:getDataInt("sell")
sellquery:free()
if sell == 1 then
  doPlayerPopupFYI(cid, "Twoja postac zostala wystawiona na sprzedaz, nie mozesz sie na nia teraz zalogowac")
  doRemoveCreature(cid)
end
return TRUE
end
In query should be used function:
db.escapeString(string)
PHP:
function onLogin(cid)
local sellquery = db.getResult("SELECT sell FROM players WHERE name = "..db.escapeString(getCreatureName(cid)).." LIMIT 1")
local sell = sellquery:getDataInt("sell")
sellquery:free()
if sell == 1 then
  doPlayerPopupFYI(cid, "Twoja postac zostala wystawiona na sprzedaz, nie mozesz sie na nia teraz zalogowac")
  doRemoveCreature(cid)
end
return TRUE
end
 
Hey, I have 2 errors. When I open the website /subtopic=buycharacter, it's:
Wyst�pi�y poni�sze b��dy:
# Nie ma takiej postaci w bazie.

When I open /subtopic=sellcharacter, I have a white website. Please, help me!
 
It's working, but its not Hexana system.
In this one you must set one price, it's not licytation, cannot bid offer and you must put character by yourself, its not automatic after xx days.
 
Back
Top