• 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!

[Release] Bridge Lever

Awesome Slayer

New Member
Joined
Jul 16, 2008
Messages
58
Reaction score
0
Credits, Empty -> created script
Awesome Slayer -> edited script

Original Script:
Code:
--Script made by Empty
function onUse(cid, item, frompos, item2, topos)
    tile1 = {x=222, y=333, z=5, stackpos=1} --change tilepos
    tile2 = {x=222, y=332, z=5, stackpos=1} --change tilepos
    tile3 = {x=222, y=331, z=5, stackpos=1} --change tilepos
    gettile1 = getThingfromPos(tile1)
    gettile2 = getThingfromPos(tile2)
    gettile3 = getThingfromPos(tile3)

    if item.uid == 7007 and item.itemid == 1945 then
        doRemoveItem(gettile1.uid,1)
        doRemoveItem(gettile2.uid,1)
        doRemoveItem(gettile3.uid,1)
        doCreateItem(965,1,tile1)
        doCreateItem(965,1,tile2)
        doCreateItem(965,1,tile3)
        doTransformItem(item.uid,item.itemid+1)
    elseif item.uid == 7007 and item.itemid == 1946 then
        doCreateItem(100,1,tile1) --change itemID
        doCreateItem(100,1,tile2) --change itemID
        doCreateItem(100,1,tile3) --change itemID
        doRemoveItem(gettile1.uid,1)
        doRemoveItem(gettile2.uid,1)
        doRemoveItem(gettile3.uid,1)
        doTransformItem(item.uid,item.itemid-1)        
    else
        doPlayerSendCancel(cid,"Sorry, not possible.")
    end

    return 1
end

My Script:
Code:
function onUse(cid, item, frompos, item2, topos)
    tile1 = {x=3008, y=3037, z=7, stackpos=1} --change tilepos
    tile2 = {x=3009, y=3037, z=7, stackpos=1} --change tilepos
    tile3 = {x=3009, y=3038, z=7, stackpos=1} --change tilepos
    tile4 = {x=3008, y=3038, z=7, stackpos=1} --change tilepos
    tile5 = {x=3008, y=3039, z=7, stackpos=1} --change tilepos
    tile6 = {x=3009, y=3039, z=7, stackpos=1} --change tilepos
    gettile1 = getThingfromPos(tile1)
    gettile2 = getThingfromPos(tile2)
    gettile3 = getThingfromPos(tile3)
    gettile4 = getThingfromPos(tile4)
    gettile5 = getThingfromPos(tile5)
    gettile6 = getThingfromPos(tile6)

    if item.uid == 7007 and item.itemid == 1945 then
        doCreateItem(4634,1,tile1)
        doCreateItem(4634,1,tile2)
        doCreateItem(4610,1,tile3)
        doCreateItem(4610,1,tile4)
        doCreateItem(4610,1,tile5)
        doCreateItem(4610,1,tile6)
        doTransformItem(item.uid,item.itemid+1)
    elseif item.uid == 7007 and item.itemid == 1946 then
        doCreateItem(1284,1,tile1)
        doCreateItem(1284,1,tile2)
        doCreateItem(1284,1,tile3)
        doCreateItem(1284,1,tile4)
        doCreateItem(1284,1,tile5)
        doCreateItem(1284,1,tile6)
        doTransformItem(item.uid,item.itemid-1)        
    else
        doPlayerSendCancel(cid,"Sorry, not possible.")
    end

    return 1
end

The Difference? I removed ALL of these lines!!
Code:
        doRemoveItem(gettile1.uid,1)
        doRemoveItem(gettile2.uid,1)
        doRemoveItem(gettile3.uid,1)

What Does That Do? it stops this from happening!!
-> An Error will come up for each and every tile in the script saying that it cant remove the item...

Yours, Awesome Slayer
 
I suggest People to not use this Script!
this will curse lots of laggs by spamming the lever...

You should overdo the entire system since this might work but it is a huge lagg ressource.

Don't take this as an offense, I just don't want that people get mad at you when their server lagg because of your Script :p

kind regards, Evil Hero
 
I suggest People to not use this Script!
this will curse lots of laggs by spamming the lever...

You should overdo the entire system since this might work but it is a huge lagg ressource.

Don't take this as an offense, I just don't want that people get mad at you when their server lagg because of your Script :p

kind regards, Evil Hero

I already told him in my original thread... :p

But I also told him I'm too lazy to fix it right now, will fix it sometime later.
 
