Ir para conteúdo

Featured Replies

Postado

TFS 0.3.6

 

Eae galera! 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!

 

 

  • Respostas 7
  • Visualizações 1.6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Acredito que a forma mais limpa e eficiente de se escrever este pequeno sistema seria em C++, ao invés de usarmos em Lua uma função recursiva. Caso a modificação das sources seja viável para os s

  • Aqui no TibiaKing mensagens como UP e BUMP são proibidas, utilize o botão subir este tópico. Esta é uma mensagem automática! Pedimos que leia as regras do fórum!  

Postado

Aqui no TibiaKing mensagens como UP e BUMP são proibidas, utilize o botão subir este tópico. Esta é uma mensagem automática!
Pedimos que leia as regras do fórum!

Spoiler

Here in TibiaKing messages like UP and BUMP are prohibited, use the button raise this topic. This is an automated message!
Please read the forum rules.

 

                                                              ezgif-1-98aab239f3.gif.1a897c9c3225228909e7b356a5cfb8e4.gif

Postado
function onLogin(cid)
registerCreatureEvent(cid, "EffectOutLogin")
registerCreatureEvent(cid, "OutfitEffects")
return doCreatureChangeOutfit(cid,{lookType = getCreatureOutfit(cid).lookType, lookHead =  getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet, lookAddons = getCreatureOutfit(cid).lookAddons})
end
local events = {}
function onOutfit(cid, old, current)
local effect = {[897] = 6} -- looktype and effect
local o, c= effect[old.lookType],effect[current.lookType]
if getPlayerAccess(cid) > 2 then 
	return true
elseif (not o or not c) then 
	stopEvent(events[getPlayerGUID(cid)]) 
end
if c then
function WalkEffect(cid, c, pos)
	if not isCreature(cid) then return LUA_ERROR end
		if c then frompos = getThingPos(cid)
			if frompos.x ~= pos.x or frompos.y ~= pos.y or frompos.z ~= pos.z then 
				doSendMagicEffect(frompos, c) 
			end
			events[getPlayerGUID(cid)] = addEvent(WalkEffect, 100, cid, c, frompos)
			end 
	return true 
end
WalkEffect(cid, c, {x=0, y=0, z=0}) 
end
return true
end

 

 

TAG

<event type="login" name="EffectOutLogin" event="script" value="nome do seu script.lua"/>
<event type="outfit" name="OutfitEffects" event="script" value="nome do seu script.lua"/>

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Postado
Em 27/09/2018 em 17:08, Vodkart disse:

function onLogin(cid)
registerCreatureEvent(cid, "EffectOutLogin")
registerCreatureEvent(cid, "OutfitEffects")
return doCreatureChangeOutfit(cid,{lookType = getCreatureOutfit(cid).lookType, lookHead =  getCreatureOutfit(cid).lookHead, lookBody = getCreatureOutfit(cid).lookBody, lookLegs = getCreatureOutfit(cid).lookLegs, lookFeet = getCreatureOutfit(cid).lookFeet, lookAddons = getCreatureOutfit(cid).lookAddons})
end
local events = {}
function onOutfit(cid, old, current)
local effect = {[897] = 6} -- looktype and effect
local o, c= effect[old.lookType],effect[current.lookType]
if getPlayerAccess(cid) > 2 then 
	return true
elseif (not o or not c) then 
	stopEvent(events[getPlayerGUID(cid)]) 
end
if c then
function WalkEffect(cid, c, pos)
	if not isCreature(cid) then return LUA_ERROR end
		if c then frompos = getThingPos(cid)
			if frompos.x ~= pos.x or frompos.y ~= pos.y or frompos.z ~= pos.z then 
				doSendMagicEffect(frompos, c) 
			end
			events[getPlayerGUID(cid)] = addEvent(WalkEffect, 100, cid, c, frompos)
			end 
	return true 
end
WalkEffect(cid, c, {x=0, y=0, z=0}) 
end
return true
end

 

 

TAG


<event type="login" name="EffectOutLogin" event="script" value="nome do seu script.lua"/>
<event type="outfit" name="OutfitEffects" event="script" value="nome do seu script.lua"/>

 

 

Aonde adiciona isso 

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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo