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

Outfit per vocation - creaturescript

nevereq

Member
Joined
Apr 16, 2011
Messages
51
Reaction score
5
Hello guys,

I have a problem with script by DanJ93 from tibia.net.pl ,


Code:
function onLogin(cid)
local outfity = {
    [1] = {111, 111},
    [2] = {111, 111},
    [3] = {111, 111},
    [4] = {111, 111},
                }
local i = 1,
if getPlayerVocation(cid) == outfity[i]
if getPlayerSex(cid) == 1
then
doSetCreatureOutfit(cid, outfity[i][1], -1)
else
doSetCreatureOutfit(cid, outfity[i][2], -1)
end
return true
end

for me it's looking good, but in console error appears:

[4/2/2017 19:32:24] >>> Loading creaturescripts... [Error - LuaInterface::loadFile] data/creaturescripts/scripts/outfitek.lua:9: unexpected symbol near 'if'
[4/2/2017 19:32:24] [Error - Event::checkScript] Cannot load script (data/creaturescripts/scripts/outfitek.lua)
[4/2/2017 19:32:24] data/creaturescripts/scripts/outfitek.lua:9: unexpected symbol near 'if'

I'm using otx 8.54 server. Does anyone know, how to fix it?
 
Lua:
local outfity = {
    {111, 111},
    {111, 111},
    {111, 111},
    {111, 111},
}

function onLogin(cid)
    local outfit = outfity[getPlayerVocation(cid)] 
    if getPlayerSex(cid) == 1 then
        doSetCreatureOutfit(cid, outfit[1], -1)
    else
        doSetCreatureOutfit(cid, outfit[2], -1)
    end
    return true
end
 
[4/2/2017 20:27:32] Account Manager has logged in.

[4/2/2017 20:27:32] [Error - CreatureScript Interface]
[4/2/2017 20:27:32] data/creaturescripts/scripts/outfitek.lua:eek:nLogin
[4/2/2017 20:27:32] Description:
[4/2/2017 20:27:32] data/creaturescripts/scripts/outfitek.lua:13: attempt to index local 'outfit' (a nil value)
[4/2/2017 20:27:32] stack traceback:
[4/2/2017 20:27:32] data/creaturescripts/scripts/outfitek.lua:13: in function <data/creaturescripts/scripts/outfitek.lua:8>
[4/2/2017 20:27:32] Account Manager has logged out.

Dunno. :confused:

#edit

Maybe there are some problems with engine?
 
Found a solution!


Code:
local config =
{
[0] = 136,
[4] = 131,
[9] = 25,
[10] = 29
}
function onLogin(cid)
local outfit = getCreatureOutfit(cid)
outfit.lookType = config[getPlayerVocation(cid)]
doCreatureChangeOutfit(cid, outfit)
return true
end

Anyway, thanks for help!
 
Back
Top