Ir para conteúdo

[Problema]Surf System


edgar34

Posts Recomendados

Seguinte galera eu peguei um script na internet nao lembro se foi no xtibia e ai ele é o script surf system que voce sobe em cima de um carrinho e sai andando eu queria saber por que o carrinho esta multiplicando quando passa em cima de outro player(isso as vezes faz o ot cair) e quando o carrinho bate na parede ele passa dentro dela e tambem se multiplica.

 

Obrigado.

 

Script:

 

local storages = {isMoving = 12550, direction = 12551, speed = 12552}

 

local SpeedMeter = {Default = 800, Max = 0, Min = 2500}

 

function tileChecker(pos, type_)

local myTable = {}

if (type(pos) == 'table') then

for i = 1, 5 do

pos.stackpos = i

local Thing = getThingFromPos(pos)

local thisID, thisUID = Thing.itemid, Thing.uid

if thisID > 1 then

if type_ == "itemID" then

table.insert(myTable, thisID)

elseif type_ == "itemUID" then

table.insert(myTable, thisUID)

end

end

end

end

return #myTable > 0 and myTable or nil

end

 

local function findItem(pos, t)

if (type(pos) == 'table' and type(t) == 'table') then

for _i, i in ipairs(tileChecker(pos, "itemID")) do

if isInArray(t, i) then

pos.stackpos = _i

ret = getThingFromPos(pos).uid

break

end

end

end

return ret

end

 

function moveCar(x)

if x.Dir ~= -1 then

doCreateItem(isInArray({1, 2}, x.Dir) == TRUE and 7267 or 7266, 1, x.nPos)

doTeleportThing(x.cid, x.nPos, FALSE)

doRemoveItem(findItem(x.pos, {7266, 7267}))

end

end

 

function onStepIn(cid, item, position, fromPosition)

if isPlayer(cid) == TRUE then

local status =

{

isMoving = getPlayerStorageValue(cid, storages.isMoving),

direction = getPlayerStorageValue(cid, storages.direction),

speed = getPlayerStorageValue(cid, storages.speed)

}

if status.speed <= SpeedMeter.Max then

setPlayerStorageValue(cid, storages.speed, SpeedMeter.Default)

status.speed = SpeedMeter.Default

elseif status.speed >= SpeedMeter.Min then

setPlayerStorageValue(cid, storages.speed, SpeedMeter.Default)

status.speed = SpeedMeter.Default

end

if status.isMoving == 1 then

local Movements =

{

[1] = {x = position.x - 1, y = position.y, z = position.z},

[2] = {x = position.x + 1, y = position.y, z = position.z},

[3] = {x = position.x, y = position.y - 1, z = position.z},

[4] = {x = position.x, y = position.y + 1, z = position.z}

}

 

if not Movements[status.direction] then setPlayerStorageValue(cid, status.direction, 1) end

 

local Stor = status.direction

 

local newPos = Movements[stor]

 

local Check = tileChecker(newPos, "itemUID")

 

if Check ~= nil then

for _, i in ipairs(Check) do

if (hasProperty(i, CONST_PROP_BLOCKSOLID) == TRUE or isCreature(i) or getTilePzInfo(newPos)) then

Stor = isInArray({1, 2}, Stor) == TRUE and (Stor == 1 and 2 or 1) or isInArray({3, 4}, Stor) and (Stor == 3 and 4 or 3) or nil

newPos = Movements[stor]

setPlayerStorageValue(cid, storages.direction, Stor)

break

end

end

end

addEvent(moveCar, status.speed, {cid = cid, pos = position, nPos = newPos, Dir = Stor})

 

elseif status.isMoving == -1 then

setPlayerStorageValue(cid, storages.isMoving, 1)

end

end

return TRUE

end

 

 

Algumas Ss:

 

Sem+t%25C3%25ADtuslo.png

Sem+t%25C3%25ADtulo.png

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...