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

Problem lua script

Exactly

New Member
Joined
Jul 14, 2014
Messages
117
Reaction score
4
Error console:

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:19: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:19: in function <data/creaturescripts/scripts/dance.lua:9>

Dance.lua

Lua:
--- Edit by Collo~ gg: 7284838 (c)----

local exhaust = {
    storage = 2153,
    seconds = 10
}
local storage = 45658
function onDirection(cid, old, current)
    if isPlayer(cid) then
        if current ~= old and exhaustion.check(cid, exhaust.storage) then
            doPlayerSendCancel(cid, 'Don\'t saturate the server making flood.')
            return false
        else
            if getCreatureStorage(cid, storage) == 6 then           
                exhaustion.set(cid, exhaust.storage, exhaust.seconds)
                doCreatureSetStorage(cid, storage, 0)
            else
                doCreatureSetStorage(cid, storage, math.max(0, getCreatureStorage(cid, storage)) + 1)
            end
        end
    end
    return true
end


Thanks for help !
REP++ for help
 
Lua:
local exhaust = {
    storage = 2153,
    seconds = 10
}

local storage = 45658
function onDirection(cid, old, current)
    if isPlayer(cid) then
        if current ~= old and exhaustion.check(cid, exhaust.storage) then
            doPlayerSendCancel(cid, 'Don\'t saturate the server making flood.')
            return false
        else
            if getCreatureStorage(cid, storage) == 6 then          
                exhaustion.set(cid, exhaust.storage, exhaust.seconds)
                doCreatureSetStorage(cid, storage, 0)
            else
                print(getCreatureStorage(cid, storage))
                doCreatureSetStorage(cid, storage, math.max(0, getCreatureStorage(cid, storage)) + 1)
            end
        end
    end
    return true
end

Try that and post an SS of your console.
 
Don't work :(

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
 
Don't work :(

What server are you using?
The problem is this function; getCreatureStorage
Try to use getPlayerStorage insted and see if that fixes it.

Could you take an SS and upload insted of a copy of the console.
 
Log Console

The OTX Server Version: (2.9) - Codename: (VANXI)
Compiled with GNU C++ version 4.9.2 for arch 64 Bits at Mar 28 2017 10:10:45

A server developed by: Mattyx14 and The Forgotten Server Developers.
Visit for updates, support, and resources: GitHub - mattyx14/otxserver at otxserv2

