Ir para conteúdo

Vip System By Account V1.0


Kydrai

Posts Recomendados

Vip System by Account 1.0



By Kydrai

 

Este é um vip system por account, ou seja, um sistema de vip válido para todos os characters de uma determinada conta.

 

O script foi testado no TFS 0.3.6 - 8.54.

E no site Gesior 0.3.4 beta4.

Em caso de erros ou dúvidas é só postar.

 

Funções do Script

Função necessária para começar a usar o script:

installVip() -> Cria a coluna no banco de dados para usar o sistema de vip (testei somente em sqlite, mas acredito que funcione em mysql)

 

Funções que utilizam o account id:

doTeleportPlayersByAccount(acc, topos) -> Teleporta todos os players da account

getVipTimeByAccount(acc) -> Pega o tempo de vip

setVipTimeByAccount(acc, time) -> Edita o tempo de vip

getVipDaysByAccount(acc) -> Pega o tempo de vip em dias

isVipAccount(acc) -> Verifica se é vip

addVipDaysByAccount(acc, days) -> Adiciona dias de vip

doRemoveVipDaysByAccount(acc, days) -> Remove dias de vip

getVipDateByAccount(acc) -> Pega a data e hora que irá terminar a vip

 

Funções que utilizam o creature id (cid):

doTeleportPlayers(cid, topos) -> Teleporta todos os players da account

getVipTime(cid) -> Pega o tempo de vip

setVipTime(cid, time) -> Edita o tempo de vip

getVipDays(cid) -> Pega o tempo de vip em dias

isVip(cid) -> Verifica se é vip

addVipDays(cid, days) -> Adiciona dias de vip

doRemoveVipDays(cid, days) -> Remove dias de vip

getVipDate(cid) -> Pega a data e hora que irá terminar a vip

 

Inserindo as funções

Abra a pasta data/lib, crie um arquivo lua e coloque:

vipAccount.lua

--[[
Name: Vip System by Account
Version: 1.0
Author: Kydrai
Forum: http://www.xtibia.com/forum/topic/136543-vip-system-by-account-v10/

[Functions]
	-- Install
	installVip()

	-- By Account
	doTeleportPlayersByAccount(acc, topos)
	getVipTimeByAccount(acc)
	setVipTimeByAccount(acc, time)
	getVipDaysByAccount(acc)
	isVipAccount(acc)
	addVipDaysByAccount(acc, days)
	doRemoveVipDaysByAccount(acc, days)
	getVipDateByAccount(acc)

	-- By Player
	doTeleportPlayers(cid, topos)
	getVipTime(cid)
	setVipTime(cid, time)
	getVipDays(cid)
	isVip(cid)
	addVipDays(cid, days)
	doRemoveVipDays(cid, days)
	getVipDate(cid)
]]--

-- Install
function installVip()
if db.executeQuery("ALTER TABLE `accounts` ADD viptime INT(15) NOT NULL DEFAULT 0;") then
	print("[Vip System] Vip System instalado com sucesso!")
	return TRUE
end
print("[Vip System] Não foi possível instalar o Vip System!")
return FALSE
end

-- By Account
function doTeleportPlayersByAccount(acc, topos)
if db.executeQuery("UPDATE `players` SET `posx` = "..topos.x..", `posy` = "..topos.y..", `posz` = "..topos.z.." WHERE `account_id` = "..acc..";") then
	return TRUE
end
return FALSE
end

function getVipTimeByAccount(acc)
local vip = db.getResult("SELECT `viptime` FROM `accounts` WHERE `id` = "..acc..";")
if vip:getID() == -1 then
	print("[Vip System] Account not found!")
	return FALSE
end
return vip:getDataInt("viptime")
end

function setVipTimeByAccount(acc, time)
if db.executeQuery("UPDATE `accounts` SET `viptime` = "..time.." WHERE `id` = "..acc..";") then
	return TRUE
end
return FALSE
end

