• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Carpet "Need help to fix the script

Lava Titan

Developer
Joined
Jul 25, 2009
Messages
1,571
Solutions
3
Reaction score
98
Location
Portugal
I wanted someone to fix this script since the thread is ignored.
Since im not a scripter and i cant fix it my self =( dont flame my thread please saying "Do it ur self" or something else.

Ok theres my problem:


When i stepIn the carpet it says:

You are not in a Flying Carpet.

Movements:

LUA:
local storages = {
    isMoving = 12550,
    direction = 12551,
    speed = 12552
}
function CarMoveLeft(x)
cpos = x.Cpos
Car = getThingfromPos(cpos)
newpos = {x=x.pos.x-1, y=x.pos.y, z=x.pos.z}

new1pos = {x=x.pos.x-2, y=x.pos.y-1, z=x.pos.z}
new2pos = {x=x.pos.x-1, y=x.pos.y-1, z=x.pos.z}
new3pos = {x=x.pos.x, y=x.pos.y-1, z=x.pos.z}

new4pos = {x=x.pos.x-2, y=x.pos.y, z=x.pos.z}

new6pos = {x=x.pos.x, y=x.pos.y, z=x.pos.z}

new7pos = {x=x.pos.x-2, y=x.pos.y+1, z=x.pos.z}
new8pos = {x=x.pos.x-1, y=x.pos.y+1, z=x.pos.z}
new9pos = {x=x.pos.x, y=x.pos.y+1, z=x.pos.z}


gate1pos = {x=x.pos.x-1, y=x.pos.y-1, z=x.pos.z, stackpos=1}
gate2pos = {x=x.pos.x, y=x.pos.y-1, z=x.pos.z, stackpos=1}
gate3pos = {x=x.pos.x+1, y=x.pos.y-1, z=x.pos.z, stackpos=1}

gate4pos = {x=x.pos.x-1, y=x.pos.y, z=x.pos.z, stackpos=1}

gate6pos = {x=x.pos.x+1, y=x.pos.y, z=x.pos.z, stackpos=1}

gate7pos = {x=x.pos.x-1, y=x.pos.y+1, z=x.pos.z, stackpos=1}
gate8pos = {x=x.pos.x, y=x.pos.y+1, z=x.pos.z, stackpos=1}
gate9pos = {x=x.pos.x+1, y=x.pos.y+1, z=x.pos.z, stackpos=1}

get1gate = getThingfromPos(gate1pos)
get2gate = getThingfromPos(gate2pos)
get3gate = getThingfromPos(gate3pos)
get4gate = getThingfromPos(gate4pos)
get6gate = getThingfromPos(gate6pos)
get7gate = getThingfromPos(gate7pos)
get8gate = getThingfromPos(gate8pos)
get9gate = getThingfromPos(gate9pos)

doCreateItem(1798,1,newpos)
doCreateItem(1794,1,new1pos)
doCreateItem(1795,1,new2pos)
doCreateItem(1796,1,new3pos)
doCreateItem(1797,1,new4pos)
doCreateItem(1799,1,new6pos)
doCreateItem(1800,1,new7pos)
doCreateItem(1801,1,new8pos)
doCreateItem(1802,1,new9pos)
doTeleportThing(x.cid, newpos, FALSE)
doRemoveItem(Car.uid,1)
doRemoveItem(get1gate.uid,1)
doRemoveItem(get2gate.uid,1)
doRemoveItem(get3gate.uid,1)
doRemoveItem(get4gate.uid,1)
doRemoveItem(get6gate.uid,1)
doRemoveItem(get7gate.uid,1)
doRemoveItem(get8gate.uid,1)
doRemoveItem(get9gate.uid,1)


end

function CarMoveRight(x)
cpos = x.Cpos
Car = getThingfromPos(cpos)
newpos = {x=x.pos.x+1, y=x.pos.y, z=x.pos.z}

new1pos = {x=x.pos.x, y=x.pos.y-1, z=x.pos.z}
new2pos = {x=x.pos.x+1, y=x.pos.y-1, z=x.pos.z}
new3pos = {x=x.pos.x+2, y=x.pos.y-1, z=x.pos.z}

new4pos = {x=x.pos.x, y=x.pos.y, z=x.pos.z}

new6pos = {x=x.pos.x+2, y=x.pos.y, z=x.pos.z}

new7pos = {x=x.pos.x, y=x.pos.y+1, z=x.pos.z}
new8pos = {x=x.pos.x+1, y=x.pos.y+1, z=x.pos.z}
new9pos = {x=x.pos.x+2, y=x.pos.y+1, z=x.pos.z}



gate1pos = {x=x.pos.x-1, y=x.pos.y-1, z=x.pos.z, stackpos=1}
gate2pos = {x=x.pos.x, y=x.pos.y-1, z=x.pos.z, stackpos=1}
gate3pos = {x=x.pos.x+1, y=x.pos.y-1, z=x.pos.z, stackpos=1}

gate4pos = {x=x.pos.x-1, y=x.pos.y, z=x.pos.z, stackpos=1}

gate6pos = {x=x.pos.x+1, y=x.pos.y, z=x.pos.z, stackpos=1}

gate7pos = {x=x.pos.x-1, y=x.pos.y+1, z=x.pos.z, stackpos=1}
gate8pos = {x=x.pos.x, y=x.pos.y+1, z=x.pos.z, stackpos=1}
gate9pos = {x=x.pos.x+1, y=x.pos.y+1, z=x.pos.z, stackpos=1}

get1gate = getThingfromPos(gate1pos)
get2gate = getThingfromPos(gate2pos)
get3gate = getThingfromPos(gate3pos)
get4gate = getThingfromPos(gate4pos)
get6gate = getThingfromPos(gate6pos)
get7gate = getThingfromPos(gate7pos)
get8gate = getThingfromPos(gate8pos)
get9gate = getThingfromPos(gate9pos)

doCreateItem(1798,1,newpos)
doCreateItem(1794,1,new1pos)
doCreateItem(1795,1,new2pos)
doCreateItem(1796,1,new3pos)
doCreateItem(1797,1,new4pos)
doCreateItem(1799,1,new6pos)
doCreateItem(1800,1,new7pos)
doCreateItem(1801,1,new8pos)
doCreateItem(1802,1,new9pos)
doTeleportThing(x.cid, newpos, FALSE)
doRemoveItem(Car.uid,1)
doRemoveItem(get1gate.uid,1)
doRemoveItem(get2gate.uid,1)
doRemoveItem(get3gate.uid,1)
doRemoveItem(get4gate.uid,1)
doRemoveItem(get6gate.uid,1)
doRemoveItem(get7gate.uid,1)
doRemoveItem(get8gate.uid,1)
doRemoveItem(get9gate.uid,1)

end
function CarMoveUp(x)
cpos = x.Cpos
Car = getThingfromPos(cpos)
newpos = {x=x.pos.x, y=x.pos.y-1, z=x.pos.z}

new1pos = {x=x.pos.x-1, y=x.pos.y-2, z=x.pos.z}
new2pos = {x=x.pos.x, y=x.pos.y-2, z=x.pos.z}
new3pos = {x=x.pos.x+1, y=x.pos.y-2, z=x.pos.z}

new4pos = {x=x.pos.x-1, y=x.pos.y-1, z=x.pos.z}

new6pos = {x=x.pos.x+1, y=x.pos.y-1, z=x.pos.z}

new7pos = {x=x.pos.x-1, y=x.pos.y, z=x.pos.z}
new8pos = {x=x.pos.x, y=x.pos.y, z=x.pos.z}
new9pos = {x=x.pos.x+1, y=x.pos.y, z=x.pos.z}

gate1pos = {x=x.pos.x-1, y=x.pos.y-1, z=x.pos.z, stackpos=1}
gate2pos = {x=x.pos.x, y=x.pos.y-1, z=x.pos.z, stackpos=1}
gate3pos = {x=x.pos.x+1, y=x.pos.y-1, z=x.pos.z, stackpos=1}

gate4pos = {x=x.pos.x-1, y=x.pos.y, z=x.pos.z, stackpos=1}

gate6pos = {x=x.pos.x+1, y=x.pos.y, z=x.pos.z, stackpos=1}

gate7pos = {x=x.pos.x-1, y=x.pos.y+1, z=x.pos.z, stackpos=1}
gate8pos = {x=x.pos.x, y=x.pos.y+1, z=x.pos.z, stackpos=1}
gate9pos = {x=x.pos.x+1, y=x.pos.y+1, z=x.pos.z, stackpos=1}

get1gate = getThingfromPos(gate1pos)
get2gate = getThingfromPos(gate2pos)
get3gate = getThingfromPos(gate3pos)
get4gate = getThingfromPos(gate4pos)
get6gate = getThingfromPos(gate6pos)
get7gate = getThingfromPos(gate7pos)
get8gate = getThingfromPos(gate8pos)
get9gate = getThingfromPos(gate9pos)

doCreateItem(1798,1,newpos)
doCreateItem(1794,1,new1pos)
doCreateItem(1795,1,new2pos)
doCreateItem(1796,1,new3pos)
doCreateItem(1797,1,new4pos)
doCreateItem(1799,1,new6pos)
doCreateItem(1800,1,new7pos)
doCreateItem(1801,1,new8pos)
doCreateItem(1802,1,new9pos)
doTeleportThing(x.cid, newpos, FALSE)
doRemoveItem(Car.uid,1)
doRemoveItem(get1gate.uid,1)
doRemoveItem(get2gate.uid,1)
doRemoveItem(get3gate.uid,1)
doRemoveItem(get4gate.uid,1)
doRemoveItem(get6gate.uid,1)
doRemoveItem(get7gate.uid,1)
doRemoveItem(get8gate.uid,1)
doRemoveItem(get9gate.uid,1)
end

function CarMoveDown(x)
cpos = x.Cpos
Car = getThingfromPos(cpos)
newpos = {x=x.pos.x, y=x.pos.y+1, z=x.pos.z}

new1pos = {x=x.pos.x-1, y=x.pos.y, z=x.pos.z}
new2pos = {x=x.pos.x, y=x.pos.y, z=x.pos.z}
new3pos = {x=x.pos.x+1, y=x.pos.y, z=x.pos.z}

new4pos = {x=x.pos.x-1, y=x.pos.y+1, z=x.pos.z}

new6pos = {x=x.pos.x+1, y=x.pos.y+1, z=x.pos.z}

new7pos = {x=x.pos.x-1, y=x.pos.y+2, z=x.pos.z}
new8pos = {x=x.pos.x, y=x.pos.y+2, z=x.pos.z}
new9pos = {x=x.pos.x+1, y=x.pos.y+2, z=x.pos.z}

gate1pos = {x=x.pos.x-1, y=x.pos.y-1, z=x.pos.z, stackpos=1}
gate2pos = {x=x.pos.x, y=x.pos.y-1, z=x.pos.z, stackpos=1}
gate3pos = {x=x.pos.x+1, y=x.pos.y-1, z=x.pos.z, stackpos=1}

gate4pos = {x=x.pos.x-1, y=x.pos.y, z=x.pos.z, stackpos=1}

gate6pos = {x=x.pos.x+1, y=x.pos.y, z=x.pos.z, stackpos=1}

gate7pos = {x=x.pos.x-1, y=x.pos.y+1, z=x.pos.z, stackpos=1}
gate8pos = {x=x.pos.x, y=x.pos.y+1, z=x.pos.z, stackpos=1}
gate9pos = {x=x.pos.x+1, y=x.pos.y+1, z=x.pos.z, stackpos=1}

get1gate = getThingfromPos(gate1pos)
get2gate = getThingfromPos(gate2pos)
get3gate = getThingfromPos(gate3pos)
get4gate = getThingfromPos(gate4pos)
get6gate = getThingfromPos(gate6pos)
get7gate = getThingfromPos(gate7pos)
get8gate = getThingfromPos(gate8pos)
get9gate = getThingfromPos(gate9pos)

doCreateItem(1798,1,newpos)
doCreateItem(1794,1,new1pos)
doCreateItem(1795,1,new2pos)
doCreateItem(1796,1,new3pos)
doCreateItem(1797,1,new4pos)
doCreateItem(1799,1,new6pos)
doCreateItem(1800,1,new7pos)
doCreateItem(1801,1,new8pos)
doCreateItem(1802,1,new9pos)
doTeleportThing(x.cid, newpos, FALSE)
doRemoveItem(Car.uid,1)
doRemoveItem(get1gate.uid,1)
doRemoveItem(get2gate.uid,1)
doRemoveItem(get3gate.uid,1)
doRemoveItem(get4gate.uid,1)
doRemoveItem(get6gate.uid,1)
doRemoveItem(get7gate.uid,1)
doRemoveItem(get8gate.uid,1)
doRemoveItem(get9gate.uid,1)

end
function onStepIn(cid, item, position, fromPosition)
local pos = position
if isPlayer(cid) == 1 then
    local status = {
        isMoving = getPlayerStorageValue(cid, storages.isMoving),
        direction = getPlayerStorageValue(cid, storages.direction),
        speed = getPlayerStorageValue(cid, storages.speed)
    }
    if status.speed <= 0 then
        setPlayerStorageValue(cid, storages.speed, 500)
        status.speed = 800
    elseif status.speed >= 3500 then
        setPlayerStorageValue(cid, storages.speed, 500)
        status.speed = 800    
    end
    CarPos = getThingPos(item.uid)



     if status.isMoving == 1 then

		local x = {cid = cid, pos = pos, Cpos = CarPos}
        if status.direction == 1  then

            CheckRight = getThingfromPos({x = pos.x+1, y = pos.y, z = pos.z, stackpos = 1})
 	    	CheckLeft = getThingfromPos({x = pos.x-1, y = pos.y, z = pos.z, stackpos = 1})
            CheckRight2 = getThingfromPos({x = pos.x+1, y = pos.y, z = pos.z, stackpos = 2})
 	    	CheckLeft2 = getThingfromPos({x = pos.x-1, y = pos.y, z = pos.z, stackpos = 2})


			

			
	    	if (isWall(CheckLeft.itemid) == 1 or isWall(CheckLeft2.itemid) == 1 or isCreature(CheckLeft.uid) >0) and (isWall(CheckRight.itemid)==0 and  isWall(CheckRight2.itemid)==0) then 
                setPlayerStorageValue(cid, storages.direction, 2)
                addEvent(CarMoveRight, status.speed, x)

            elseif isWall(CheckLeft.itemid) == 0 and isWall(CheckLeft2.itemid) == 0 then
                addEvent(CarMoveLeft, status.speed, x)
			else

			setPlayerStorageValue(cid, storages.isMoving, 1)
			
            end



        elseif status.direction == 2 then
            CheckRight = getThingfromPos({x = pos.x+1, y = pos.y, z = pos.z, stackpos = 1})
 	    	CheckLeft = getThingfromPos({x = pos.x-1, y = pos.y, z = pos.z, stackpos = 1})
            CheckRight2 = getThingfromPos({x = pos.x+1, y = pos.y, z = pos.z, stackpos = 2})
 	    	CheckLeft2 = getThingfromPos({x = pos.x-1, y = pos.y, z = pos.z, stackpos = 2})

           
	
			
	    	if (isWall(CheckRight.itemid) == 1 or isWall(CheckRight2.itemid) == 1 or isCreature(CheckRight.uid) >0) and ( isWall(CheckLeft.itemid) == 0 and  isWall(CheckLeft2.itemid) == 0) then 
                setPlayerStorageValue(cid, storages.direction, 1)
                addEvent(CarMoveLeft, status.speed, x)

            elseif isWall(CheckRight.itemid) == 0 and isWall(CheckRight2.itemid) == 0 then
                addEvent(CarMoveRight, status.speed, x)
			else
			
			setPlayerStorageValue(cid, storages.isMoving, 1)
            end

           
        elseif status.direction == 3 then
           CheckUp = getThingfromPos({x = pos.x, y = pos.y-1, z = pos.z, stackpos = 1})
           CheckDown = getThingfromPos({x = pos.x, y = pos.y+1, z = pos.z, stackpos = 1})
           CheckUp2 = getThingfromPos({x = pos.x, y = pos.y-1, z = pos.z, stackpos = 2})
           CheckDown2 = getThingfromPos({x = pos.x, y = pos.y+1, z = pos.z, stackpos = 2})
		   
		   
			if (isWall(CheckUp.itemid) == 1 or isWall(CheckUp2.itemid) == 1 or isCreature(CheckUp.uid) >0) and (isWall(CheckDown.itemid) == 0 and  isWall(CheckDown2.itemid) == 0) then
			
                setPlayerStorageValue(cid, storages.direction, 4)
                addEvent(CarMoveDown, status.speed, x)
				
elseif isWall(CheckUp.itemid) == 0 and isWall(CheckUp2.itemid) == 0 then
		     addEvent(CarMoveUp, status.speed, x)
		
            else
           
				setPlayerStorageValue(cid, storages.isMoving, 1)
            end


        elseif status.direction == 4 then
           CheckUp = getThingfromPos({x = pos.x, y = pos.y-1, z = pos.z, stackpos = 1})
           CheckDown = getThingfromPos({x = pos.x, y = pos.y+1, z = pos.z, stackpos = 1})
           CheckUp2 = getThingfromPos({x = pos.x, y = pos.y-1, z = pos.z, stackpos = 2})
           CheckDown2 = getThingfromPos({x = pos.x, y = pos.y+1, z = pos.z, stackpos = 2})
		   
		   
			if (isWall(CheckDown.itemid) == 1 or isWall(CheckDown2.itemid) == 1 or isCreature(CheckDown.uid) >0) and (isWall(CheckUp.itemid) == 0 and  isWall(CheckUp2.itemid) == 0) then
			
                setPlayerStorageValue(cid, storages.direction, 3)
                addEvent(CarMoveUp, status.speed, x)
				
elseif isWall(CheckDown.itemid) == 0 and isWall(CheckDown2.itemid) == 0 then
		     addEvent(CarMoveDown, status.speed, x)
		
            else
           
				setPlayerStorageValue(cid, storages.isMoving, 1)
            end

				
        end
		

    elseif status.isMoving == -1 then
        setPlayerStorageValue(cid, storages.isMoving, 1)
    end
end
end

Talkaction:

LUA:
local storages = {
    isMoving = 12550,
    direction = 12551,
    speed = 12552
}
function onSay(cid, words, param)
local status = {
    isMoving = getPlayerStorageValue(cid, storages.isMoving),
    direction = getPlayerStorageValue(cid, storages.direction),
    speed = getPlayerStorageValue(cid, storages.speed)
}
local controls = {
["up"] = {storage = storages.direction, new = 3, txt = "up"},
["down"] = {storage = storages.direction, new = 4, txt = "down"},
["left"] = {storage = storages.direction, new = 1, txt = "left"},
["right"] = {storage = storages.direction, new = 2, txt = "right"},
["speedup"] = {storage = storages.speed, new = status.speed-50, txt = "fast"},
["speeddown"] = {storage = storages.speed, new = status.speed+50, txt = "slow"},
["stop"] = {storage = storages.direction, new = -1, txt = "stop"} 
}
if status.isMoving == 1 then
    ctrl = controls[param]
    if (ctrl ~= nil) then
        setPlayerStorageValue(cid, ctrl.storage, ctrl.new)
        doCreatureSay(cid, ctrl.txt, TALKTYPE_SAY)
    else
        doSendMagicEffect(getPlayerPosition(cid), 2)
        doPlayerSendCancel(cid, "Invalid operation.")
    end
else
    doPlayerSendCancel(cid, "You are not in a Flying Carpet.")
end
end

I wanted to fly normaly with the carpet but keep getting that error when say any command.
 
Last edited:
Views: 19
Replies: 0

u-mad1.jpg
 
buggy / no checks for blocking items, but less confusing so anyone else could want to help you now

Honestly I don't think any1 bothers to take a look inside that messy script xD

since this one is not messy anymore, lets hope anyone helps you, im lazy A_A

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

function makeArea(pos)
    local area = {}
    for k = 1, -1, -1 do
        for i = 1, -1, -1 do
            table.insert(area, {x = math.abs(i - pos.x), y = math.abs(k - pos.y), z = pos.z})
        end
    end
    return area
end

local items = 
    {
        1794, 1795, 1796,
        1797, 1798, 1799,
        1800, 1801, 1802
    }
    
function moveNow(cid, move)
    
    if not isPlayer(cid) then
        return
    end

    local area = makeArea(getCreaturePosition(cid))
    
    for k, pos in ipairs(area) do
        local find = getTileItemById(pos, items[k]).uid
        if (find > 0) then
            doRemoveItem(find)
        end
        
        local newPos = {x = pos.x + move.x, y = pos.y + move.y, z = pos.z}
        doCreateItem(items[k], 1, newPos)
        if (k == 5) then
            doTeleportThing(cid, newPos, false)
        end
    end
end

function onStepIn(cid, item, position, fromPosition)

    if not isPlayer(cid) then
        return true
    end

    local status = 
    {
        isMoving = getPlayerStorageValue(cid, storages.isMoving),
        direction = getPlayerStorageValue(cid, storages.direction),
        speed = getPlayerStorageValue(cid, storages.speed)
    }
    
    if (status.isMoving ~= 1) then
        return true
    end

    if (status.speed <= 0) then
        setPlayerStorageValue(cid, storages.speed, 500)
        status.speed = 500
    elseif (status.speed >= 3500) then
        setPlayerStorageValue(cid, storages.speed, 500)
        status.speed = 500    
    end
    
    local to =
    {
        [1] = {x = 1, y = 0},
        [2] = {x = -1, y = 0},
        [3] = {x = 0, y = 1},
        [4] = {x = 0, y = -1},
    }

    local move = to[status.direction]
    
    if move then
        addEvent(moveNow, status.speed, cid, move)
    end
    return true
end
 
LUA:
local storages = 
    {
        isMoving = 12550,
        direction = 12551,
        speed = 12552
    }
    
function onSay(cid, words, param)
    local status = 
    {
        isMoving = getPlayerStorageValue(cid, storages.isMoving),
        direction = getPlayerStorageValue(cid, storages.direction),
        speed = getPlayerStorageValue(cid, storages.speed)
    }
    
local controls = 
    {
        ["up"] = {storage = storages.direction, new = 3, txt = "up"},
        ["down"] = {storage = storages.direction, new = 4, txt = "down"},
        ["left"] = {storage = storages.direction, new = 1, txt = "left"},
        ["right"] = {storage = storages.direction, new = 2, txt = "right"},
        ["speedup"] = {storage = storages.speed, new = status.speed-50, txt = "fast"},
        ["speeddown"] = {storage = storages.speed, new = status.speed+50, txt = "slow"},
        ["stop"] = {storage = storages.direction, new = -1, txt = "stop"}
    }
    
--    if status.isMoving == 1 then
        local ctrl = controls[param]
        if (ctrl ~= nil) then
            setPlayerStorageValue(cid, ctrl.storage, ctrl.new)
            doCreatureSay(cid, ctrl.txt, TALKTYPE_SAY)
        else
            doSendMagicEffect(getPlayerPosition(cid), 2)
            doPlayerSendCancel(cid, "Invalid operation.")
        end
--    else
--        doPlayerSendCancel(cid, "You are not in a Flying Carpet.")
--    end
    return true
end
 
"Do not read this if you gonna ignore" is an illegal threadname since it has no relevance with the topic of the thread.

Title changed to something relevant. Consider it happy times since I usually delete off-leading thread names.

Sorry can't help you with the script D:
 
Back
Top