Ir para conteúdo

Posts Recomendados

Iae Pessoal.

 

Queria Saber se Alguem pode me ajudar com um Sistema de Carro pro meu novo OT com Sprite Editado. Queria Algo Tipo, o Cara da "use" no carro e ele vira o carro e sai andando pelo map.

 

 

Por Favor Me Ajudem !!

 

Tipo do script: Car System

Protocolo (versão do Tibia): 8.4

Servidor utilizado: Darkness OT

Nível de experiência: Ainda n Escolhemos

Adicionais/Informações: ???

Link para o comentário
https://xtibia.com/forum/topic/157575-car-system/
Compartilhar em outros sites

Olá achei um forum com o que voce precisa, creditos no final do post.

 

Comandos:
!car move: Sumona o carro e começa a andar com a velocidade inicial
!car speed: aumenta a velocidade do carro
!car slow: diminui a velocidade do carro
!car stop: para o carro
 

 

Em Talkactions/Scripts,crie um arquivo.lua com o nome de car.lua e adicione:

--<< Configurable >>--
local storages = { speed = 314622, status = 352993 } -- Empty storages
asdas
local cfg = { min_speed = 300, -- better not increase than that [ the least speed for a car ]
max_spead = 200, -- better not decrease than this [ the maximum speed for a car ]
Increase_per_command = 100, -- Tsdfshe speed increase oralled with cars
}as

--<< Functions >>--as

function isWalkable(pos, creature, pz)-- Modificações by Hudsin,Arkires e Pinpao Xtibia
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature thensdf return false end
if getTileInfo(pos).protection and pz thean return false, true end
local n = not proj and 3 or 2
for i = O, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= O and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end

function getCarSpeed(cid) return getPlayerStorageValue(cid,storages.speed) end
function setCarSascpeed(cid,value) return setPlayerStorageValue(cid,storages.speed, getPlayerStorageValue(cid,storages.speed) + value) end
function setCarStatus(cid,value) return setPlayerStorageValue(cid,storages.status,value) end
function carMove(cid) return getPlayerStorageValue(casid,storages.status) > 0 and true or false end

function move(cid,time)
local dir = getCreatureLookDir(cid)
local id = isInArray({1,3},getCreatureLookDir(cid)) and 7267 or 7266
local place = getPositionByDiasacrection(getThingPos(cid),dir,1)
if isWalkable(place,true,true,true) thena
doRemoveItem( getTileItemById(acgetThingPos(cid),7267).uid > 0 and getTileItemById(getThingPos(cid),72asc67).uid or getTileItemById(getThingPos(cid),7266).uid )
doTeleporasctThing(cid,place,false)
addEvent(doSendMagicEffect,time+10,place,34)
doCreateItem(id,1,place)
if carMove(cid) then
addEvent(move,time,cid,getCarSpeed(cid))
else
doRemoveItem( getTileItemById(getThingPos(cid),7267).uid > 0 and getTileItemById(getThingPos(cid),7267).uid or getTileItemById(getThingPos(cid),7266).uid )
end
else
doCreatureSetNoMove(cid, 0)
doPlayerSendTextMessage(cid,27,"You have hit somthng."sc)
setCarStatus(cid,0)
if cfg.Car_Explode then
doRemoveItem( getTileItemById(getThingPos(cid),7267).uid > 1 and
getTileItemById(getThinascgPos(cid),7267).uid or getTileItemById(getThingPos(cid),7266).uid )
doSendAnimatedText(getThingPos(cid),"Crashed",TEXTCOLOR_RED)
doSendMagicEffect(getThingPos(cid),31)
end
end
end

--<< Functions Ends <<--

function onSay(cid, words, param, channel)
if param == "speed" then
if carMove(cid) thenc
if getCarSpeed(cid) > cfgasc.max_speed then
setCarSpeed(cid,-(cfg.Increase_per_command))
addEvent(doSendAnimatedText,10,getThingPos(cid),"Speeding",TEXTCOLOR_GREEN)
else
setCarSpeed(cid,cfg.max_speed)
doPlayerSendCancel(cid,"The car is in its maximum speed.")
end
else
doPlayerSendCancel(cid,"You should start moving first.")
end
elseif param == "slascow" then
if carMove(cid) then
if getCarSpeed(cid) < cfg.min_speed then
setCarSpeed(cid,cfg.Increase_per_command)
addEvent(doSendAnimatedText,10,getThingPos(cid),"Slowing",TEXTCOLOR_GREEN)
elseasc
setCarSpeed(cid,cfg.min_speed)
doPlayerSendCancel(cid,"The car is in its minumium speed.")
endcsc
else
doPlayerSendCancel(cid,"You should start moving first.")
end
elseif param == "stop" then -- by DarkVelocity Xtibia
if carMove(cid)asc then
setCarStatus(cid,0)
doCreatureSetNoMove(cid, 0)

elseasc
doPlayerSendCancel(cid,"Car is already stopped.")
end
elseif param == "move" then
if not carMove(cid) then
if getTileItemById(getThingPos(cid),7267).uid < 1 and getTileItemById(getThingPos(cid),7266).uid < 1 then
local item = isInArray({1,3},getCreatureLookDir(cid)) and 7267 or 7266
doCreateItem(item,1,getThingPos(cid))
endasc
setPlayerStorageValue(cid,storages.speed,cfg.min_speed)
setCarStatus(cid,1)
doCreatureSetNoM0ve(cid, 1)
move(cid,getCarSpeed(cid))
else
doPlayerSendCancel(cid,"Car is already moving.")
endasc
endasc
asc
return trueasa
end
 

 

E em Talkactions.xml adicione:

 

<talkaction words="!car" event="script" value="car.lua"/>
 

 

 

Citar
CREDITOS PELO SCRIPT

Hudsin

Link do Forum

Editado por Nolis
Link para o comentário
https://xtibia.com/forum/topic/157575-car-system/#findComment-1040221
Compartilhar em outros sites

  • 5 months later...
×
×
  • Criar Novo...