function getVipDaysByAccount(acc)
local vipTime = getVipTimeByAccount(acc)
local timeNow = os.time()
local days = math.ceil((vipTime - timeNow)/(24 * 60 * 60))
return days <= 0 and 0 or days
end

function isVipAccount(acc)
return getVipDaysByAccount(acc) > 0 and TRUE or FALSE
end

function addVipDaysByAccount(acc, days)
if days > 0 then
	local daysValue = days * 24 * 60 * 60
	local vipTime = getVipTimeByAccount(acc)
	local timeNow = os.time()
	local time = getVipDaysByAccount(acc) == 0 and (timeNow + daysValue) or (vipTime + daysValue)
	setVipTimeByAccount(acc, time)
	return TRUE
end
return FALSE
end

function doRemoveVipDaysByAccount(acc, days)
if days > 0 then
	local daysValue = days * 24 * 60 * 60
	local vipTime = getVipTimeByAccount(acc)
	local time = vipTime - daysValue
	setVipTimeByAccount(acc, (time <= 0 and 1 or time))
	return TRUE
end
return FALSE
end

function getVipDateByAccount(acc)
if isVipAccount(acc) then
	local vipTime = getVipTimeByAccount(acc)
	return os.date("%d/%m/%y %X", vipTime)
end
return FALSE
end

-- By Player
function doTeleportPlayers(cid, topos)
doTeleportPlayersByAccount(getPlayerAccountId(cid), topos)
end

function getVipTime(cid)
return getVipTimeByAccount(getPlayerAccountId(cid))
end

function setVipTime(cid, time)
return setVipTimeByAccount(getPlayerAccountId(cid), time)
end

function getVipDays(cid)
return getVipDaysByAccount(getPlayerAccountId(cid))
end

function isVip(cid)
return isVipAccount(getPlayerAccountId(cid))
end

function addVipDays(cid, days)
return addVipDaysByAccount(getPlayerAccountId(cid), days)
end

function doRemoveVipDays(cid, days)
return doRemoveVipDaysByAccount(getPlayerAccountId(cid), days)
end

function getVipDate(cid)
return getVipDateByAccount(getPlayerAccountId(cid))
end

Exemplos de uso

Talkaction

 

GOD:

/installvip

/addvip name, days

/removevip name, days

/checkvip name

 

Player:

/buyvip

/vipdays

 

talkactions.xml:

<talkaction log="yes" access="5" words="/installvip;/addvip;/removevip;/checkvip" event="script" value="vipaccgod.lua"/>
<talkaction words="/buyvip;/vipdays" event="script" value="vipaccplayer.lua"/>

vipaccgod.lua:

function onSay(cid, words, param, channel)
local t = param:explode(",")
local name, days = t[1], tonumber(t[2])
if words == "/installvip" then
	if installVip() then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Vip System instalado com sucesso!")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não foi possível instalar o Vip System!")
	end
elseif words == "/addvip" then
	if name then
		if days then
			local acc = getAccountIdByName(name)
			if acc ~= 0 then
				addVipDaysByAccount(acc, days)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você adicionou "..days.." dia(s) de vip ao "..name..", agora ele possui "..getVipDaysByAccount(acc).." dia(s) de vip.")
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este player não existe.")
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode adicionar essa quantidade de dia(s) de vip.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode adicionar dia(s) de vip a este player.")
	end
elseif words == "/removevip" then
	if name then
		if days then
			local acc = getAccountIdByName(name)
			if acc ~= 0 then
				doRemoveVipDaysByAccount(acc, days)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você retirou "..days.." dia(s) de vip do "..name..", agora ele possui "..getVipDaysByAccount(acc).." dia(s) de vip.")
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este player não existe.")
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode retirar essa quantidade de dia(s) de vip.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode retirar dia(s) de vip a este player.")
	end