>> Loading config (config.lua)
>> Opening logs
>> Loading Password encryption:
>>> Using (SHA1) encryption ... (done).
>> Loading RSA key
>> Starting SQL connection
> WARNING: MYSQL Lost connection, attempting to reconnect...>> Running Database Manager
> Optimizing table: account_viplist... [success]
> Optimizing table: accounts... [success]
> Optimizing table: bans... [success]
> Optimizing table: environment_killers... [success]
> Optimizing table: global_storage... [success]
> Optimizing table: guild_invites... [success]
> Optimizing table: guild_kills... [success]
> Optimizing table: guild_ranks... [success]
> Optimizing table: guild_wars... [success]
> Optimizing table: guilds... [success]
> Optimizing table: house_auctions... [success]
> Optimizing table: house_data... [success]
> Optimizing table: house_lists... [success]
> Optimizing table: houses... [success]
> Optimizing table: killers... [success]
> Optimizing table: login_history... [success]
> Optimizing table: market_history... [success]
> Optimizing table: market_offers... [success]
> Optimizing table: player_deaths... [success]
> Optimizing table: player_depotitems... [success]
> Optimizing table: player_items... [success]
> Optimizing table: player_killers... [success]
> Optimizing table: player_namelocks... [success]
> Optimizing table: player_skills... [success]
> Optimizing table: player_spells... [success]
> Optimizing table: player_statements... [success]
> Optimizing table: player_storage... [success]
> Optimizing table: player_viplist... [success]
> Optimizing table: players... [success]
> Optimizing table: server_config... [success]
> Optimizing table: server_motd... [success]
> Optimizing table: server_record... [success]
> Optimizing table: server_reports... [success]
> Optimizing table: tile_items... [success]
> Optimizing table: tile_store... [success]
> Optimizing table: tiles... [success]
> Optimizing table: z_forum... [success]
> Optimizing table: z_ots_comunication... [success]
> Optimizing table: z_shop_history_item... [success]
> Optimizing table: z_shop_offer... [success]
>> Checking for duplicated items
>> There wasn't duplicated items in the server.
>> Loading groups
>> Loading items (OTB)
>> Loading items (XML)
>> Loading outfits
>> Loading quests
>> Loading raids
>> Loading vocations
>> Loading chat channels
>> Loading experience stages
>> Loading mods:
>>> Loading w-fire.xml ... (done).
>>> Loading w-Rush.xml ... (done).
>>> Loading buypremium_command.xml ... (done).
>>> Loading custommonsters.xml ... (done).
>>> Loading w-zombie.xml ... (done).
>>> Loading highscorebook.xml ... (done).
>>> Loading w-castle.xml ... (done).
>>> Loading customspells.xml ... (done).
>>> Loading task.xml ... (done).
>>> Loading w-lms.xml ... (done).
>>> Loading w-captureTheFlag.xml ... (done).
>>> (0) mods were disabled.
>> Loading script systems:
>>> Loading weapons... (done).
>>> Preparing weapons... (done).
>>> Loading spells... (done).
>>> Loading actions... [Warning - Actions::registerEvent] Duplicate registered item id: 1227
[Warning - Actions::registerEvent] Duplicate registered item id: 1229
[Warning - Actions::registerEvent] Duplicate registered item id: 1245
[Warning - Actions::registerEvent] Duplicate registered item id: 1247
[Warning - Actions::registerEvent] Duplicate registered item id: 1259
[Warning - Actions::registerEvent] Duplicate registered item id: 1261
[Warning - Actions::registerEvent] Duplicate registered item id: 3540
[Warning - Actions::registerEvent] Duplicate registered item id: 3549
[Warning - Actions::registerEvent] Duplicate registered item id: 5103
[Warning - Actions::registerEvent] Duplicate registered item id: 5112
[Warning - Actions::registerEvent] Duplicate registered item id: 5121
[Warning - Actions::registerEvent] Duplicate registered item id: 5130
[Warning - Actions::registerEvent] Duplicate registered item id: 5292
[Warning - Actions::registerEvent] Duplicate registered item id: 5294
[Warning - Actions::registerEvent] Duplicate registered item id: 6206
[Warning - Actions::registerEvent] Duplicate registered item id: 6208
[Warning - Actions::registerEvent] Duplicate registered item id: 6263
[Warning - Actions::registerEvent] Duplicate registered item id: 6265
[Warning - Actions::registerEvent] Duplicate registered item id: 6896
[Warning - Actions::registerEvent] Duplicate registered item id: 6905
[Warning - Actions::registerEvent] Duplicate registered item id: 7038
[Warning - Actions::registerEvent] Duplicate registered item id: 7047
[Warning - Actions::registerEvent] Duplicate registered item id: 8555
[Warning - Actions::registerEvent] Duplicate registered item id: 8557
[Warning - Actions::registerEvent] Duplicate registered item id: 9179
[Warning - Actions::registerEvent] Duplicate registered item id: 9181
[Warning - Actions::registerEvent] Duplicate registered item id: 9281
[Warning - Actions::registerEvent] Duplicate registered item id: 9283
[Warning - Actions::registerEvent] Duplicate registered item id: 10282
[Warning - Actions::registerEvent] Duplicate registered item id: 10284
[Warning - Actions::registerEvent] Duplicate registered item id: 10473
[Warning - Actions::registerEvent] Duplicate registered item id: 10482
[Warning - Actions::registerEvent] Duplicate registered item id: 12196
[Warning - Actions::registerEvent] Duplicate registered item id: 9168

[Error - Test Interface]
data/actions/scripts/other/keys.lua
Description:
data/actions/scripts/other/keys.lua:2: bad argument #1 to 'pairs' (table expected, got nil)
[Error - Event::checkScript] Cannot load script (data/actions/scripts/other/keys.lua)

