Ir para conteúdo
  • 0

Swimming


ScythePhantom

Pergunta

Olá, gostaria de pedir que colocassem uma função que não retirasse o pz do player, pois tipo, ao player nada lá na prainha, ao "mergulhar" na água, o pz do mesmo é retirado.

 

Swimming.lua

 

local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

local BORDERS = {
[7943] = {x = 0, y = -2, back = SOUTH},
[7944] = {x = -2, y = 0, back = EAST},
[7945] = {x = 0, y = 2, back = NORTH},
[7946] = {x = 2, y = 0, back = WEST},
[7947] = {x = 2, y = 1, back = WEST},
[7948] = {x = -2, y = 1, back = NORTH},
[7949] = {x = 2, y = -1, back = WEST},
[7950] = {x = -2, y = -1, back = EAST},
[7951] = {x = 2, y = 2, back = WEST},
[7952] = {x = -2, y = 2, back = NORTH},
[7953] = {x = 2, y = -2, back = WEST},
[7954] = {x = -2, y = -2, back = SOUTH}
}

BORDERS[4828] = BORDERS[7943]
BORDERS[4829] = BORDERS[7946]
BORDERS[4830] = BORDERS[7945]
BORDERS[4831] = BORDERS[7944]

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
if(not isPlayer(cid)) then
return true
end

local border = BORDERS[item.itemid]
if(not border) then
return false
end

local pos, newPos = getCreaturePosition(cid), {}
newPos = pos
newPos.x = pos.x + border.x
newPos.y = pos.y + border.y

if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
doMoveCreature(cid, border.back)
doRemoveCondition(cid, CONDITION_OUTFIT)
else
if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
return false
end

local tmp = getCreaturePosition(cid)
doTeleportThing(cid, newPos)

if(not isPlayerGhost(cid)) then
doSendMagicEffect(tmp, CONST_ME_POFF)
doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
end

doRemoveConditions(cid, true)
doSetCreatureOutfit(cid, outfit, -1)
end

return true
end

 

 

Obrigado, REP+

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • 0

local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

local BORDERS = {
[7943] = {x = 0, y = -2, back = SOUTH},
[7944] = {x = -2, y = 0, back = EAST},
[7945] = {x = 0, y = 2, back = NORTH},
[7946] = {x = 2, y = 0, back = WEST},
[7947] = {x = 2, y = 1, back = WEST},
[7948] = {x = -2, y = 1, back = NORTH},
[7949] = {x = 2, y = -1, back = WEST},
[7950] = {x = -2, y = -1, back = EAST},
[7951] = {x = 2, y = 2, back = WEST},
[7952] = {x = -2, y = 2, back = NORTH},
[7953] = {x = 2, y = -2, back = WEST},
[7954] = {x = -2, y = -2, back = SOUTH}
}

BORDERS[4828] = BORDERS[7943]
BORDERS[4829] = BORDERS[7946]
BORDERS[4830] = BORDERS[7945]
BORDERS[4831] = BORDERS[7944]

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	
	if not isPlayer(cid) or isPlayerPzLocked(cid) then
		doTeleportThing(cid, fromPosition)
		return false
	end

	local border = BORDERS[item.itemid]
	if(not border) then
		return false
	end

	local pos, newPos = getCreaturePosition(cid), {}
	newPos = pos
	newPos.x = pos.x + border.x
	newPos.y = pos.y + border.y

	if(hasCondition(cid, CONDITION_OUTFIT) and getCreatureOutfit(cid).lookType == outfit.lookType) then
		doMoveCreature(cid, border.back)
		doRemoveCondition(cid, CONDITION_OUTFIT)
	else
		if(doTileQueryAdd(cid, pos, 4) ~= RETURNVALUE_NOERROR) then
			return false
		end

		local tmp = getCreaturePosition(cid)
		doTeleportThing(cid, newPos)

		if(not isPlayerGhost(cid)) then
			doSendMagicEffect(tmp, CONST_ME_POFF)
			doSendMagicEffect(newPos, CONST_ME_WATERSPLASH)
		end



		doRemoveConditions(cid, true)
		doSetCreatureOutfit(cid, outfit, -1)
	end

	return true
end

Tópico movido para a seção de dúvidas e pedidos resolvidos.

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...