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

AAC Account Status Gesior - Free Account or VIP Account

potinho

Intermediate OT User
Joined
Oct 11, 2009
Messages
1,397
Solutions
17
Reaction score
148
Location
Brazil
I use Gesior as the website for my server and the Account Status always shows up as "Free Account" for all accounts. I would like the accounts where there were players with Storage 300019 to be marked as "VIP Accounts" or "Premium Accounts" in Gesior, how to fix? Follow my characters.php
Post automatically merged:

rar
 

Attachments

Last edited:
Solution
Replace:
PHP:
        if($config['site']['show_vip_storage'] > 0)
        {
            $bgcolor = (($number_of_rows++ % 2 == 1) ?  $config['site']['darkborder'] : $config['site']['lightborder']);
            $main_content .= '<tr bgcolor="' . $bgcolor . '"><td>VIP:</td><td>' . (($player->getStorage($config['site']['show_vip_storage']) === null) ? '<span style="font-weight:bold;color:red">NOT VIP</span>' : '<span style="font-weight:bold;color:green">VIP</span>') . '</td></tr>';
        }
with:
PHP:
        $storageData = $SQL->query('SELECT `value` FROM account_storage WHERE account_id = ' . $account->getID() . ' AND `key` = 30009')->fetch();
        if ($storageData) {
            $storageValue = (int) $storageData['value'];
        }...
up, in accountmanagement.php i have:

