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

Lua Help, Action script

ka0zstyle

New Member
Joined
Oct 30, 2009
Messages
128
Reaction score
2
I wanted to form this script in order that 2 teams .. 4 vs 4 there was transported to the zone of battle on having pulled the lever and that they was putting on the outfit of color to each team one (blue and red) but it does not work: (

Code:
local config = {
    daily = "no",
    level = 100,
    storage = 30015,
    entry =
    {
        {x = 1105, y = 1241, z = 7},
        {x = 1107, y = 1241, z = 7},
        {x = 1109, y = 1241, z = 7},
        {x = 1111, y = 1241, z = 7}
    },

    destination =
    {
        {x = 1101, y = 1238, z = 7},
        {x = 1102, y = 1238, z = 7},
        {x = 1103, y = 1238, z = 7},
        {x = 1102, y = 1239, z = 7}
    }
}


    entry2 =
    {
        {x = 1105, y = 1230, z = 7},
        {x = 1107, y = 1230, z = 7},
        {x = 1109, y = 1230, z = 7},
        {x = 1111, y = 1230, z = 7}
    }

    destination2 =
    {
        {x = 1101, y = 1232, z = 7},
        {x = 1102, y = 1232, z = 7},
        {x = 1103, y = 1232, z = 7},
        {x = 1102, y = 1231, z = 7}
    }

local conditionBlue = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
addOutfitCondition(conditionBlue, {lookType = 152, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87})

local conditionRed = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
addOutfitCondition(conditionRed, {lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})

config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 1946) then
        if(config.daily) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        else
            doTransformItem(item.uid, item.itemid - 1)
        end

        return true
    end

    if(item.itemid ~= 1945) then
        return true
    end

    local players = {}
    for _, position in ipairs(config.entry) do
        local pid2 = getTopCreature(position).uid
        if(pid == 0 or not isPlayer(pid) or getPlayerLevel(pid) < config.level) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
            return true
        end

        table.insert(players, pid)

    local players2 = ({})
    for _, position in ipairs(config.entry2) do
        local pid = getTopCreature(position).uid
        if(pid == 0 or not isPlayer(pid) or getPlayerLevel(pid) < config.level) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
            return true
        end

        table.insert(players2, pid)
    end

    for i, pid in ipairs(players) do
        doSendMagicEffect(config.entry[i], CONST_ME_POFF)
        doTeleportThing(pid, config.destination[i], false)
        doPlayerSetTown(pid, 2)
        doAddCondition(pid, conditionBlue)

    for i, pid2 in ipairs(players) do
        doSendMagicEffect(config.entry2[i], CONST_ME_POFF)
        doTeleportThing(pid2, config.destination2[i], false)
        doPlayerSetTown(pid2, 2)
        doAddCondition(pid2, conditionRed)


        doSendMagicEffect(config.destination[i], 48)
        doSendMagicEffect(config.destination2[i], 48)
    doBroadcastMessage("-WAR TEAM EVENT-: The 2 teams already are being prepared for the war, they have one minute and a half (90 seg) to enlist.")
    end

    doTransformItem(item.uid, item.itemid + 1)
        end
        return TRUE
end



That I did badly? Help me: (

Code:
[05/05/2016 22:29:44] [Error - LuaScriptInterface::loadFile] data/actions/scripts/pvp event/trans 2.lua:105: 'end' expected (to close 'function' at line 48) near '<eof>'
[05/05/2016 22:29:44] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/pvp event/trans 2.lua)
[05/05/2016 22:29:44] data/actions/scripts/pvp event/trans 2.lua:105: 'end' expected (to close 'function' at line 48) near '<eof>'
 
I just fixed the syntax errors, no idea if this will work or not i'm not reading it now:
Code:
local config = {
    daily = "no",
    level = 100,
    storage = 30015,
    entry =
    {
        {x = 1105, y = 1241, z = 7},
        {x = 1107, y = 1241, z = 7},
        {x = 1109, y = 1241, z = 7},
        {x = 1111, y = 1241, z = 7}
    },

    destination =
    {
        {x = 1101, y = 1238, z = 7},
        {x = 1102, y = 1238, z = 7},
        {x = 1103, y = 1238, z = 7},
        {x = 1102, y = 1239, z = 7}
    }
}


    entry2 =
    {
        {x = 1105, y = 1230, z = 7},
        {x = 1107, y = 1230, z = 7},
        {x = 1109, y = 1230, z = 7},
        {x = 1111, y = 1230, z = 7}
    }

    destination2 =
    {
        {x = 1101, y = 1232, z = 7},
        {x = 1102, y = 1232, z = 7},
        {x = 1103, y = 1232, z = 7},
        {x = 1102, y = 1231, z = 7}
    }

local conditionBlue = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionBlue, CONDITION_PARAM_TICKS, 1800 * 1000)
addOutfitCondition(conditionBlue, {lookType = 152, lookHead = 87, lookBody = 87, lookLegs = 87, lookFeet = 87})

local conditionRed = createConditionObject(CONDITION_OUTFIT)
setConditionParam(conditionRed, CONDITION_PARAM_TICKS, 1800 * 1000)
addOutfitCondition(conditionRed, {lookType = 143, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})

config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 1946) then
        if(config.daily) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        else
            doTransformItem(item.uid, item.itemid - 1)
        end

        return true
    end

    if(item.itemid ~= 1945) then
        return true
    end

    local players = {}
    for _, position in ipairs(config.entry) do
        local pid2 = getTopCreature(position).uid
        if(pid == 0 or not isPlayer(pid) or getPlayerLevel(pid) < config.level) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
            return true
        end

        table.insert(players, pid)
    end

    local players2 = ({})
    for _, position in ipairs(config.entry2) do
        local pid = getTopCreature(position).uid
        if(pid == 0 or not isPlayer(pid) or getPlayerLevel(pid) < config.level) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
            return true
        end

        table.insert(players2, pid)
    end

    for i, pid in ipairs(players) do
        doSendMagicEffect(config.entry[i], CONST_ME_POFF)
        doTeleportThing(pid, config.destination[i], false)
        doPlayerSetTown(pid, 2)
        doAddCondition(pid, conditionBlue)

    for i, pid2 in ipairs(players) do
        doSendMagicEffect(config.entry2[i], CONST_ME_POFF)
        doTeleportThing(pid2, config.destination2[i], false)
        doPlayerSetTown(pid2, 2)
        doAddCondition(pid2, conditionRed)
    end

    doSendMagicEffect(config.destination[i], 48)
    doSendMagicEffect(config.destination2[i], 48)
    doBroadcastMessage("-WAR TEAM EVENT-: The 2 teams already are being prepared for the war, they have one minute and a half (90 seg) to enlist.")
    doTransformItem(item.uid, item.itemid + 1)
    end
    return TRUE
end
 
Back
Top