elseif words == "/checkvip" then
	if name then
		local acc = getAccountIdByName(name)
		if acc ~= 0 then
			local duration = getVipDateByAccount(acc)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O "..name.." possui "..getVipDaysByAccount(acc).." dias de vip."..(duration and (" Ela irá durar até "..duration..".") or ""))
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Este player não existe.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode visualizar os dias de vip a este player.")
	end
end
return TRUE
end

vipaccplayer.lua:

function onSay(cid, words, param, channel)
if words == "/buyvip" then
	local price = 1000000
	local days = 30
	if doPlayerRemoveMoney(cid, price) then
		addVipDays(cid, days)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você adicionou "..days.." dia(s) de vip, agora você possui "..getVipDays(cid).." dia(s) de vip.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você precisa de "..price.." para adicionar "..days.." dia(s) de vip.")
	end

elseif words == "/vipdays" then
	local duration = getVipDate(cid)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você possui "..getVipDays(cid).." dia(s) de vip."..(duration and (" Ela irá durar até "..duration..".") or ""))
end
return TRUE
end

Movement (Tile)

 

Coloque actionid 15000 em um tile onde somente os vips poderão passar.

 

movements.xml:

<movevent type="StepIn" actionid="15000" event="script" value="viptile.lua"/>

 

viptile.lua:

function onStepIn(cid, item, position, fromPosition)
if isVip(cid) == FALSE then
	doTeleportThing(cid, fromPosition, false)
	doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente players vip podem passar.")
end
return TRUE
end

Creaturescript (Login)

 

Quando player logar irá verificar se a vip do player acabou, se sim então irá teleportar todos os players da account para o templo, se não irá mostrar o tempo da vip.

 

creaturescripts.xml:

<event type="login" name="viplogin" script="viplogin.lua"/>

 

viplogin.lua:

function onLogin(cid)
local vip = isVip(cid)
if getVipTime(cid) > 0  and vip == FALSE then
	local townid = 1
	doPlayerSetTown(cid, townid)
	local templePos = getTownTemplePosition(getPlayerTown(cid))
	doTeleportThing(cid, templePos, false)
	setVipTime(cid, 0)
	doTeleportPlayers(cid, templePos)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua Vip acabou!")
elseif vip == TRUE then
	local duration = getVipDate(cid)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você possui "..getVipDays(cid).." dia(s) de vip."..(duration and (" Ela irá durar até "..duration..".") or ""))
end
return TRUE
end

Action (Door)

 

Coloque actionid 15001 na door onde somente os vips poderão passar. Use a porta gate of expertise (id: 1227)

 

actions.xml:

<action actionid="15001" script="vipdoor.lua"/>

 

vipdoor.lua:

function onUse(cid, item, fromPosition, itemEx, toPosition)
if isVip(cid) == FALSE then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Somente players vip podem passar.")
elseif item.itemid == 1227 then
	doTransformItem(item.uid, item.itemid + 1)
	doTeleportThing(cid, toPosition)
end
return TRUE
end

NPC (Vendedor de VIP)

 

vipnpc.xml:

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Vendedor de VIP" script="vipnpc.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="17" body="54" legs="114" feet="0" addons="2"/>
<parameters>
	<parameter key="message_greet" value="Hello |PLAYERNAME|, I sell {vip} days."/>
</parameters>
</npc>

 

vipnpc.lua:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

function buyVip(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
	return false
end

if doPlayerRemoveMoney(cid, parameters.price) then
	addVipDays(cid, parameters.days)
	npcHandler:say('Thanks, you buy '..parameters.days..' vip days. You have '..getVipDays(cid)..' vip days.', cid)
else
	npcHandler:say('Sorry, you don\'t have enough money.', cid)
end

npcHandler:resetNpc()
return true
end

local node1 = keywordHandler:addKeyword({'vip'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy 30 vip days for 1000000 gp\'s?'})
node1:addChildKeyword({'yes'}, buyVip, {price = 1000000, days = 30})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true})

npcHandler:addModule(FocusModule:new())

 

Erros e Soluções

Erro: Error during getDataInt(viptime).