PHP:
    if($action == "")
    {
        $account_reckey = $account_logged->getCustomField("key");
        if($account_logged->getPremDays() > 0)
            $account_status = '<b><font color="green">VIP Account, '. $account_logged->getPremDays() .' days left</font></b>';
        else
            $account_status = '<b><font color="red">Free Account</font></b>';

My VIP system obbey a storage in table "account_storage", like this:
1636564355933.png
 
Last edited:
which VIP system do you use? post info of vip system
its custom vip system, using account_storage.

Lua:
VIP_ACCOUNT_STORAGE = 30009

function getAccountStorage(cid, key)
  local ret = db.getResult("SELECT `value` FROM `account_storage` WHERE `account_id` = ".. getPlayerAccountId(cid) .." AND `key` = "..key)
  if ret:getID() == -1 then
    return -1
  end
  return ret:getDataInt("value") or ret:getDataString("value")
end

function setAccountStorage(cid, key, value)
  local func = db.executeQuery or db.query
  local query = db.getResult("SELECT `value` FROM `account_storage` WHERE `key` = ".. key .." AND `account_id` = ".. getPlayerAccountId(cid))
  if query:getID() == -1 then
    return func("INSERT INTO `account_storage` (`account_id`, `key`, `value`) VALUES (".. getPlayerAccountId(cid) ..", ".. key ..", ".. value ..")")
  end
  return func("UPDATE `account_storage` SET `value` = ".. value .." WHERE `key` = ".. key .." AND `account_id` = ".. getPlayerAccountId(cid))
end

function isVIP(cid)
  return getAccountVIP(cid) > 0
end

function getAccountVIP(cid)
  return (getAccountStorage(cid, VIP_ACCOUNT_STORAGE) - os.time() > 0) and getAccountStorage(cid, VIP_ACCOUNT_STORAGE) - os.time() or 0
end

function setAccountVIP(cid, days)
  return setAccountStorage(cid, VIP_ACCOUNT_STORAGE, os.time() + (60 * 60 * 24 * days) + (getAccountVIP(cid) > 0 and  getAccountVIP(cid) or 0))
end
 
Take a look at this line @ your config.php:

PHP:
$config['site']['show_vip_storage'] = 0;

Then replace the characters.php code you posted with this one:

PHP:
if($config['site']['show_vip_storage'] > 0)
        {
            $storageValue = $player->getStorage($config['site']['show_vip_storage']);
            $bgcolor = (($number_of_rows++ % 2 == 1) ?  $config['site']['darkborder'] : $config['site']['lightborder']);
            $main_content .= '<tr bgcolor="' . $bgcolor . '"><td>VIP:</td><td>' . (($storageValue === null || $storageValue < 0) ? '<span style="font-weight:bold;color:red">NOT VIP</span>' : '<span style="font-weight:bold;color:green">VIP</span>') . '</td></tr>';
 
Hummmm, got it. But not work, i changed to this value and it validating by player storage, need to be account_storage.

Fatal error: Uncaught Error: Call to undefined method Account::getStorage() in C:\xampp\htdocs\pages\characters.php:60 Stack trace: #0 C:\xampp\htdocs\system\load.page.php(7): include() #1 C:\xampp\htdocs\index.php(40): include_once('C:\\xampp\\htdocs...') #2 {main} thrown in C:\xampp\htdocs\pages\characters.php on line 60

My vip system is validating in this table:
1636578866908.png
 
Last edited:
try
I dont know if it work
Take a look at this line @ your config.php:

PHP:
$config['site']['show_vip_storage'] = 0;

Then replace the characters.php code you posted with this one:

PHP:
if($config['site']['show_vip_storage'] > 0)
        {
            $storageValue = $player->getStorage($config['site']['show_vip_storage']);
            $bgcolor = (($number_of_rows++ % 2 == 1) ?  $config['site']['darkborder'] : $config['site']['lightborder']);
            $main_content .= '<tr bgcolor="' . $bgcolor . '"><td>VIP:</td><td>' . (($storageValue === null || $storageValue < 0) ? '<span style="font-weight:bold;color:red">NOT VIP</span>' : '<span style="font-weight:bold;color:green">VIP</span>') . '</td></tr>';

PHP:
$storageValue = $SQL->query('SELECT * FROM account_storage WHERE account_id = '.$player['account_id'].'')->fetch();
            $bgcolor = (($number_of_rows++ % 2 == 1) ?  $config['site']['darkborder'] : $config['site']['lightborder']);
            $main_content .= '<tr bgcolor="' . $bgcolor . '"><td>VIP:</td><td>' . (($storageValue === null || $storageValue < 0) ? '<span style="font-weight:bold;color:red">NOT VIP</span>' : '<span style="font-weight:bold;color:green">VIP</span>') . '</td></tr>';
 
try
I dont know if it work


PHP:
$storageValue = $SQL->query('SELECT * FROM account_storage WHERE account_id = '.$player['account_id'].'')->fetch();
            $bgcolor = (($number_of_rows++ % 2 == 1) ?  $config['site']['darkborder'] : $config['site']['lightborder']);
            $main_content .= '<tr bgcolor="' . $bgcolor . '"><td>VIP:</td><td>' . (($storageValue === null || $storageValue < 0) ? '<span style="font-weight:bold;color:red">NOT VIP</span>' : '<span style="font-weight:bold;color:green">VIP</span>') . '</td></tr>';
got error:

Fatal error: Uncaught Error: Cannot use object of type Player as array in C:\xampp\htdocs\pages\characters.php:60 Stack trace: #0 C:\xampp\htdocs\system\load.page.php(7): include() #1 C:\xampp\htdocs\index.php(40): include_once('C:\\xampp\\htdocs...') #2 {main} thrown in C:\xampp\htdocs\pages\characters.php on line 60

I guess the SQL query must have key too, dont? Like:

SELECT value FROM account_storage WHERE account_id = ".. getPlayerAccountId(cid) .." AND key = "..key

Post automatically merged:

Or is there any way for players on an account to get the account_storage and have the same value with the same key? Well then we wouldn't need to change the structure. All players on an account would have the same value in both "player_storage" and "account_storage"
 
Last edited:
Replace:
PHP:
        if($config['site']['show_vip_storage'] > 0)
        {
            $bgcolor = (($number_of_rows++ % 2 == 1) ?  $config['site']['darkborder'] : $config['site']['lightborder']);
            $main_content .= '<tr bgcolor="' . $bgcolor . '"><td>VIP:</td><td>' . (($player->getStorage($config['site']['show_vip_storage']) === null) ? '<span style="font-weight:bold;color:red">NOT VIP</span>' : '<span style="font-weight:bold;color:green">VIP</span>') . '</td></tr>';
        }
with:
PHP:
        $storageData = $SQL->query('SELECT `value` FROM account_storage WHERE account_id = ' . $account->getID() . ' AND `key` = 30009')->fetch();
        if ($storageData) {
            $storageValue = (int) $storageData['value'];
        } else {
            $storageValue = 0;
        }
        $bgcolor = (($number_of_rows++ % 2 == 1) ?  $config['site']['darkborder'] : $config['site']['lightborder']);
        $main_content .= '<tr bgcolor="' . $bgcolor . '"><td>VIP:</td><td>' . (($storageValue < time()) ? '<span style="font-weight:bold;color:red">NOT VIP</span>' : '<span style="font-weight:bold;color:green">VIP</span>') . '</td></tr>';
 
Solution
Replace:
PHP:
        if($config['site']['show_vip_storage'] > 0)
        {
            $bgcolor = (($number_of_rows++ % 2 == 1) ?  $config['site']['darkborder'] : $config['site']['lightborder']);
            $main_content .= '<tr bgcolor="' . $bgcolor . '"><td>VIP:</td><td>' . (($player->getStorage($config['site']['show_vip_storage']) === null) ? '<span style="font-weight:bold;color:red">NOT VIP</span>' : '<span style="font-weight:bold;color:green">VIP</span>') . '</td></tr>';
        }
with:
PHP:
        $storageData = $SQL->query('SELECT `value` FROM account_storage WHERE account_id = ' . $account->getID() . ' AND `key` = 30009')->fetch();
        if ($storageData) {
            $storageValue = (int) $storageData['value'];
        } else {
            $storageValue = 0;
        }
        $bgcolor = (($number_of_rows++ % 2 == 1) ?  $config['site']['darkborder'] : $config['site']['lightborder']);
        $main_content .= '<tr bgcolor="' . $bgcolor . '"><td>VIP:</td><td>' . (($storageValue < time()) ? '<span style="font-weight:bold;color:red">NOT VIP</span>' : '<span style="font-weight:bold;color:green">VIP</span>') . '</td></tr>';
Worked Gesior, thanks!

There's a way to change account information too?

1658494477810.png

Account Status to "VIP Account" if has vip?
 
Back
Top