(done).
>>> Loading talkactions... (done).
>>> Loading movements... (done).
>>> Loading creaturescripts... (done).
>>> Loading globalscripts... (done).
>> Loading monsters
[Warning - Monsters::loadMonster] Duplicate registered monster with name: Gate
[Warning - Monsters::loadMonster] Duplicate registered monster with name: Bad Bug
[Warning - Monsters::loadMonster] Duplicate registered monster with name: Bad Rabbit
[Warning - Monsters::loadMonster] Duplicate registered monster with name: Hero Hacker
[Warning - Monsters::loadMonster] Duplicate registered monster with name: Tortoise
[Warning - Monsters::loadMonster] Duplicate registered monster with name: King
[Warning - Monsters::loadMonster] Duplicate registered monster with name: Gate
data/monster/wanalizator.xml:99: parser error : Opening and ending tag mismatch: loot line 71 and item
</item>
^
data/monster/wanalizator.xml:100: parser error : Opening and ending tag mismatch: monster line 2 and loot
</loot>
^
data/monster/wanalizator.xml:101: parser error : Extra content at the end of the document
</monster>
^
[Warning - Monsters::loadMonster] Cannot load monster (Wanalizator) file (data/monster/wanalizator.xml).
Line: 101, Info: Extra content at the end of the document


>> Loading map and spawns:
>>> Map size: 5507x5516.
>>> Map descriptions: - "Saved with Remere's Map Editor 2.2" - "No map description available."Duplicate uniqueId 1700
Duplicate uniqueId 1701
Duplicate uniqueId 7678
Duplicate uniqueId 6518
Duplicate uniqueId 6518
Duplicate uniqueId 6518
Duplicate uniqueId 6518
Duplicate uniqueId 6518
Duplicate uniqueId 6518
Duplicate uniqueId 6518
Duplicate uniqueId 6518
Duplicate uniqueId 1560
Duplicate uniqueId 1703
Duplicate uniqueId 1702
Duplicate uniqueId 1701
Duplicate uniqueId 1700
Duplicate uniqueId 1707
Duplicate uniqueId 1706
Duplicate uniqueId 1705
Duplicate uniqueId 1704
Duplicate uniqueId 1562
Duplicate uniqueId 1563
Duplicate uniqueId 6518
Duplicate uniqueId 1702
Duplicate uniqueId 1703
Duplicate uniqueId 1561
Duplicate uniqueId 1560
Duplicate uniqueId 1562
Duplicate uniqueId 1563
Duplicate uniqueId 1704
Duplicate uniqueId 1705
Duplicate uniqueId 1706
Duplicate uniqueId 1707
Duplicate uniqueId 1560
Duplicate uniqueId 60067
Duplicate uniqueId 60066
Duplicate uniqueId 60063
Duplicate uniqueId 2472
Duplicate uniqueId 7578
Duplicate uniqueId 60067
Duplicate uniqueId 60067
Duplicate uniqueId 60063
Duplicate uniqueId 60064
Duplicate uniqueId 60184
Duplicate uniqueId 60066
Duplicate uniqueId 62004
Duplicate uniqueId 60063
Duplicate uniqueId 60064
Duplicate uniqueId 60063
Duplicate uniqueId 60064
Duplicate uniqueId 60184
Duplicate uniqueId 60184
Duplicate uniqueId 60066
Duplicate uniqueId 60066
Duplicate uniqueId 60067
Duplicate uniqueId 62001
Duplicate uniqueId 62002
Duplicate uniqueId 62003
Duplicate uniqueId 62004
Duplicate uniqueId 60067
Duplicate uniqueId 9196
Duplicate uniqueId 7678
Duplicate uniqueId 7678
Duplicate uniqueId 7678
Duplicate uniqueId 6567
Duplicate uniqueId 6567
Duplicate uniqueId 1702
Duplicate uniqueId 1701
[Warning - IOMap::loadMap] Movable item in house: 2131, item type: 1881, pos 3104/3071/7
Duplicate uniqueId 1704
Duplicate uniqueId 1703
Duplicate uniqueId 60001
[Warning - IOMap::loadMap] Movable item in house: 2131, item type: 1652, pos 3104/3072/6
[Warning - IOMap::loadMap] Movable item in house: 2131, item type: 1619, pos 3104/3073/6
[Warning - IOMap::loadMap] Movable item in house: 2131, item type: 1616, pos 3104/3075/7
[Warning - IOMap::loadMap] Movable item in house: 2131, item type: 2101, pos 3104/3075/7
[Warning - IOMap::loadMap] Movable item in house: 2131, item type: 6111, pos 3108/3072/7

