Sirion_Mido
Experienced Member
I USE THIS script for last man standing event:
it getting crash my server on start and get this error:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Last Man Standing" version="1.00" author="Unknown" contact="otland.net" enabled="yes">
<config name="lastmanstanding_config"><![CDATA[
config = {
temporaryArea = {
{x = 32494, y = 16518, z = 7}, -- northwest corner of area where players must stand in order to join the event
{x = 32498, y = 16520, z = 7} -- south east corner
},
arenaArea = {
{x = 323500, y = 16514, z = 7}, -- nw corner of arena
{x = 32512, y = 16524, z = 7}, -- se corner of arena
{x = 32506, y = 16519, z = 7} -- center of arena
},
fromPosition = {x = 32500, y = 16514, z = 7}, -- top left cornor of the playground
toPosition = {x = 32512, y = 16524, z = 7}, -- bottom right cornor of the playground
minPlayers = 2, -- 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 = 32350, y = 32220, z = 7, stackpos = 1}, -- Where the teleport will be created
teleportToPosition = {x = 32496, y = 16519, z = 7}, -- Where the teleport will take you
teleportId = 1387, -- Id of the teleport
}
]]></config>
<talkaction words="!event" 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 magic teleport will be closed whenever the event is started.!", 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
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>
luascript.h:264: static ScriptEnviroment* LuaInterface::getEnv(): Assertion `m_scriptEnvIndex >= 0 && m_scriptEnvIndex < 21' failed.