Ir para conteúdo

Featured Replies

Postado

Olá!

 

Boa tarde à todos.

 

Como vocês estão?

 

Pessoal,

 

Não sei se estou com o título correto ou algo do tipo (foi o melhor que pensei).

 

Gostaria de solicitar uma Talkaction/System que mandaria o player para a Jail e retirasse 15% da XP TOTAL do player.


Eu tenho uma prisão montada e só falta os comandos e o sistema.

 

A Versão do servidor é uma das mais recentes: 12.1/12.15.

 

Teria como me ajudar com algo? 

 

Desde já,

 

agradeço a compreensão.

  • Respostas 9
  • Visualizações 1.4k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Tentarei criar o seguinte comando então:   /jail nome,tempo /unjail nome     Outra coisa, o PVP será aberto na prisão?  Fiz aqui rapidinho sendo que a prisão não é PVP

Postado
  • Autor
13 horas atrás, movie disse:

Posso tentar fazer no final de semana. Outra coisa, ele ficaria um tempo determinado ou você iria determinar no comando? Se for no comando, seria de horas ou dias?

 


Oi,

 

Bom dia!

Obrigado pela resposta.

Iria determinar no comando e seria por dias. Por exemplo: 1 dia, 2 dias, 3 dias, 7 dias, 14 dias e 21 dias.

E também teria a possibilidade de criar o /unjail no mesmo e manda-lo para o templo?

Obrigado, mesmo.

Editado por Gabriel Farre
Correção de informações. (veja o histórico de edições)

Postado

Tentarei criar o seguinte comando então:

 

/jail nome,tempo

/unjail nome

 

 

Outra coisa, o PVP será aberto na prisão? 

Fiz aqui rapidinho sendo que a prisão não é PVP.

 

Em talkactions, crie um arquivo lua com o nome jail.lua

local posPrison = Position(x,y,z)

function onSay(player, words, param)
	if not player:getGroup():getAccess() then
		return true
	end

	if player:getAccountType() < ACCOUNT_TYPE_GOD then
		return false
	end
	
	local split = param:split(",")
	local preso = (split[1])
	local tempo = (split[2])
	tempo = tempo * 60 * 24
	
	if not preso then
		player:sendCancelMessage("A player with that name is not online.")
		return false
	end
	
	if not tempo then
		player:sendCancelMessage("Insufficient parameters.")
		return false
	end
	
	if preso:getStorageValue(41234) > os.time() then
		player:sendCancelMessage("The player ".. preso .." is already arrested.")
		return false
	end
	if preso and tempo then
		preso:setStorageValue(41234, (tempo) + os.time())
		preso:getPosition():sendMagicEffect(11)
		preso:sendTextMessage(MESSAGE_STATUS_DEFAULT, "You were arrested until ".. tempo .." days.")
		preso:teleportTo(posPrison)
		posPrison:sendMagicEffect(11)
	else
		player:sendCancelMessage("You need to inform the player and the time (in days) he will be stuck.")
	end
	
	return true
end

 

Em talkactions, crie um arquivo lua com o nome unjail.lua

function onSay(player, words, param)
	if not player:getGroup():getAccess() then
		return true
	end

	if player:getAccountType() < ACCOUNT_TYPE_GOD then
		return false
	end
	
	local targetPlayer = Player(param)
	
	if targetPlayer == nil then
		return false
	end
	
	if not targetPlayer then
		player:sendCancelMessage("Insufficient parameters.")
		return false
	end
	
	if targetPlayer:getStorageValue(41234) <= os.time() then
		player:sendCancelMessage("The player ".. targetPlayer .." is already free.")
		return false
	end
	
	local town = targetPlayer:getTown():getTemplePosition()
	
	if targetPlayer then
		targetPlayer:setStorageValue(41234, 0)
		targetPlayer:getPosition():sendMagicEffect(11)
		targetPlayer:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Congratulations ".. targetPlayer ..", now you are free.")
		targetPlayer:teleportTo(town)
	else
		player:sendCancelMessage("The player is offline.")
	end
	
	return true
end

 

Em talkactions.xml adicione as seguintes tags

<talkaction words="/jail" separator=" " script="jail.lua" />
<talkaction words="/unjail" script="unjail.lua" />

 

Agora em creaturescript, crie um arquivo chamado unjail.lua

function onLogin(player)
	player:registerEvent("unjailLogin")
	player:registerEvent("unjailThink")
	local town = player:getTown():getTemplePosition()
	if player:getStorageValue(41234) > 0 then
		player:teleportTo(town)
		player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Congratulations ".. player ..", now you are free.")
		player:getPosition():sendMagicEffect(11)
	end
end

function OnThink(creature, interval)
	local player = creature:getPlayer()
	local town = player:getTown():getTemplePosition()
	if player:getStorageValue(41234) > 0 then
		player:teleportTo(town)
		player:sendTextMessage(MESSAGE_STATUS_DEFAULT, "Congratulations ".. player ..", now you are free.")
		player:getPosition():sendMagicEffect(11)
	end
end

 

Em creaturescript.xml adicione as seguintes tags

<event type="login" name="unjailLogin" script="unjail_creature.lua"/>
<event type="think" name="unjailThink" interval="60" script="unjail_creature.lua"/>

 

Não é necessário registrar no login.lua

 

Qualquer erro me avisa aqui que eu tento arrumar pra você.

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.6k

Informação Importante

Confirmação de Termo