• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Remove skull from page

_M4G0_

Intermediate OT User
Joined
Feb 6, 2016
Messages
550
Solutions
17
Reaction score
108
done
PHP:
<?php
if(!defined('INITIALIZED'))
    exit;

$removecost = 5;

if($logged)
{
    if($account_logged->getCustomField('coins') >= $removecost)
    {
        if($action == "")
        {
            echo '<span style="color:red;font-weight:bold">REMOVE SKULL COSTS ' . $removecost . ' PREMIUM POINTS!</span><br />';
            echo '<form action="?r=' . rand(0,10000) . '" method="post">';
            echo '<input type="hidden" name="subtopic" value="removeskull" />';
            echo '<input type="hidden" name="action" value="remove" />';
            echo '<b>Select player: </b><select name="player_id">';
            $account_players = $account_logged->getPlayersList();
            foreach($account_players as $player)
            {
                echo '<option value="' . $player->getID() . '">' . htmlspecialchars($player->getName()) . '</option>';
            }
            echo '</select><br />';
            echo '<input type="submit" value="remove" />';
            echo '</form>';
        }
        elseif($action == "remove")
        {
           
                $charToEdit = new Player($_REQUEST['player_id']);
            if(!$charToEdit->isLoaded())
                $newchar_errors[] = 'This player does not exist.';
            if ($charToEdit->getSkull() < 4)
                $newchar_errors[] = '<span style="color:red;font-weight:bold">You can only remove red or black skulls!</span><br />';
            if($charToEdit->isOnline())
                $newchar_errors[] = '<span style="color:red;font-weight:bold">This player is ONLINE. Logout first</span><br />';
            elseif($account_logged->getID() != $charToEdit->getAccountID())
                $newchar_errors[] = 'This player is not on your account.';

            if(empty($newchar_errors))
            {

                 $SQL->query('delete from `player_kills` WHERE `player_id` = ' . $charToEdit->getId() . '');
                 $SQL->query('UPDATE  `players` SET skull = 0; skulltime = 0 WHERE `id` = ' . $charToEdit->getId() . '');
                $account_logged->setCustomField('coins', $account_logged->getCustomField('coins') - $removecost);
                echo '<span style="color:red;font-weight:bold">Skull of character ' . htmlspecialchars($charToEdit->getName()) . ' has been removed!</span><br />';
                echo '<br /><a href="?subtopic=removeskull"><b>BACK</b></a>';
            }
            else
            {
                echo 'Some errors occured:<br />';
                foreach($newchar_errors as $e)
                {
                    echo '<li>' . $e . '</li>';
                }
                echo '<br /><a href="?subtopic=removeskull"><b>BACK</b></a>';
            }
        }
    }
    else
        echo 'For this item you need <b>'.$removecost.'</b> points. You have only <b>'.$account_logged->getCustomField('coins').'</b> premium points. <a href="?subtopic=buypoints">buy premium points</a>.';;
   
}
else
    echo '<b><a href="index.php?subtopic=accountmanagement">Login First</a></b>';
 
Last edited:
Back
Top