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

Scritps LUA - HELP ME

Discovery

Developing myself
Joined
Apr 16, 2010
Messages
562
Solutions
11
Reaction score
261
Location
Neverland
script

LUA:
function onstepin(cid, item, pos, frompos)
    if isplayer(cid) then
        local n, t = 0, getplayersonline()
        for i = 1, #t do
            if getplayeraccess(t[i]) == 0 then
                n = n + 1
            end
        end
        local cur, outfit, position = getcreatureoutfit(cid)
        if n % 2 == 0 then -- even
            outfit = {looktype=cur.looktype, lookhead=94, lookbody=113, 

looklegs=114, lookfeet=94, lookaddons=3}
            position = {x=1188, y=1074, z=7}
        else
            outfit = {looktype=cur.looktype, lookhead=82, lookbody=101, 

looklegs=101, lookfeet=75, lookaddons=3}
            position = {x=1090, y=1097, z=7}
else
            outfit = {looktype=cur.looktype, lookhead=114, lookbody=77, 

looklegs=77, lookfeet=77, lookaddons=3}
            position = {x=1128, y=1097, z=7}
end

        docreaturechangeoutfit(cid, outfit)
        doteleportthing(cid, position)
    end
end


error console

end expected <to close 'if' at line 10> near 'else'
 
Last edited by a moderator:
Erm i assume you want some kind of Team Outfit change for the game, but well it can be shortend alot and you did it all wrong,.

Some functions might be wrong, but fix them yourself and you will learn abit too :3
LUA:
local TeamInfo = 
{
 {outfit = {lookhead=94, lookbody=113, looklegs=114, lookfeet=94, lookaddons=3}; position = {x=1188, y=1074, z=7};};
 {outfit = {lookhead=82, lookbody=101, looklegs=101, lookfeet=75, lookaddons=3}; position = {x=1090, y=1097, z=7};};
 {outfit = {lookhead=114, lookbody=77, looklegs=77, lookfeet=77, lookaddons=3}; position = {x=1128, y=1097, z=7};};
}

function table.foreach(t, f)
local ret = {}
 for k,v in pairs(t) do
  ret[k] = f(k,v) or nil
 end
 return ret
end

function onStepIn(cid, item, pos, frompos)
 if isPlayer(cid) then
  local t = table.foreach(getPlayersOnline(), function(k, v) return getPlayerAccess(v) < 3 and nil end)
  table.foreach(t, function(k, v)
   local id = k % #TeamInfo
   TeamInfo[id].outfit.looktype = getCreatureOutfit(cid);
   doCreatureChangeOutfit(v, Teaminfo[id].outfit)
   doTeleportThing(v, Teaminfo[id].position)
  end)
 end
 return true
end
 
Last edited:
Console error:

erro.jpg

- - - Updated - - -

CONSOLE ERROR:

17124d1352729445-end-script-lua-ask-erro.jpg
 
Back
Top