Ir para conteúdo

Featured Replies

Postado

n man tipo, ele ta conflitando com o mod que vc me passou! e este comando é na fase de test ainda do serv! se eu precisa de lvl rapido! se eu uso o /addskill da erro no script

Tenta pegar lvl 49 e depois upar 1 nvl

Tenta mudar o

player:getLevel() == 50
Para

player:getLevel() >= 50
Fora isso, não vejo nada que atrapalhe o funcionamento

Se quiser sua dúvida tirada, mande PM com os links, e não com a dúvida (outros podem ter a mesma dúvida, e o fórum serve para ser usado).

 

Tópicos:


 

yNlhRVC.png

 

55px-Judo_yellow_belt.svg.png

  • Respostas 16
  • Visualizações 785
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • data/creaturescripts/scripts/ crie : advancepremium.lua local advance = { level = xxx, -- Level que vai ganhar a premium days = 5, -- quantos dias de premium vai ganhar storage = 45646, -- Não me

  • no caso seria: player:addPremiumDays(3) Agora sobre o premio em determinado lvl:     Cria um arquivo em (creaturescripts/scripts) function onAdvance(cid, skill, oldLevel, newLevel) if player:

  • luanluciano93
    luanluciano93

    @, com global storage você resolveria mais fácil usando a account ID.    @, no seu creaturescript/scripts/login.lua, adicione esse código antes do ultimo return true:  if Game.getStorageValue(play

Postado
  • Solução

data/creaturescripts/scripts/ crie : advancepremium.lua

local advance = {
	level = xxx, -- Level que vai ganhar a premium
	days = 5, -- quantos dias de premium vai ganhar
	storage = 45646, -- Não mecher
}

function onAdvance(player, skill, oldLevel, newLevel)

	if skill == SKILL_LEVEL and newLevel == advance.level and player:getStorageValue(advance.storage) < 1 then
		player:addPremiumDays(advance.days)
		player:setStorageValue(advance.storage, 1)
		player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Congratulations! You won '.. advance.days ..'days of premium for advance to level '.. advance.level ..'!')
	end
	return true
end

function onLogin(player)

	player:registerEvent("AdvancePremium")
	return true
end

XML :

<event type="advance" name="AdvancePremium" script="advancepremium.lua" />
<event type="login" name="Verf_AdvancePremium" script="advancepremium.lua" />

Agora o de logar e ganhar 3 dias de premium por account.

 

Primeiro vai no seu phpmyadmin e use comando :

CREATE TABLE `account_storage` (
`account_id` int(11) NOT NULL default '0',
`key` int(10) unsigned NOT NULL default '0',
`value` varchar(255) NOT NULL default '0',
UNIQUE KEY `account_id_2` (`account_id`,`key`),
KEY `account_id` (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

agora vá em data/creaturescripts/script crie firstloginpremium.lua :

function getAccountStorageValue(accid, key)
	local resultId = db.storeQuery("SELECT `account_id`, `key` FROM `account_storage` WHERE `account_id` = " .. accid .. " and `key` = " .. key)
	if resultId ~= false then
		return result.getNumber(resultId, 'key')
	else
		return -1
	end
	return resultId:free()
end

function setAccountStorageValue(accid, key, value)
	local resultId = db.storeQuery("SELECT `value` FROM `account_storage` WHERE `account_id` = " .. accid .. " and `key` = " .. key)
	if resultId ~= false then
		db.query("UPDATE `account_storage` SET `value` = " .. accid .. " WHERE `key`=" .. key .. " LIMIT 1');")
	else
		db.query("INSERT INTO `account_storage` (`account_id`, `key`, `value`) VALUES (" .. accid .. ", " .. key .. ", '"..value.."');")
	end
	return true
end

function onLogin(player)
	local storage = 545465
	local pid = player:getGuid()
	local query = db.storeQuery("SELECT `account_id` FROM `players` WHERE `id` = ".. pid)
	local value = result.getNumber(query, 'account_id')

	if getAccountStorageValue(value, storage) < 1 then
		player:addPremiumDays(3)
		setAccountStorageValue(value, storage, 1)
	end
	return true
end

XML :

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

Créditos ao luanluciano93 por ter me ajudado com as query.

abrçs

Editado por Stinger (veja o histórico de edições)

I must not fear. Fear is the mind killer.

Postado

@, com global storage você resolveria mais fácil usando a account ID.  :bleh: 

@, no seu creaturescript/scripts/login.lua, adicione esse código antes do ultimo return true: 

	if Game.getStorageValue(player:getAccountId()) <= 0 then
		Game.setStorageValue(player:getAccountId(), 1)
		player:addPremiumDays(3)
	end 

Abraços!

Postado

@, com global storage você resolveria mais fácil usando a account ID.  :bleh: 

@, no seu creaturescript/scripts/login.lua, adicione esse código antes do ultimo return true: 

	if Game.getStorageValue(player:getAccountId()) <= 0 then
		Game.setStorageValue(player:getAccountId(), 1)
		player:addPremiumDays(3)
	end 

Abraços!

 

LoL é vdd, tinha até me esquecido :facepalm:  , mas pelo menos valeu eu ter feito, pois aprendi alguns truques com querys.

I must not fear. Fear is the mind killer.

Postado
  • Autor

@, com global storage você resolveria mais fácil usando a account ID.  :bleh: 

@, no seu creaturescript/scripts/login.lua, adicione esse código antes do ultimo return true: 

	if Game.getStorageValue(player:getAccountId()) <= 0 then
		Game.setStorageValue(player:getAccountId(), 1)
		player:addPremiumDays(3)
	end 

Abraços!

o seu quando tentei logar deu erro na distro dizendo que tinha erro no login.lua! quando eu removi consegui loga direitinho!

 

 

data/creaturescripts/scripts/ crie : advancepremium.lua

local advance = {
	level = xxx, -- Level que vai ganhar a premium
	days = 5, -- quantos dias de premium vai ganhar
	storage = 45646, -- Não mecher
}

function onAdvance(player, skill, oldLevel, newLevel)

	if skill == SKILL_LEVEL and newLevel == advance.level and player:getStorageValue(advance.storage) < 1 then
		player:addPremiumDays(advance.days)
		player:setStorageValue(advance.storage, 1)
		player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'Congratulations! You won '.. advance.days ..'days of premium for advance to level '.. advance.level ..'!')
	end
	return true
end

function onLogin(player)

	player:registerEvent("AdvancePremium")
	return true
end

XML :

<event type="advance" name="AdvancePremium" script="advancepremium.lua" />
<event type="login" name="Verf_AdvancePremium" script="advancepremium.lua" />

Agora o de logar e ganhar 3 dias de premium por account.

 

Primeiro vai no seu phpmyadmin e use comando :

CREATE TABLE `account_storage` (
`account_id` int(11) NOT NULL default '0',
`key` int(10) unsigned NOT NULL default '0',
`value` varchar(255) NOT NULL default '0',
UNIQUE KEY `account_id_2` (`account_id`,`key`),
KEY `account_id` (`account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

agora vá em data/creaturescripts/script crie firstloginpremium.lua :

function getAccountStorageValue(accid, key)
	local resultId = db.storeQuery("SELECT `account_id`, `key` FROM `account_storage` WHERE `account_id` = " .. accid .. " and `key` = " .. key)
	if resultId ~= false then
		return result.getNumber(resultId, 'key')
	else
		return -1
	end
	return resultId:free()
end

function setAccountStorageValue(accid, key, value)
	local resultId = db.storeQuery("SELECT `value` FROM `account_storage` WHERE `account_id` = " .. accid .. " and `key` = " .. key)
	if resultId ~= false then
		db.query("UPDATE `account_storage` SET `value` = " .. accid .. " WHERE `key`=" .. key .. " LIMIT 1');")
	else
		db.query("INSERT INTO `account_storage` (`account_id`, `key`, `value`) VALUES (" .. accid .. ", " .. key .. ", '"..value.."');")
	end
	return true
end

function onLogin(player)
	local storage = 545465
	local pid = player:getGuid()
	local query = db.storeQuery("SELECT `account_id` FROM `players` WHERE `id` = ".. pid)
	local value = result.getNumber(query, 'account_id')

	if getAccountStorageValue(value, storage) < 1 then
		player:addPremiumDays(3)
		setAccountStorageValue(value, storage, 1)
	end
	return true
end

XML :

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

Créditos ao luanluciano93 por ter me ajudado com as query.

abrçs

Irei Testar Agora!

wq3bBzt.png
Pokémon Dust Evolution
 
É aonde começa sua nova aventura!! 

 

Facebook

 
Verifique Atualizações

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo