Zaul
I'm The Devil Scripter
- Joined
- May 13, 2012
- Messages
- 233
- Reaction score
- 4
The console error and the server do not start!
The script
PHP:
theforgottenserver: luascript.h:264: static ScriptEnviroment* LuaInterface::getEnv(): Assertion `m_scriptEnvIndex >= 0 && m_scriptEnvIndex < 21' failed.
The script
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Last man standing" version="1.00" author="Kimo" contact="otland.net" enabled="yes">
<config name="lastmanstanding_config"><![CDATA[
config = {
temporaryArea = {
{x = 32440, y = 32466, z = 7}, -- northwest corner of area where players must stand in order to join the event
{x = 32440, y = 32471, z = 7} -- south east corner
},
arenaArea = {
{x = 32427, y = 32451, z = 7}, -- nw corner of arena
{x = 32453, y = 32464, z = 7}, -- se corner of arena
{x = 32440, y = 32457, z = 7} -- center of arena
},
fromPosition = {x = 32427, y = 32451, z = 7}, -- top left cornor of the playground
toPosition = {x = 32453, y = 32464, z = 7}, -- bottom right cornor of the playground
minPlayers = 6, -- min players required to start the battle
prize = {2160, 5467} -- rewards
playerCount = 3334, -- Global storage for counting the players left/entered in the event
teleportPosition = {x = 32357, y = 32219, z = 7, stackpos = 1}, -- Where the teleport will be created
teleportToPosition = {x = 32435, y = 32468, z = 7}, -- Where the teleport will take you
teleportId = 1387, -- Id of the teleport
}
]]></config>
<talkaction words="!last" event="script"><![CDATA[
function onSay()
domodlib('lastmanstanding_config')
local tp = doCreateTeleport(config.teleportId, config.teleportToPosition, config.teleportPosition)
doItemSetAttribute(tp, "aid", config.teleportActionId)
setGlobalStorageValue(config.playerCount, 0)
doBroadcastMessage("Last man standing is starting in " .. config.timeToStartEvent .. " minutes! The teleport will be closed when the event start!", MESSAGE_EVENT_ADVANCE)
addEvent(StartEvent, config.timeToStartEvent * 1000 * 10)
print(getGlobalStorageValue(3334))
return true
end
function StartEvent()
domodlib('lastmanstanding_config')
for x = (config.arenaArea)[1].x, (config.arenaArea)[2].x do
for y = (config.arenaArea)[1].y, (config.arenaArea)[2].y do
for z = (config.arenaArea)[1].z, (config.arenaArea)[2].z do
if(isPlayer(getTopCreature({x = x, y = y, z = z}).uid)) then
table.insert(arenaPlayers, getTopCreature({x = x, y = y, z = z}).uid)
end
end
end
end
if getGlobalStorageValue(config.playerCount) >= config.minPlayers then
local fromp, top = config.fromPosition, config.toPosition
for x = fromp.x, top.x do
for y = fromp.y, top.y do
for z = fromp.z, top.z do
areapos = {x = x, y = y, z = z, stackpos = 253}
getPlayers = getThingfromPos(areapos)
if isPlayer(getPlayers.uid) then
doTeleportThing(players[i], (config.arenaArea)[3])
doPlayerSendTextMessage(players[i], MESSAGE_STATUS_WARNING, "The battle begins. Survive for glory!")
end
return true
end
end
end
else
doTeleportThing(getPlayers.uid, getTownTemplePosition(getPlayerTown(getPlayers.uid)), false)
doSendMagicEffect(getPlayerPosition(getPlayers.uid), CONST_ME_TELEPORT)
doPlayerSendTextMessage(players[i], MESSAGE_STATUS_WARNING, "No enough players!")
end
]]></talkaction>
<movevent type="StepIn" actionid="3000" event="script"><![CDATA[
local config = {
playerCount = 3334, -- Global storage for counting the players in the event
maxPlayers = 20 -- Max players who can participate
}
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
domodlib('lastmanstanding_config')
if getGlobalStorageValue(config.playerCount) < config.maxPlayers then
setGlobalStorageValue(config.playerCount, getGlobalStorageValue(config.playerCount)+1)
if getGlobalStorageValue(config.playerCount) == config.maxPlayers then
doBroadcastMessage("Last man standing event is now full [" .. getGlobalStorageValue(config.playerCount) .. " players]! The event will soon start.")
else
doBroadcastMessage(getPlayerName(cid) .. " entered last man standing event! Currently " .. getGlobalStorageValue(config.playerCount) .. " players have joined!", MESSAGE_STATUS_CONSOLE_RED)
end
else
doTeleportThing(cid, fromPosition)
doPlayerSendCancel(cid, "The event is full. There is already " .. config.maxPlayers .. " players participating in the event.")
return false
end
print(getGlobalStorageValue(config.playerCount) .. " Players in catch the item event.")
return true
end
]]></movevent>
</mod>