Repository navigation
LuaAPI Functions
The GameServer functions are grouped in tables. This page covers the server, objects, monsters, maps, messages and utilities.
- Characters, coins, the option table and the player object: Player functions
- Inventory, warehouse, items and buffs: Item functions
- Database: Database. Files: Config files
- Functions written in Lua (coins by type, scheduler, monster tracker ...): Library
Note
- If the object does not exist, read functions return
0,""ornil; write functions do nothing and returnfalse. - Write functions only work on a character that is in game. Inside some game events they are blocked (see Game events).
- Arguments of the wrong type are ignored:
Object.SetPower(i, 0, nil)does not set the HP to 0. - An error inside a function never stops the GameServer; it stops only the script that called it and is written to the log.
Constants used below (STAT_*, POWER_*, ACTION_*, OBJECT_*, CLASS_*, MAP_*) are defined in System\Constants.lua.
Server.GetCode() → number
Code of this GameServer (the ServerCode of its configuration).
if Server.GetCode() == 0 then
Log.Add("Main server: starting the daily event")
endServer.GetName() → string
Name of this GameServer (ServerName in its configuration). "" if it is not set.
Message.SendAll(0, "Welcome to " .. Server.GetName())Server.GetOnlineCount() → number
Number of players on this GameServer.
Log.Add("Players online: " .. Server.GetOnlineCount())Server.GetMaxUser() → number
Maximum number of players this GameServer accepts.
if Server.GetOnlineCount() >= Server.GetMaxUser() * 0.9 then
Log.AddC(3, "The server is almost full")
endServer.GetVersion() → string
Client version accepted by the server, as five numbers separated by dots (A.BB.CC.D.E, for example "1.04.xx.x.x").
Log.Add("Accepted client version: " .. Server.GetVersion())Server.GetMode() → number
Server type: 0 PvP, 1 non-PvP, 2 Golden PvP, 3 Golden non-PvP.
local mode = Server.GetMode()
if mode == 2 or mode == 3 then
Message.SendAll(0, "Golden server: double drop all day")
endServer.IsNonPvP() → boolean
true when PvP is turned off on this GameServer.
if not Server.IsNonPvP() then
Message.Send(aIndex, 3, "Careful: PvP is on in this server")
endServer.GetClassPointsPerLevel(class) → number
Level-up points a character class gets on each new level. class is a CLASS_* constant. Returns 0 for an unknown class.
local points = Server.GetClassPointsPerLevel(CLASS_DK)
Log.Add("Dark Knight points per level: " .. points)Server.Is28Option() → boolean
Always true: the +28 item option is always on in this version.
if Server.Is28Option() then
Log.Add("The +28 item option is on")
endServer.GetLanguage() → string
Name of the language file the server uses (from the Lang folder).
Log.Add("Server language file: " .. Server.GetLanguage())Works for every object: characters, monsters and NPCs. index is the object index (aIndex for a character).
The ForEach... functions call a callback once for each object, with the object index as the only argument. Return false from the callback to stop the loop. An error inside the callback stops the loop and is reported to the calling script. The loop functions return nothing.
Object.GetUserRange() → number, number
Two values: the lowest and the highest character index.
local first, last = Object.GetUserRange()
for i = first, last do
if Object.GetConnectStatus(i) == OBJECT_ONLINE then
Log.Add("In game: " .. Object.GetName(i))
end
endObject.GetMonsterRange() → number, number
Two values: the lowest and the highest monster index.
local first, last = Object.GetMonsterRange()
Log.Add("Monster indexes: " .. first .. " to " .. last)Object.GetSummonRange() → number, number
Two values: the lowest and the highest index used by summoned monsters.
local first, last = Object.GetSummonRange()
for i = first, last do
if Object.IsLive(i) then Log.Add("Summon alive: " .. i) end
endObject.GetMaxIndex() → number
Highest object index on this GameServer.
for i = 0, Object.GetMaxIndex() do
if Object.GetType(i) == OBJECT_NPC then Log.Add("NPC: " .. Object.GetName(i)) end
endObject.GetMaxItem() → number
Maximum number of items that can lie on the ground of one map.
Log.Add("Max items on the ground per map: " .. Object.GetMaxItem())Object.GetType(index) → number
Kind of object: 0 empty (OBJECT_NONE), 1 character (OBJECT_USER), 2 monster (OBJECT_MONSTER), 3 NPC (OBJECT_NPC), 5 item on the ground (OBJECT_ITEM).
if Object.GetType(targetIndex) == OBJECT_MONSTER then
Message.Send(aIndex, 1, "You are attacking " .. Object.GetName(targetIndex))
endObject.GetConnectStatus(index) → number
0 empty (OBJECT_OFFLINE), 1 connected (OBJECT_CONNECTED), 2 logged in (OBJECT_LOGGED), 3 in game (OBJECT_ONLINE). 0 if the index is not valid.
if Object.GetConnectStatus(aIndex) == OBJECT_ONLINE then
Message.Send(aIndex, 1, "Hello!")
endObject.GetName(index) → string
Name of the character, monster or NPC. "" if the object does not exist.
Message.SendAll(0, Object.GetName(aIndex) .. " has joined the event")Object.GetClass(index) → number
Character class (CLASS_*) or monster ID. -1 if the index is not a character, monster or NPC.
if Object.GetClass(aIndex) == CLASS_DW then
Message.Send(aIndex, 1, "Dark Wizard bonus: +10% mana")
endObject.GetMap(index) → number
Map number where the object is (MAP_*). Returns 0 if the object does not exist, so check the object first when it matters (0 is also Lorencia).
if Object.GetMap(aIndex) == MAP_LORENCIA then
Message.Send(aIndex, 1, "Welcome to Lorencia")
endObject.GetX(index) → number
X position (cell, 0..255) of the object. 0 if the object does not exist.
local x, y = Object.GetX(aIndex), Object.GetY(aIndex)
Message.Send(aIndex, 1, "You are at " .. x .. ", " .. y)Object.GetY(index) → number
Y position (cell, 0..255) of the object. 0 if the object does not exist.
if Object.GetY(aIndex) > 200 then
Message.Send(aIndex, 3, "You are near the north edge of the map")
endObject.GetDirection(index) → number
Direction the object is facing, 0..7. 0 if the object does not exist.
Log.Add(Object.GetName(aIndex) .. " faces direction " .. Object.GetDirection(aIndex))Object.GetTarget(index) → number
For a monster: the object it is attacking. For a character: its current target. -1 if there is none.
local target = Object.GetTarget(monsterIndex)
if target ~= -1 and Object.GetType(target) == OBJECT_USER then
Message.Send(target, 3, Object.GetName(monsterIndex) .. " is chasing you!")
endObject.IsLive(index) → boolean
true if the character or monster exists and is alive.
if not Object.IsLive(aIndex) then
Message.Send(aIndex, 3, "You cannot do this while dead")
endObject.Warp(index, x, y) → boolean
Moves a character or monster to x, y (each clamped to 0..255) inside its current map. Returns false if the object cannot be changed or x / y is missing. To change map, use Player.MoveTo.
if Object.GetMap(aIndex) == MAP_LORENCIA then
Object.Warp(aIndex, 135, 128)
endObject.Kill(index) → boolean
Kills a character or monster. Returns false if the object is already dead or cannot be changed.
Object.ForEachMonsterOnMap(MAP_ARENA, function(monsterIndex)
Object.Kill(monsterIndex)
end)Object.ViewportCreate(index)
Shows the object again to the players around it. Returns nothing.
Object.ViewportDestroy(aIndex)
Object.ViewportCreate(aIndex) -- refresh how the character looks to othersObject.ViewportDestroy(index)
Hides the object from the players around it. Returns nothing.
if Player.IsGameMaster(aIndex) then
Object.ViewportDestroy(aIndex)
endObject.ForEachPlayer(callback)
Calls callback(aIndex) for every character in game on this GameServer.
Object.ForEachPlayer(function(aIndex)
Message.Send(aIndex, 0, "Double EXP has started!")
end)Object.ForEachPlayerOnMap(map, callback)
Calls callback(aIndex) for every character in game on one map. Does nothing if the map is not on this GameServer.
Object.ForEachPlayerOnMap(MAP_LORENCIA, function(aIndex)
Message.Send(aIndex, 0, "The Lorencia event has started!")
end)Object.ForEach(callback)
Calls callback(index) for every character, monster and NPC that exists.
local npcs = 0
Object.ForEach(function(index)
if Object.GetType(index) == OBJECT_NPC then npcs = npcs + 1 end
end)
Log.Add("NPCs: " .. npcs)Object.ForEachMonster(callback)
Calls callback(index) for every monster that is alive in the world, on every map. NPCs are monster objects too; filter with Object.GetType if needed.
Object.ForEachMonster(function(index)
if Object.GetName(index) == "Kundun" then
Log.Add("Kundun is on map " .. Object.GetMap(index))
return false -- found it, stop the loop
end
end)Object.ForEachMonsterOnMap(map, callback)
Calls callback(index) for every living monster on one map.
Object.ForEachMonsterOnMap(MAP_DEVIAS, function(index)
Object.SetPower(index, POWER_LIFE, Object.GetMaxPower(index, POWER_LIFE))
end)Object.ForEachMonsterByClass(class, callback)
Calls callback(index) for every living monster of one class (monster ID), on every map.
local GOLDEN_BUDGE_DRAGON = 43
Object.ForEachMonsterByClass(GOLDEN_BUDGE_DRAGON, function(index)
Message.SendAll(1, "A Golden Budge Dragon is on " .. Map.GetName(Object.GetMap(index)))
end)Object.ForEachPartyMember(partyNumber, callback)
Calls callback(aIndex) for every party member in game on this GameServer. Get the party number with Player.GetPartyNumber(aIndex) (-1 = no party).
local party = Player.GetPartyNumber(aIndex)
if party ~= -1 then
Object.ForEachPartyMember(party, function(member)
Message.Send(member, 1, "Your party found a treasure!")
end)
endObject.ForEachGuildMember(guild, callback)
Calls callback(aIndex) for every guild member in game on this GameServer. guild is the guild number or the guild name.
Object.ForEachGuildMember("Warriors", function(member)
Message.Send(member, 2, "Guild meeting in Lorencia in 5 minutes")
end)Object.ForEachNearby(index, range, callback)
Calls callback(index) for every living character and monster in game on the same map (and instance) within range cells (0..255) of the object. The object itself is not included.
Object.ForEachNearby(aIndex, 5, function(other)
if Object.GetType(other) == OBJECT_USER then
Message.Send(other, 1, Object.GetName(aIndex) .. " heals everyone nearby")
Object.SetPower(other, POWER_LIFE, Object.GetMaxPower(other, POWER_LIFE))
end
end)Object.CountPlayersOnMap(map) → number
Number of characters in game on a map. 0 if the map is not on this GameServer.
if Object.CountPlayersOnMap(MAP_ARENA) < 2 then
Message.SendAll(0, "Not enough players in the Arena: event cancelled")
endObject.CountMonstersOnMap(map, class) → number
Number of living monsters on a map. class is optional: without it every class is counted (NPCs too).
local GOLDEN_BUDGE_DRAGON = 43
local left = Object.CountMonstersOnMap(MAP_LORENCIA, GOLDEN_BUDGE_DRAGON)
Message.SendAll(1, left .. " golden monsters left in Lorencia")power: POWER_LIFE (0), POWER_MANA (1), POWER_SHIELD (2), POWER_STAMINA (3, AG / BP). Another value returns 0 or false. These functions work for characters and monsters.
Object.GetPower(index, power) → number
Current value of HP, MP, SD or AG.
local hp = Object.GetPower(aIndex, POWER_LIFE)
if hp < Object.GetMaxPower(aIndex, POWER_LIFE) / 4 then
Message.Send(aIndex, 3, "Your HP is low!")
endObject.GetMaxPower(index, power) → number
Maximum value (base + added part).
local maxMana = Object.GetMaxPower(aIndex, POWER_MANA)
Message.Send(aIndex, 1, "Your maximum mana is " .. maxMana)Object.GetAddPower(index, power) → number
Only the added part of the maximum (from items, buffs ...).
local bonus = Object.GetAddPower(aIndex, POWER_LIFE)
Message.Send(aIndex, 1, "Bonus HP from items and buffs: " .. bonus)Object.SetPower(index, power, value) → boolean
Sets the current value. It is clamped to 0..maximum and sent to the client. Returns false if the object cannot be changed or an argument is wrong.
Object.SetPower(aIndex, POWER_LIFE, Object.GetMaxPower(aIndex, POWER_LIFE))
Object.SetPower(aIndex, POWER_MANA, Object.GetMaxPower(aIndex, POWER_MANA))Object.SetMaxPower(index, power, value) → boolean
Sets the maximum (at least 1); if the current value is higher it is lowered to the new maximum, then both are sent to the client. Temporary: the next stat calculation (Player.ReCalc, changing items ...) recalculates it.
local boss = Monster.Create(43, MAP_LORENCIA, 130, 130)
if boss ~= -1 then
Object.SetMaxPower(boss, POWER_LIFE, 5000000)
Object.SetPower(boss, POWER_LIFE, 5000000)
endObject.GetCombatStat(index, name) / Object.SetCombatStat(index, name, value). A value set here is temporary: the next stat calculation recalculates it. For permanent bonuses use the option table. Names are not case sensitive.
| Names |
|---|
AttackDamageMin AttackDamageMax AttackDamageMinRight AttackDamageMaxRight AttackDamageMinLeft AttackDamageMaxLeft
|
MagicDamageMin MagicDamageMax CurseDamageMin CurseDamageMax
|
AttackRating AttackRatingPvP AttackSpeed MagicSpeed MoveSpeed
|
Defense DefensePvP DefenseRating DefenseRatingPvP MagicDefense
|
CriticalDamage ExcellentDamage DoubleDamage DamageDecrease ReflectDamage SkillDamage DamageAdd
|
ElementalDefense ElementalDamageMin ElementalDamageMax ElementalAttackRating ElementalDefenseRating
|
DebuffResistance DebuffDefense
|
Object.GetCombatStat(index, name) → number
Current value of a combat stat (names in the table above). 0 for an unknown name.
local def = Object.GetCombatStat(aIndex, "Defense")
Message.Send(aIndex, 1, "Your defense: " .. def)Object.SetCombatStat(index, name, value) → boolean
Sets a combat stat until the next stat calculation. Returns false for an unknown name, a missing value or an object that cannot be changed.
local speed = Object.GetCombatStat(aIndex, "AttackSpeed")
Object.SetCombatStat(aIndex, "AttackSpeed", speed + 20)Monster.Create(class, map, x, y, dir, moveRange, despawnSeconds, instance) → number
Spawns a monster and returns its index (-1 on error). Only class, map, x, y are required. dir -1 (default) = random, moveRange -1 (default) = from the monster data, despawnSeconds 0 (default) = stays until killed (maximum 30 days), instance default -1. The monster does not respawn after it dies.
local index = Monster.Create(43, MAP_LORENCIA, 135, 128, -1, -1, 600)
if index ~= -1 then
Message.SendAll(0, "A golden monster appeared in Lorencia for 10 minutes!")
endMonster.CreateInArea(class, map, x1, y1, x2, y2, count, despawnSeconds) → number
Spawns count monsters (1..200, default 1) at random points of the area x1, y1 - x2, y2. despawnSeconds 0 (default) = they stay until killed. Returns how many were spawned.
local spawned = Monster.CreateInArea(43, MAP_NORIA, 160, 90, 190, 120, 20, 1800)
Message.SendAll(0, spawned .. " golden monsters invaded Noria!")Monster.CreateEx(class, map, x, y, dir, moveRange, life, damageMin, damageMax, defense, attackRate, defenseRate) → number
Spawns a monster with custom stats and returns its index (-1 on error). Stats that are missing or 0 keep the monster data value. The monster stays until killed.
local boss = Monster.CreateEx(43, MAP_LORENCIA, 130, 130, -1, 3, 2000000, 800, 1200, 500, 3000, 2000)
if boss ~= -1 then
Message.SendAll(0, "The Golden Boss has appeared in Lorencia!")
endMonster.Delete(index) → boolean
Removes a monster spawned by a script or a GM command. Monsters that belong to the map cannot be removed (false).
Object.ForEachMonsterOnMap(MAP_ARENA, function(index)
Monster.Delete(index) -- only script monsters are removed
end)Monster.GetTopDamageDealer(index) → number
Index of the character that did the most damage to the monster, -1 if none.
Object.ForEachMonsterByClass(43, function(index)
local top = Monster.GetTopDamageDealer(index)
if top ~= -1 then Message.SendAll(1, Object.GetName(top) .. " leads the boss fight") end
end)Monster.GetAttr(class) → table or nil
Data of a monster class from Monster.xml, or nil if the class does not exist.
Monster.GetAttr fields: Class Name Level Life Mana DamageMin DamageMax Defense AttackRate DefenseRate MoveRange AttackRange ViewRange AttackSpeed RespawnTimeMin RespawnTimeMax ItemRate ZenRate ElementalAttribute ScriptName.
local attr = Monster.GetAttr(43)
if attr ~= nil then
Log.Add(attr.Name .. " level " .. attr.Level .. ", HP " .. attr.Life)
endMonster.WatchRespawn(class, watch)
Turns the onMonsterRespawn event on (true, default) or off (false) for one monster class. Returns nothing.
function AnnounceBoss(monsterIndex, class)
Message.SendAll(0, Object.GetName(monsterIndex) .. " is back!")
end
BridgeFunctionAttach("OnMonsterRespawn", "AnnounceBoss")
Monster.WatchRespawn(43, true)Skill.Watch(skill, watch)
Turns the onUseSkill event on (true, default) or off (false) for one skill number. Returns nothing.
function NoSkillInTown(aIndex, targetIndex, skill)
return Object.GetMap(aIndex) ~= MAP_LORENCIA
end
BridgeFunctionAttach("OnUseSkill", "NoSkillInTown")
Skill.Watch(9, true)Use Player.GetPartyNumber(aIndex) to get the party of a character.
Party.GetCount(partyNumber) → number
Number of members in the party. 0 if the party does not exist.
local party = Player.GetPartyNumber(aIndex)
if party == -1 or Party.GetCount(party) < 3 then
Message.Send(aIndex, 3, "You need a party of 3 or more")
endParty.GetMember(partyNumber, n) → number
Index of member n (1..5, 1 = leader). -1 if the slot is empty or the member is not online on this GameServer.
local leader = Party.GetMember(Player.GetPartyNumber(aIndex), 1)
if leader ~= -1 then
Message.Send(aIndex, 1, "Your party leader is " .. Object.GetName(leader))
endMap.GetName(map) → string
Name of the map. "" if the map is not on this GameServer.
local map = Object.GetMap(aIndex)
Message.Send(aIndex, 1, "You are in " .. Map.GetName(map))Map.Exists(map) → boolean
true if the map is hosted on this GameServer.
if Map.Exists(MAP_KANTURU3) then
Player.MoveTo(aIndex, MAP_KANTURU3, 80, 120)
endMap.GetAttr(map, x, y) → number
Attribute bits of a cell: 1 safe zone, 2 standing, 4 / 8 / 16 blocked. 0 if the map is not on this GameServer or x / y is missing.
local attr = Map.GetAttr(MAP_LORENCIA, 135, 128)
if bit32.band(attr, 4 + 8 + 16) ~= 0 then
Log.Add("This cell is blocked")
endMap.CheckAttr(map, x, y, attr) → boolean
true if the cell has any of the bits of attr.
if Map.CheckAttr(Object.GetMap(aIndex), Object.GetX(aIndex), Object.GetY(aIndex), 1) then
Message.Send(aIndex, 3, "You cannot start a duel in the safe zone")
endMap.Fireworks(map, x, y, instance)
Fireworks at a point, shown to the players near it. instance is optional (default -1). Returns nothing.
Map.Fireworks(MAP_LORENCIA, 135, 128)
Message.SendAll(0, "Happy New Year!")Message type: 0 gold (screen centre), 1 blue, 2 guild, 3 red.
Texts longer than 1024 bytes are cut. See Languages for non-English text.
Message.Send(aIndex, type, text)
Sends a message to one player. type default 1. Returns nothing.
Message.Send(aIndex, 1, "Welcome, " .. Object.GetName(aIndex) .. "!")Message.SendAll(type, text)
Sends a message to everyone on this GameServer. type default 0. Returns nothing.
Message.SendAll(0, "Blood Castle opens in 5 minutes")Message.SendGlobal(type, text)
Sends a message to every GameServer through Server_Link (this one included). If Server_Link is not connected, only this GameServer gets it. type default 0. Returns nothing.
Message.SendGlobal(0, Object.GetName(aIndex) .. " has reached reset 100!")Message.Box(aIndex, type, title, text)
Shows a message box in the centre of the screen of one player. Returns nothing.
type is the box style shown by the client (default 1); the GameServer itself uses 0 and 1. The title holds up to 100 bytes and the text up to 150 bytes (UTF-8: Vietnamese, Thai, Chinese ... characters take 2-3 bytes each); longer text is cut. Use \n for a new line.
Message.Box(aIndex, 1, "Event", "You won 100 WCoin. Congratulations!")Message.BoxAll(type, title, text)
Shows a message box to every player in game on this GameServer. Returns nothing. type, title and text work as in Message.Box (box style, default 1; title up to 100 bytes, text up to 150 bytes).
Message.BoxAll(1, "Maintenance", "The server restarts in 10 minutes.")Message.NpcSay(npcIndex, aIndex, text)
The NPC (or monster) says text to one player. With aIndex = -1 (or no player) it talks to everyone near it. Returns nothing.
function GreetPlayer(npcIndex, aIndex)
Message.NpcSay(npcIndex, aIndex, "Hello, " .. Object.GetName(aIndex) .. "!")
end
BridgeFunctionAttach("OnNpcTalk", "GreetPlayer")Message.Post(name, text)
Shows a /post style line, sent by name, to everyone on this GameServer. The text is cut to about 200 bytes. Returns nothing.
Message.Post("[Event]", "The Golden Invasion has started in Lorencia!")Message.GetText(id, default) → string
Text number id from the server language file. Returns default if the text is missing or id is negative.
local text = Message.GetText(500, "You do not have enough Zen")
Message.Send(aIndex, 3, text)Paths work like File.* (see Config files).
Config.ReadNumber(section, key, path, default) → number
Number from an INI file. Returns default (0 if not given) when the file, section or key is missing.
local path = "Includes\\GoldenEvent\\GoldenEvent.ini"
local count = Config.ReadNumber("Spawn", "Count", path, 10)
Monster.CreateInArea(43, MAP_LORENCIA, 120, 120, 150, 150, count)Config.ReadString(section, key, path, default) → string
Text from an INI file. Returns default ("" if not given) when the file, section or key is missing.
local path = "Includes\\GoldenEvent\\GoldenEvent.ini"
local notice = Config.ReadString("Text", "Start", path, "The event has started!")
Message.SendAll(0, notice)Config.SaveString(section, key, value, path) → boolean
Writes a value to an INI file. Only files inside the Data folder can be written; section and key must not be empty. Returns true on success.
local path = "Includes\\GoldenEvent\\GoldenEvent.ini"
local runs = Config.ReadNumber("Stats", "Runs", path, 0) + 1
Config.SaveString("Stats", "Runs", tostring(runs), path)Log.Add(text)
Writes a normal line to the GameServer log (with a [Lua] prefix). Returns nothing.
Log.Add(Object.GetName(aIndex) .. " finished the quest")Log.AddC(color, text)
Writes a line to the GameServer log: 1 = red (error), 3 = yellow (warning), anything else = normal. Returns nothing.
if not Map.Exists(MAP_ARENA) then
Log.AddC(1, "Arena event: the Arena map is not on this server")
endUtil.Random(min, max) → number
Random integer in [min, max] (both included). If max is smaller than min they are swapped.
if Util.Random(1, 100) <= 5 then
Message.Send(aIndex, 0, "Lucky! You found a hidden reward")
endUtil.LargeRandom() → number
Random integer in [0, 4294967295].
local code = Util.LargeRandom() % 1000000
Message.Send(aIndex, 1, "Your lottery number: " .. code)Util.GetTick() → number
Milliseconds since the machine started. Use it to measure time.
local start = Util.GetTick()
Object.ForEachPlayer(function(aIndex) Message.Send(aIndex, 1, "Ping") end)
Log.Add("Sent in " .. (Util.GetTick() - start) .. " ms")Util.ArgNumber(text, pos) → number
Word number pos (starting at 0) of text as a number. Words are separated by spaces or tabs. Returns 0 if the word is missing or is not a number.
-- text = "/roll 100"
local max = Util.ArgNumber(text, 1)
if max < 2 then max = 100 end
Message.SendAll(1, Object.GetName(aIndex) .. " rolls " .. Util.Random(1, max))Util.ArgString(text, pos) → string
Word number pos (starting at 0) of text. Returns "" if the word is missing.
-- text = "/find Warrior"
local name = Util.ArgString(text, 1)
local target = Player.GetIndexByName(name)
if target ~= -1 then Message.Send(aIndex, 1, name .. " is on " .. Map.GetName(Object.GetMap(target))) endEvent.Refresh()
Tells the GameServer which on... event functions now exist, so it starts sending them. Call it after you create an event function at run time (BridgeFunctionAttach does it for you). Returns nothing.
function onPlayerLevelUp(aIndex, levelType, newLevel)
Message.Send(aIndex, 1, "Level up! You are now level " .. newLevel)
end
Event.Refresh()Next: Player functions