Ir para conteúdo

Featured Replies

Postado

 

OLÁ A TODOS
VIM AQUI VER SE CONSIGO UM SCRIPT, JÁ OLHEI NO TK E NÃO ENCONTREI
SE PUDEREM ME CRIAR ELE FICARIA GRATO

 

BOM, O SCRIPT SERIA UM SIMPLES TELEPORTE.

ESPECIFICAMENTE UMA SPELL DE TELEPORT BASEADO NO GOKU.

CREIO QUE COM O SCRIPT /GOTO DE STAFF DE PARA FAZE-LA, A UNICA COISA QUE EU IRIA MUDAR

E QUE ELA SOMENTE SERIA USADA EM PLAYERS AO INVÉS DA /GOTO QUE FUNCIONA TANTO EM PLAYER COMO MOBS EM GERAL
E TAMBÉM PRECISARIA QUE ELA TIVESSE UM COOLDOWN DE 10 MINUTOS PARA NÃO SER ABUSIVO.

AQUI O SCRIPT DO /GOTO

 

function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return true
	end

	local creature = getCreatureByName(param)
	local player = getPlayerByNameWildcard(param)
	local waypoint = getWaypointPosition(param)
	local tile = string.explode(param, ",")
	local pos = {x = 0, y = 0, z = 0}

	if(player ~= nil and (not isPlayerGhost(player) or getPlayerGhostAccess(player) <= getPlayerGhostAccess(cid))) then
		pos = getCreaturePosition(player)
	elseif(creature ~= nil and (not isPlayer(creature) or (not isPlayerGhost(creature) or getPlayerGhostAccess(creature) <= getPlayerGhostAccess(cid)))) then
		pos = getCreaturePosition(creature)
	elseif(type(waypoint) == 'table' and waypoint.x ~= 0 and waypoint.y ~= 0) then
		pos = waypoint
	elseif(tile[2] and tile[3]) then
		pos = {x = tile[1], y = tile[2], z = tile[3]}
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
		return true
	end

	if(not pos or isInArray({pos.x, pos.y}, 0)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
		return true
	end

	pos = getClosestFreeTile(cid, pos, true, false)
	if(not pos or isInArray({pos.x, pos.y}, 0)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
		return true
	end

	local tmp = getCreaturePosition(cid)
	if(doTeleportThing(cid, pos, true) and not isPlayerGhost(cid)) then
		doSendMagicEffect(tmp, CONST_ME_POFF)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
	end

	return true
end

OBRIGADO AOS QUE ENTRARAM NESSE TÓPICO

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

Resolvido por WooX

Ir para solução
Postado
  • Solução
local cooldown = 10 * 60

function onSay(cid, words, param)
	if exhaustion.get(cid, 30000) then
		doPlayerSendCancel(cid, "You can only teleport again after ".. exhaustion.get(cid, 30000) .." seconds.")
	elseif (param == "") then
		doPlayerSendCancel(cid, "You need to choose to whom you going to teleport.")
	end

	local target = getPlayerByName(param)
	if (target ~= nil) then
		local oldPos = getThingPos(cid)
		local newPos = getClosestFreeTile(cid, getThingPos(target), true, false)
		doSendMagicEffect(oldPos, CONST_ME_POFF)
		doSendMagicEffect(newPos, CONST_ME_TELEPORT)
		doTeleportThing(cid, newPos)
		exhaustion.set(cid, 30000, cooldown)
	else
		doPlayerSendCancel(cid, "This player does not exist.")
	end
	return true
end

 

 

 

 

Nós somos aquilo que fazemos repetidamente. Excelência, não é um modo de agir, mas um hábito.

                                                                                                                                                                                                                                        Aristóteles 

Postado
  • Autor
3 horas atrás, WooX disse:

local cooldown = 10 * 60

function onSay(cid, words, param)
	if exhaustion.get(cid, 30000) then
		doPlayerSendCancel(cid, "You can only teleport again after ".. exhaustion.get(cid, 30000) .." seconds.")
	elseif (param == "") then
		doPlayerSendCancel(cid, "You need to choose to whom you going to teleport.")
	end

	local target = getPlayerByName(param)
	if (target ~= nil) then
		local oldPos = getThingPos(cid)
		local newPos = getClosestFreeTile(cid, getThingPos(target), true, false)
		doSendMagicEffect(oldPos, CONST_ME_POFF)
		doSendMagicEffect(newPos, CONST_ME_TELEPORT)
		doTeleportThing(cid, newPos)
		exhaustion.set(cid, 30000, cooldown)
	else
		doPlayerSendCancel(cid, "This player does not exist.")
	end
	return true
end

 

 

Opa vlw, poderia me informar se eu utilizo esse script em talkactions ou spells?

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