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

Premium Days x VIP DAYS

GOD Half

Member
Joined
May 9, 2010
Messages
179
Reaction score
15
Please.

When I buy VIP Days at the site with my points, the character gets days of premium. I wanted him to win VIP DAYS, unlike Premium Days. Does anyone know how to configure this?

Should be more or less here (or no), at shopsystem.php:

Code:
if(isset($buy_offer['id'])) {  //item exist in database
						if($user_premium_points >= $buy_offer['points']) {
							if(check_name($buy_name)) {
								$buy_player = new OTS_Player();
								$buy_player->find($buy_name);
								if($buy_player->isLoaded()) {
									$buy_player_account = $buy_player->getAccount();
									if($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes') {
										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 .= '<center><h2>Premium ACcount added!</h2><b>'.$buy_offer['days'].' days</b> of Premium Account added to the 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><br><a href="index.php?subtopic=shopsystem">Go to Shop Site</a><br>';
											}


The command for add VIP to players is this, in talkactions:

Code:
function onSay(cid, words, param)
	local Data = string.explode(param, ",")
	if Data then
		local Target = db.getResult("SELECT `name` FROM `players` WHERE `name` = " .. db.escapeString(Data[1]) .. ";")
		if Data then
			if (Target:getID() ~= -1) then
				if Data[2] then
					if (words:sub(2, 2) == "a") then
						if isNumber(Data[2]) == TRUE then
							if vipTimeByName(Data[1]) == 0 then
								db.executeQuery("UPDATE `accounts` SET `vip_time` = 86400 * ".. Data[2] .." + ".. os.time() .." WHERE `accounts`.`id` = ".. getAccountIdByName(Data[1]) ..";")
							else
								db.executeQuery("UPDATE `accounts` SET `vip_time` = `accounts`.`vip_time` + (86400 * ".. Data[2] ..") WHERE `accounts`.`id` = ".. getAccountIdByName(Data[1]) ..";")
							end
							db.executeQuery("UPDATE `accounts` SET `vip` = 1 WHERE `accounts`.`id` = ".. getAccountIdByName(Data[1]) .." LIMIT 1;")
							db.executeQuery("UPDATE `accounts` SET `vip_days` = `accounts`.`vip_days` + ".. Data[2] .." WHERE `accounts`.`id` = ".. getAccountIdByName(Data[1]) ..";")
							doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foi adicionado ".. Data[2] .." dias de vip ao player ".. Data[1] ..".")
						else
							doPlayerSendCancel(cid, "Insira apenas numeros.")
						end
					else
						doPlayerSendCancel(cid, "Para verificar uma vip não presisa inserir os dias.")
					end
				else
					if (words:sub(2, 2) == "c") then
						if vipDaysByName(Data[1]) == 0 then
							doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "O player ".. Data[1] .." não é vip.")
						elseif vipDaysByName(Data[1]) == 1 then
							doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "O player ".. Data[1] .." tem ".. vipDaysByName(Data[1]) .." dia de vip.")
						else
							doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "O player ".. Data[1] .." tem ".. vipDaysByName(Data[1]) .." dias de vip.")
						end
					else
						doPlayerSendCancel(cid, "Insira a quantidade de dias que vai adicionar de vip ao player.")
					end
				end
			else
				doPlayerSendCancel(cid, "Este player ".. Data[1] .." não existe.")
			end
		end
	else
		doPlayerSendCancel(cid, "Insira um nome.")
	end
	return TRUE
end

and at SQL i have:

Code:
ALTER TABLE `accounts` ADD `vip` TINYINT( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `accounts` ADD `vip_days` INT( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `accounts` ADD `vip_time` INT( 11 ) NOT NULL DEFAULT '0';

Thanks again..
 
Last edited:
Back
Top