Well, if you can make the lever teleport to another spot, the lagg problem will be gone, since players can't spam it.
 
ok... as i have said in one of my earlier threads im new to making scripts..... i dunno wat does lag wat doesnt wat decreases lag and wat makes more lag.... all i know is how to make simple scripts and edit other people scripts to make them work without errors, but beyond that i really don't know. I used to avoid using scripts on my servers but i think it makes the server better so now im trying to learn, thanks for your help.

Thanks, Awesome Slayer
 
You should also learn how to use tables and loops ;)

Just a quick example where I've just turned everything into loops and tables.
Code:
function onUse(cid, item, frompos, item2, topos)
    local tile = {}
    tile[1] = {x=3008, y=3037, z=7, stackpos=1} --change tilepos
    tile[2] = {x=3009, y=3037, z=7, stackpos=1} --change tilepos
    tile[3] = {x=3009, y=3038, z=7, stackpos=1} --change tilepos
    tile[4] = {x=3008, y=3038, z=7, stackpos=1} --change tilepos
    tile[5] = {x=3008, y=3039, z=7, stackpos=1} --change tilepos
    tile[6] = {x=3009, y=3039, z=7, stackpos=1} --change tilepos

    local gettile = {}
    for i,tiles in ipairs(tile) do
    gettile[i] = getThingfromPos(tiles)
    end
    if item.uid == 7007 and item.itemid == 1945 then
        for i, tiles in ipairs(tile) do
            if i <= 2 then
                doCreateItem(4634,1,tiles)
            else
                doCreateItem(4610,1,tiles)
            end
        end
        doTransformItem(item.uid,item.itemid+1)
    elseif item.uid == 7007 and item.itemid == 1946 then
        for i, tiles in ipairs(tile) do
            doCreateItem(1284,1,tiles)
    end
        doTransformItem(item.uid,item.itemid-1)        
    else
        doPlayerSendCancel(cid,"Sorry, not possible.")
    end

    return 1
end
I haven't tested it. It's like 5 months since I last wrote any Lua since I'm in the army atm (read my signature ;))
 
Last edited:
ok... as i have said in one of my earlier threads im new to making scripts..... i dunno wat does lag wat doesnt wat decreases lag and wat makes more lag.... all i know is how to make simple scripts and edit other people scripts to make them work without errors, but beyond that i really don't know. I used to avoid using scripts on my servers but i think it makes the server better so now im trying to learn, thanks for your help.

Thanks, Awesome Slayer

Everyone has to start somewhere... Just keep working and you'll learn for sure! :D

You should also learn how to use tables and loops ;)

Just a quick example where I've just turned everything into loops and tables.
Code:
function onUse(cid, item, frompos, item2, topos)
    local tile = {}
    tile[1] = {x=3008, y=3037, z=7, stackpos=1} --change tilepos
    tile[2] = {x=3009, y=3037, z=7, stackpos=1} --change tilepos
    tile[3] = {x=3009, y=3038, z=7, stackpos=1} --change tilepos
    tile[4] = {x=3008, y=3038, z=7, stackpos=1} --change tilepos
    tile[5] = {x=3008, y=3039, z=7, stackpos=1} --change tilepos
    tile[6] = {x=3009, y=3039, z=7, stackpos=1} --change tilepos

    local gettile = {}
    for i,tiles in ipairs(tile) do
    gettile[i] = getThingfromPos(tiles)
    end
    if item.uid == 7007 and item.itemid == 1945 then
        for i, tiles in ipairs(tile) do
            if i <= 2 then
                doCreateItem(4634,1,tiles)
            else
                doCreateItem(4610,1,tiles)
            end
        end
        doTransformItem(item.uid,item.itemid+1)
    elseif item.uid == 7007 and item.itemid == 1946 then
        for i, tiles in ipairs(tile) do
            doCreateItem(1284,1,tiles)
    end
        doTransformItem(item.uid,item.itemid-1)        
    else
        doPlayerSendCancel(cid,"Sorry, not possible.")
    end

    return 1
end
I haven't tested it. It's like 5 months since I last wrote any Lua since I'm in the army atm (read my signature ;))

Would also make the server lag after a while, since it doesn't remove the previous tiles.
 
Everyone has to start somewhere... Just keep working and you'll learn for sure! :D



Would also make the server lag after a while, since it doesn't remove the previous tiles.

You dont have to remove ground tiles, since they are being replaced, the only tiles left would be the border ones, if you use any.
 
Back
Top