>>> Loading time: 8.372 seconds.
[Spawn::addMonster] Cannot find "Apocalypse"
[Warning - Npc::createNpc] Cannot find npc with name: Adept Weza.
[Warning - Npc::createNpc] Cannot find npc with name: Adept Weza.
[Warning - Npc::createNpc] Cannot find npc with name: Adept Weza.
[Warning - Npc::createNpc] Cannot find npc with name: Adept Weza.
[Warning - Npc::createNpc] Cannot find npc with name: Adept Weza.
[Warning - Npc::createNpc] Cannot find npc with name: Adept Weza.
[Spawn::addMonster] Cannot find "Ise"
[Warning - Npc::createNpc] Cannot find npc with name: Adept Weza.
[Warning - Npc::createNpc] Cannot find npc with name: Adept Weza.
[Warning - Npc::createNpc] Cannot find npc with name: Adept Weza.
[Spawn::addMonster] Cannot find "Ise"
[Spawn::addMonster] Cannot find "Ise"
[Spawn::addMonster] Cannot find "Ise"
[Spawn::addMonster] Cannot find "Golden Quest Boss"
[Spawn::addMonster] Cannot find "Ise"
[Spawn::addMonster] Cannot find "Ise"
[Notice - Npc::Npc] NPC: Mahadris - autowalk attribute has been deprecated, use walkinterval instead.
[Spawn::addMonster] Cannot find "Vampire Overlord"
[Spawn::addMonster] Cannot find "Forgotten Scarab"
[Spawn::addMonster] Cannot find "Vampire Overlord"
[Spawn::addMonster] Cannot find "Apocalypse"
[Spawn::addMonster] Cannot find "Mage Of Destroyer"
[Spawn::addMonster] Cannot find "Apocalypse"
[Spawn::addMonster] Cannot find "Apocalypse"
[Spawn::addMonster] Cannot find "Apocalypse"
[Spawn::addMonster] Cannot find "Apocalypse"
[Spawn::addMonster] Cannot find "Apocalypse"
[Spawn::addMonster] Cannot find "Infernatil"
[Spawn::addMonster] Cannot find "Infernatil"
[Spawn::addMonster] Cannot find "Infernatil"
[Spawn::addMonster] Cannot find "Mage Of Destroyer"
[Spawn::addMonster] Cannot find "Eye of Terror"
[Spawn::addMonster] Cannot find "Apocalypse"
[Spawn::addMonster] Cannot find "Apocalypse"
>>> Parsing time: 0.792 seconds.
>>> Synchronization time: 0.25 seconds.
>>> Unserialization time: 0.009 seconds.
>> Checking world type: Open PvP
>> Starting to dominate the world... done.
>> Initializing game state and binding services:
>> Global IP address(es): 188.116.7.230
> Bound ports: 7171 7172
>> Everything smells good, server is starting up...
>> Lastworld.pl server Online!

Admin has logged in.
mysql_real_query(): SELECT `guild_name` FROM `castle` WHERE `owner` > 0 - MYSQL ERROR: Table 'lastworld.castle' doesn't exist (1146)
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
-1
nil

[Error - CreatureScript Interface]
data/creaturescripts/scripts/dance.lua:eek:nDirection
Description:
data/creaturescripts/scripts/dance.lua:18: bad argument #3 to 'max' (number expected, got nil)
stack traceback:
[C]: in function 'max'
data/creaturescripts/scripts/dance.lua:18: in function <data/creaturescripts/scripts/dance.lua:7>
 
Back
Top