Ir para conteúdo
  • 0

[Resolvido] [PEDIDO] Bike System - Efeito ao andar


JS Lotus

Pergunta

Será que alguém poderia me ajudar em uma coisa aqui?

Tenho um sistema de bike funcionando perfeitamente, por slots, etc. Só que quero que ao andar montado na bike, fique um efeito 1SQM atrás do player.

 

Imagem de exemplo: 

Spoiler

40751983_2107441549313391_24857410215314

 

Meu script: 

Spoiler

function onUse(cid, item, fromPosition, itemEx, toPosition)
local sBike = 7857 or 7858
local t = {
[7857] = {article='a', name='bike',  s=5700, condition=bikeCondition},
[7858] = {article='a', name='bike',  s=5700, condition=bikeCondition},
}

function BikeSpeedOn(cid,nSpeed)
doTransformItem(itemEx.uid, 7858)
setPlayerStorageValue(cid,sBike,getCreatureSpeed(cid))
doChangeSpeed(cid,-getCreatureSpeed(cid))
doChangeSpeed(cid,nSpeed)
end

function BikeSpeedOff(cid)
doTransformItem(itemEx.uid, 7857)
doChangeSpeed(cid,-getCreatureSpeed(cid))
doChangeSpeed(cid,getPlayerStorageValue(cid,sBike))
end

local v, r = getCreaturePosition(cid), t[item.itemid]
local s = r.s
local pos = {x = v.x, y = v.y, z = v.z}
if r then

if getPlayerStorageValue(cid, 17001) == 1 or getPlayerStorageValue(cid, 63215) == 1 or getPlayerStorageValue(cid, 17000) == 1 then
return doPlayerSendCancel(cid, "Voce nao pode montar na (BIKE) se estiver no ride/fly/surf.")
end

if getPlayerSlotItem(cid, CONST_SLOT_RING).uid ~= item.uid then
return doPlayerSendCancel(cid, "Voce precisa por a (BIKE) no lugar correto.")
end

