Car System

484539
Por 484539
em Actions e Talkactions

484539

Pokemon Online>Recrutando<
avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 19/02/11Posts: 45Char no Tibia: Darius Hunter

versão 8.6

servidor styller yourots

experiencia básico

 

Bom, esses dias axei um script bem legalzinho num topico e resolvi publicalo

(Não fui eu quem criei e não tinha nome do criador)

 

 --<< Configurable >>--
local storages = { speed = 314622, status = 352993 } -- Empty storages

local cfg = {   min_speed = 300, -- better not increase than that [ the least speed for a car ]
max_speed = 200,         -- better not decrease than this [ the maximum speed for a car ]
Increase_per_command = 100, -- The speed increase or decrease value per each command (!car speed // !car slow)
Car_Explode = true -- Keep it true , so your map isnt filled with cars
}
-->> END <<--

--<< Functions >>--

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 then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 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 setCarSpeed(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(cid,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 = getPositionByDirection(getThingPos(cid),dir,1)
if isWalkable(place,true,true,true) then
doRemoveItem( getTileItemById(getThingPos(cid),7267).uid > 0 and getTileItemById(getThingPos(cid),7267).uid or getTileItemById(getThingPos(cid),7266).uid )
doTeleportThing(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.")
setCarStatus(cid,0)
if cfg.Car_Explode then
doRemoveItem( getTileItemById(getThingPos(cid),7267).uid > 1 and 
getTileItemById(getThingPos(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) then
if getCarSpeed(cid) > cfg.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 == "slow" 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)
else
setCarSpeed(cid,cfg.min_speed)
doPlayerSendCancel(cid,"The car is in its minumium speed.")
end
else
doPlayerSendCancel(cid,"You should start moving first.")
end
elseif param == "stop" then -- by DarkVelocity Xtibia
if carMove(cid) then
setCarStatus(cid,0)
doCreatureSetNoMove(cid, 0)

else
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))
end
setPlayerStorageValue(cid,storages.speed,cfg.min_speed)
setCarStatus(cid,1)
doCreatureSetNoMove(cid, 1)
move(cid,getCarSpeed(cid))
else
doPlayerSendCancel(cid,"Car is already moving.")
end
end

return true
end

 

Se funcionar comentem ai si quiser dee REP+ eu agradeço =)

Gosto do meu post ?? Te ajudei de REP+


2yzkm77.png

 

                                                                                     

Pokemon Revolution, um game de seriedade voltado para o bem estar dos clientes
 

Kindred

Killer Bee
avatar
Cavaleiro
Cavaleiro

INFOS

Grupo: CavaleiroRegistrado: 08/08/11Posts: 168

Lugar errado. Reportado!

comedinhasss

Comedinha
avatar
Herói
Herói

INFOS

Grupo: HeróiRegistrado: 08/08/07Posts: 520Gênero: MasculinoChar no Tibia: Sir Morths

Tópico movido.

 

Ps: Coloque a tag que fica no xml.

Ps²: Alguém ai sabe o nome do criador para ele colocar?

Bruno de Carvalho Câmara
[email protected]<script data-cfhash='f9e31' type="text/javascript"> /* */</script> / (18) 9 9640-4544
 

 

 

 

 

 

 

 

 

 

facebook.png&key=5c75f89868a8711c49cc20315645ab5fd3ef2d384bf666dd888f1c280a6b75ed&resource=1 twitter.png&key=a62b8fde99e302436f4cc04056c02768d777c0d27d77011e8931ced8099246e6&resource=1 googleplus.png&key=f287787442661f4422363039ba86e9c578c4921ad397c8f0d88f31709d26c48a&resource=1 youtube.png&key=08e8d5ba725e0a7bfedfe6c9d413ff55e2febb19493974e3a1fd5160d3cabc9f&resource=1 skype.png&key=0aee9c9483d4f4dee341915e654aa361f40598341a31a62afec9f83a2734e0ad&resource=1 steam-icon.png&key=b869d73d6be3b894b7204e151a9582d3b2a84a5d853d940297fec82e1ae25b55&resource=1

 

 

 

 

 

 

 

 

 

 

btn_donateCC_LG.gif&key=ea1b6265cec82d379c00914ab97fd15478f9983200fa273984872388d20f0b62&resource=1 180x25-doar.gif&key=8671e0307e2a7fd446670d1b16671d35069b1c91bed3d028b8f7db698c59eac5&resource=1

 

"Pesadelos? Sonhos? Calma, é apenas eu pensando em você!"

 

wMwSJFE.png?1&key=101925b29f8396357ec8f63d177a708785a8da5f96f154f44e9a4c6599794673&resource=1

guiguizera

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 06/08/11Posts: 8Char no Tibia: Paladin Das Quebrada

cade as ss pra gente ve como q é :winksmiley02:

Kimikaze

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 03/09/12Posts: 5Char no Tibia: Worker knight - Julera

mal explicado