Motivo: A coluna viptime não está instalada no seu banco de dados.

Solução:

Executar o comando /installvip do exemplo da Talkaction.

Ou executar o comando sql no seu banco de dados:

ALTER TABLE `accounts` ADD viptime INT(15) NOT NULL DEFAULT 0;

Erro: attempt to call global 'getVipTime' (a nil value).

Motivo: A função getVipTime não existe, pois não foi instalada.

Solução:

Você precisa colocar o vipAccount.lua na pasta data/lib.

Em alguns OTs ainda precisa abrir o arquivo data/lib/data.lua e colocar:

dofile(getDataDir() .. "lib/vipAccount.lua")

 

Configurando o Gesior

Com essa configuração irá aparecer o vip status do player no site e será possível vender vip pelo site.

Se eu esqueci de alguma coisa é só avisar.

 

accountmanagement.php

Depois de:

if(!$account_logged->isPremium())
$account_status = '<b><font color="red">Free Account</font></b>';
else
$account_status = '<b><font color="green">Premium Account, '.$account_logged->getPremDays().' days left</font></b>';

Adicione:

if(!$account_logged->isVip())
$account_vip_status = '<b><font color="red">Not Vip Account</font></b>';
else
$account_vip_status = '<b><font color="green">Vip Account, '.$account_logged->getVipDays().' days left</font></b>';

Depois de:

<td class="LabelV" >Account Status:</td><td>'.$account_status.'</td></tr><tr style="background-color:'.$config['site']['darkborder'].';" >

Adicione:

<td class="LabelV" >Account Vip Status:</td><td>'.$account_vip_status.'</td></tr><tr style="background-color:'.$config['site']['darkborder'].';" >

 

pot/OTS_Account.php

Substitua:

private $data = array('email' => '', 'blocked' => false, 'rlname' => '','location' => '','page_access' => 0,'lastday' => 0,'premdays' => 0, 'created' => 0);

Por:

private $data = array('email' => '', 'blocked' => false, 'rlname' => '','location' => '','page_access' => 0,'lastday' => 0,'premdays' => 0, 'created' => 0, 'viptime' => 0);

Substitua:

$this->data = $this->db->query('SELECT ' . $this->db->fieldName('id') . ', ' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('password') . ', ' . $this->db->fieldName('email') . ', ' . $this->db->fieldName('blocked') . ', ' . $this->db->fieldName('rlname') . ', ' . $this->db->fieldName('location') . ', ' . $this->db->fieldName('page_access') . ', ' . $this->db->fieldName('premdays') . ', ' . $this->db->fieldName('lastday') . ', ' . $this->db->fieldName('created') . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . (int) $id)->fetch();

Por:

$this->data = $this->db->query('SELECT ' . $this->db->fieldName('id') . ', ' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('password') . ', ' . $this->db->fieldName('email') . ', ' . $this->db->fieldName('blocked') . ', ' . $this->db->fieldName('rlname') . ', ' . $this->db->fieldName('location') . ', ' . $this->db->fieldName('page_access') . ', ' . $this->db->fieldName('premdays') . ', ' . $this->db->fieldName('viptime') . ', ' . $this->db->fieldName('lastday') . ', ' . $this->db->fieldName('created') . ' FROM ' . $this->db->tableName('accounts') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . (int) $id)->fetch();

Substitua:

$this->db->query('UPDATE ' . $this->db->tableName('accounts') . ' SET ' . $this->db->fieldName('password') . ' = ' . $this->db->quote($this->data['password']) . ', ' . $this->db->fieldName('email') . ' = ' . $this->db->quote($this->data['email']) . ', ' . $this->db->fieldName('blocked') . ' = ' . (int) $this->data['blocked'] . ', ' . $this->db->fieldName('rlname') . ' = ' . $this->db->quote($this->data['rlname']) . ', ' . $this->db->fieldName('location') . ' = ' . $this->db->quote($this->data['location']) . ', ' . $this->db->fieldName('page_access') . ' = ' . (int) $this->data['page_access'] . ', ' . $this->db->fieldName('premdays') . ' = ' . (int) $this->data['premdays'] . ', ' . $this->db->fieldName('lastday') . ' = ' . (int) $this->data['lastday'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);

Por:

$this->db->query('UPDATE ' . $this->db->tableName('accounts') . ' SET ' . $this->db->fieldName('password') . ' = ' . $this->db->quote($this->data['password']) . ', ' . $this->db->fieldName('email') . ' = ' . $this->db->quote($this->data['email']) . ', ' . $this->db->fieldName('blocked') . ' = ' . (int) $this->data['blocked'] . ', ' . $this->db->fieldName('rlname') . ' = ' . $this->db->quote($this->data['rlname']) . ', ' . $this->db->fieldName('location') . ' = ' . $this->db->quote($this->data['location']) . ', ' . $this->db->fieldName('page_access') . ' = ' . (int) $this->data['page_access'] . ', ' . $this->db->fieldName('premdays') . ' = ' . (int) $this->data['premdays'] . ', ' . $this->db->fieldName('viptime') . ' = ' . (int) $this->data['viptime'] . ', ' . $this->db->fieldName('lastday') . ' = ' . (int) $this->data['lastday'] . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']);

Depois de:

public function getPremDays()
{
if( !isset($this->data['premdays']) || !isset($this->data['lastday']) )
{
	throw new E_OTS_NotLoaded();
}

return $this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday']));
}

Adicione:

public function getVipDays()
{
if( !isset($this->data['viptime']) || !isset($this->data['lastday']) )
{
	throw new E_OTS_NotLoaded();
}

return ceil(($this->data['viptime'] - time()) / (24*60*60));
}

Depois de:

public function isPremium()
{
return ($this->data['premdays'] - (date("z", time()) + (365 * (date("Y", time()) - date("Y", $this->data['lastday']))) - date("z", $this->data['lastday'])) > 0);
}

Adicione:

public function isVip()
{
return ceil(($this->data['viptime'] - time()) / (24*60*60)) > 0;
}

 

characters.php

Substitua:

if($config['site']['show_vip_status'])
{
$id = $player->getCustomField("id");
if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=10%>Vip Status:</TD>';
$vip = $SQL->query('SELECT * FROM player_storage WHERE player_id = '.$id.' AND `key` = '.$config['site']['show_vip_storage'].';')->fetch();
if($vip == false) {
	$main_content .= '<TD><span class="red"><B>NOT VIP</B></TD></TR>';
}
else
{
	$main_content .= '<TD><span class="green"><B>VIP</B></TD></TR>';
}
$comment = $player->getComment();
$newlines   = array("\r\n", "\n", "\r");
$comment_with_lines = str_replace($newlines, '<br />', $comment, $count);
if($count < 50)
	$comment = $comment_with_lines;
if(!empty($comment))
{
	if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
	$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD VALIGN=top>Comment:</TD><TD>'.$comment.'</TD></TR>';
}
}

Por:

if($config['site']['show_vip_status'])
{
$id = $player->getCustomField("id");
if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD WIDTH=10%>Account Vip Status:</TD>';
if(!$account->isVip()) {
	$main_content .= '<TD><span class="red"><B>NOT VIP</B></TD></TR>';
}
else
{
	$main_content .= '<TD><span class="green"><B>VIP</B></TD></TR>';
}
$comment = $player->getComment();
$newlines   = array("\r\n", "\n", "\r");
$comment_with_lines = str_replace($newlines, '<br />', $comment, $count);
if($count < 50)
	$comment = $comment_with_lines;
if(!empty($comment))
{
	if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++;
	$main_content .= '<TR BGCOLOR="'.$bgcolor.'"><TD VALIGN=top>Comment:</TD><TD>'.$comment.'</TD></TR>';
}
}

 

shopsystem.php (+Créditos ao GM Bekman)

Substitua:

if($buy_offer['type'] == 'pacc')
{
$player_premdays = $buy_player_account->getCustomField('premdays');
$player_lastlogin = $buy_player_account->getCustomField('lastday');
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_pacc').' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['days']).', \'realized\', '.$SQL->quote(time()).', '.$SQL->quote(time()).');';
$SQL->query($save_transaction);
$buy_player_account->setCustomField('premdays', $player_premdays+$buy_offer['days']);
$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];
if($player_premdays == 0)
{
	$buy_player_account->setCustomField('lastday', time());
}
$main_content .= '<h2>PACC added!</h2><b>'.$buy_offer['days'].' days</b> of Premium Account added to account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br /><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a>';
}

Por:

if($buy_offer['type'] == 'pacc')
{
$player_viptime = $buy_player_account->getCustomField('viptime');
$player_lastlogin = $buy_player_account->getCustomField('lastday');
$save_transaction = 'INSERT INTO '.$SQL->tableName('z_shop_history_pacc').' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, '.$SQL->quote($buy_player->getName()).', '.$SQL->quote($buy_player_account->getId()).', '.$SQL->quote($buy_from).',  '.$SQL->quote($account_logged->getId()).', '.$SQL->quote($buy_offer['points']).', '.$SQL->quote($buy_offer['days']).', \'realized\', '.$SQL->quote(time()).', '.$SQL->quote(time()).');';
$SQL->query($save_transaction);

if($player_viptime > 0)
	$buy_player_account->setCustomField('viptime', $player_viptime + ($buy_offer['days'] * 24 * 60 * 60));
else
	$buy_player_account->setCustomField('viptime', time() + ($buy_offer['days'] * 24 * 60 * 60));

$account_logged->setCustomField('premium_points', $user_premium_points-$buy_offer['points']);
$user_premium_points = $user_premium_points - $buy_offer['points'];
if($player_viptime == 0)
{
	$buy_player_account->setCustomField('lastday', time());
}
$main_content .= '<h2>VIP Days added!</h2><b>'.$buy_offer['days'].' days</b> of Vip Account added to account of player <b>'.$buy_player->getName().'</b> for <b>'.$buy_offer['points'].' premium points</b> from your account.<br />Now you have <b>'.$user_premium_points.' premium points</b>.<br /><a href="index.php?subtopic=shopsystem">GO TO MAIN SHOP SITE</a>';
}

 

Links Úteis

01- [Gesior Acc] Vendedo Vip Pelo Pacc

Créditos: GM Bekman

 

02- Double Exp Para Vip

Créditos: Vodkart

 

03- Outfits Só Para Jogadores Vips

Créditos: Vodkart

Editado por kydrai
Link para o comentário
Compartilhar em outros sites

Muito bom cara, isso ira ajudar muita gente.

 

+REP (PS: Atingi meu limite de +REP por hoje, quando voltar eu ponho ;*)

 

Abraços.

Editado por Guilhermee56
Link para o comentário
Compartilhar em outros sites

ui

Agora sim um sistema que podemos chamar de perfeito!

ainda mais desenvolvido por ninguem mais,nimguem menos que o kydrai!

parabens cara ótimo trabalho,ficou divino!

acho que até meria FIXO - rsrs

 

parabens novamente,continue assim (:

 

abraços xará

Link para o comentário
Compartilhar em outros sites

Vlw pelos comentários.

 

@hretro

Error during getDataInt(viptime).

Explica quando deu o erro.

Provavelmente é poque vc não instalou a tabela, coloque o exemplo da talkaction e execute o comando /installvip.

Link para o comentário
Compartilhar em outros sites

Tipo coloka esses negossio

 

installVip()

doTeleportPlayersByAccount(acc, topos)

getVipTimeByAccount(acc)

setVipTimeByAccount(acc, time)

getVipDaysByAccount(acc)

isVipAccount(acc)

addVipDaysByAccount(acc, days)

 

eu n sei como fasso esses negossio

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...