if getPlayerStorageValue(cid, s) <= 0 then
setPlayerStorageValue(cid, s, 1)
BikeSpeedOn(cid,1000)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = 897, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
else
doSetCreatureOutfit(cid, {lookType = 897, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
end


elseif getPlayerStorageValue(cid, s) == 1 then
setPlayerStorageValue(cid, s, 0)
BikeSpeedOff(cid)
return doRemoveCondition(cid, CONDITION_OUTFIT)
else
return doPlayerSendCancel(cid, 'You can\'t do this.')
end
else
return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'Report bugs in Bike system.')
end
end

 

Quem puder ajudar agradeço. Obrigado!

Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 1

Seu servidor possui o arquivo Movement_Effects.lua em data/lib? Se possui, tenta assim:

Spoiler

function onUse(cid, item, fromPosition, itemEx, toPosition)
local sBike = 7857 or 7858
local efeito = 21
local t = {
[7857] = {article='a', name='bike',  s=5700, condition=bikeCondition},
[7858] = {article='a', name='bike',  s=5700, condition=bikeCondition},
}

function BikeSpeedOn(cid,nSpeed)
	doTransformItem(itemEx.uid, 7858)
	setPlayerStorageValue(cid,sBike,getCreatureSpeed(cid))
	doChangeSpeed(cid,-getCreatureSpeed(cid))
	doChangeSpeed(cid,nSpeed)
	markPosEff(cid, getThingPos(cid))
	sendMovementEffect(cid, efeito, getThingPos(cid))
end

function BikeSpeedOff(cid)
	doTransformItem(itemEx.uid, 7857)
	doChangeSpeed(cid,-getCreatureSpeed(cid))
	doChangeSpeed(cid,getPlayerStorageValue(cid,sBike))
end

local v, r = getCreaturePosition(cid), t[item.itemid]
local s = r.s
local pos = {x = v.x, y = v.y, z = v.z}
if r then

if getPlayerStorageValue(cid, 17001) == 1 or getPlayerStorageValue(cid, 63215) == 1 or getPlayerStorageValue(cid, 17000) == 1 then
	return doPlayerSendCancel(cid, "Voce nao pode montar na (BIKE) se estiver no ride/fly/surf.")
end

if getPlayerSlotItem(cid, CONST_SLOT_RING).uid ~= item.uid then
	return doPlayerSendCancel(cid, "Voce precisa por a (BIKE) no lugar correto.")
end

if getPlayerStorageValue(cid, s) <= 0 then
	setPlayerStorageValue(cid, s, 1)
	BikeSpeedOn(cid,1000)
	if getPlayerSex(cid) == 1 then
		doSetCreatureOutfit(cid, {lookType = 897, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
	else
		doSetCreatureOutfit(cid, {lookType = 897, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
	end
elseif getPlayerStorageValue(cid, s) == 1 then
	setPlayerStorageValue(cid, s, 0)
	BikeSpeedOff(cid)
	return doRemoveCondition(cid, CONDITION_OUTFIT)
else
	return doPlayerSendCancel(cid, 'You can\'t do this.')
end
else
	return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'Report bugs in Bike system.')
end
end

 

Se não possui, tente assim:

Spoiler

function onUse(cid, item, fromPosition, itemEx, toPosition)
local sBike = 7857 or 7858
local efeito = 21
local t = {
	[7857] = {article='a', name='bike',  s=5700, condition=bikeCondition},
	[7858] = {article='a', name='bike',  s=5700, condition=bikeCondition},
}

function markPosEffBike(sid, pos)
	if not isCreature(sid) then return end
	setPlayerStorageValue(sid, 26547, pos.x)
	setPlayerStorageValue(sid, 26548, pos.y)
	setPlayerStorageValue(sid, 26549, pos.z)
end

function getMarkedPosEffBike(sid)
	if not isCreature(sid) then return end
	local xx = getPlayerStorageValue(sid, 26547)
	local yy = getPlayerStorageValue(sid, 26548)
	local zz = getPlayerStorageValue(sid, 26549)
	return {x = xx, y = yy, z = zz}
end

function sendMoveEffectBike(cid, effect, pos)
	if isCreature(cid) then
		if pos then
			doSendMagicEffect(pos, effect)
		else
			doSendMagicEffect(getThingPos(cid), effect)
		end
	end
end

function sendMovementEffectBike(cid, eff, pos)
	if isCreature(cid) then
		local nPos = getMarkedPosEffBike(cid)

		if pos.x ~= nPos.x or pos.y ~= nPos.y then
			sendMoveEffectBike(cid, eff, nPos)
			markPosEffBike(cid, getThingPos(cid))
		end
		addEvent(sendMovementEffectBike, 100, cid, eff, getThingPos(cid)) 
	end
end

function BikeSpeedOn(cid,nSpeed)
	doTransformItem(itemEx.uid, 7858)
	setPlayerStorageValue(cid,sBike,getCreatureSpeed(cid))
	doChangeSpeed(cid,-getCreatureSpeed(cid))
	doChangeSpeed(cid,nSpeed)
	markPosEffBike(cid, getThingPos(cid))
	sendMovementEffectBike(cid, efeito, getThingPos(cid))
end

function BikeSpeedOff(cid)
	doTransformItem(itemEx.uid, 7857)
	doChangeSpeed(cid,-getCreatureSpeed(cid))
	doChangeSpeed(cid,getPlayerStorageValue(cid,sBike))
end

local v, r = getCreaturePosition(cid), t[item.itemid]
local s = r.s
local pos = {x = v.x, y = v.y, z = v.z}
if r then
	if getPlayerStorageValue(cid, 17001) == 1 or getPlayerStorageValue(cid, 63215) == 1 or getPlayerStorageValue(cid, 17000) == 1 then
		return doPlayerSendCancel(cid, "Voce nao pode montar na (BIKE) se estiver no ride/fly/surf.")
	end

	if getPlayerSlotItem(cid, CONST_SLOT_RING).uid ~= item.uid then
		return doPlayerSendCancel(cid, "Voce precisa por a (BIKE) no lugar correto.")
	end

	if getPlayerStorageValue(cid, s) <= 0 then
		setPlayerStorageValue(cid, s, 1)
		BikeSpeedOn(cid,1000)
		if getPlayerSex(cid) == 1 then
			doSetCreatureOutfit(cid, {lookType = 897, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
		else
			doSetCreatureOutfit(cid, {lookType = 897, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
		end
	elseif getPlayerStorageValue(cid, s) == 1 then
		setPlayerStorageValue(cid, s, 0)
		BikeSpeedOff(cid)
		return doRemoveCondition(cid, CONDITION_OUTFIT)
	else
		return doPlayerSendCancel(cid, 'You can\'t do this.')
	end
else
	return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'Report bugs in Bike system.')
end
end

 

 

Link para o comentário
Compartilhar em outros sites

  • 0
37 minutos atrás, JS Lotus disse:

Será que alguém poderia me ajudar em uma coisa aqui?

Tenho um sistema de bike funcionando perfeitamente, por slots, etc. Só que quero que ao andar montado na bike, fique um efeito 1SQM atrás do player.

 

Imagem de exemplo: 

  Mostrar conteúdo oculto

40751983_2107441549313391_24857410215314

 

Meu script: 

  Ocultar conteúdo

function onUse(cid, item, fromPosition, itemEx, toPosition)
local sBike = 7857 or 7858
local t = {
[7857] = {article='a', name='bike',  s=5700, condition=bikeCondition},
[7858] = {article='a', name='bike',  s=5700, condition=bikeCondition},
}

function BikeSpeedOn(cid,nSpeed)
doTransformItem(itemEx.uid, 7858)
setPlayerStorageValue(cid,sBike,getCreatureSpeed(cid))
doChangeSpeed(cid,-getCreatureSpeed(cid))
doChangeSpeed(cid,nSpeed)
end

function BikeSpeedOff(cid)
doTransformItem(itemEx.uid, 7857)
doChangeSpeed(cid,-getCreatureSpeed(cid))
doChangeSpeed(cid,getPlayerStorageValue(cid,sBike))
end

local v, r = getCreaturePosition(cid), t[item.itemid]
local s = r.s
local pos = {x = v.x, y = v.y, z = v.z}
if r then

if getPlayerStorageValue(cid, 17001) == 1 or getPlayerStorageValue(cid, 63215) == 1 or getPlayerStorageValue(cid, 17000) == 1 then
return doPlayerSendCancel(cid, "Voce nao pode montar na (BIKE) se estiver no ride/fly/surf.")
end

if getPlayerSlotItem(cid, CONST_SLOT_RING).uid ~= item.uid then
return doPlayerSendCancel(cid, "Voce precisa por a (BIKE) no lugar correto.")
end

if getPlayerStorageValue(cid, s) <= 0 then
setPlayerStorageValue(cid, s, 1)
BikeSpeedOn(cid,1000)
if getPlayerSex(cid) == 1 then
doSetCreatureOutfit(cid, {lookType = 897, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
else
doSetCreatureOutfit(cid, {lookType = 897, lookHead = 0, lookAddons = 0, lookLegs = 0, lookBody = 0, lookFeet = 0}, -1)
end


elseif getPlayerStorageValue(cid, s) == 1 then
setPlayerStorageValue(cid, s, 0)
BikeSpeedOff(cid)
return doRemoveCondition(cid, CONDITION_OUTFIT)
else
return doPlayerSendCancel(cid, 'You can\'t do this.')
end
else
return doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE, 'Report bugs in Bike system.')
end
end

 

Quem puder ajudar agradeço. Obrigado!

Igual do otp que você quer ??

Editado por Lucasmito
Link para o comentário
Compartilhar em outros sites

  • 0
Agora, JS Lotus disse:

Isso!

Tbm tou querendo vou ve se consigo adaptar um aki ai te passo

47 minutos atrás, JS Lotus disse:

Isso!

man to conseguindo n vou ter que ficar na espera ou ent vou pedir ajuda ao um amigo meu

Link para o comentário
Compartilhar em outros sites

  • 0
1 minuto atrás, SirDubstep disse:

Deu algum erro? Testei em uma base PDA adaptada aqui e funcionou perfeitamente.

Funcionou, muito obrigado!

 

36 minutos atrás, Naruse disse:

Também preciso :/ ,testei aqui e não deu

A minha base é otPokémon AMV, ela usa algumas coisas que a sua não tem.

Link para o comentário
Compartilhar em outros sites

  • 0
Agora, JS Lotus disse:

Funcionou, muito obrigado!

 

A minha base é otPokémon AMV, ela usa algumas coisas que a sua não tem.

Esse script deveria funcionar em qualquer base, ou pelo menos a parte de soltar os efeitos, provavelmente a bike no servidor dele possui IDs diferentes e ele não trocou todos

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...