Hello,
I use OtserverBR-Global TFS 1.3
I need to make script to teleport player to temple if he die for monster or player or everything. But without appear message dead and without logout || player only teleport to temple and restore all mana and life without loss exp and bless || ( exp and bless i configure in config.lua and work 100% , to restore mana and life i need ).
player death.lua
-----
login events.lua
----
login.lua
Thank !!
I use OtserverBR-Global TFS 1.3
I need to make script to teleport player to temple if he die for monster or player or everything. But without appear message dead and without logout || player only teleport to temple and restore all mana and life without loss exp and bless || ( exp and bless i configure in config.lua and work 100% , to restore mana and life i need ).
player death.lua
local deathListEnabled = true
local playerDeath = CreatureEvent("PlayerDeath")
function playerDeath.onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
local playerId = player:getId()
if nextUseStaminaTime[playerId] ~= nil then
nextUseStaminaTime[playerId] = nil
end
player:sendTextMessage(MESSAGE_BEYOND_LAST, 'You are dead.')
if player:getStorageValue(Storage.SvargrondArena.PitDoor) > 0 then
player:setStorageValue(Storage.SvargrondArena.PitDoor, 0)
end
if not deathListEnabled then
return
end
local byPlayer = 0
local killerName
if killer ~= nil then
if killer:isPlayer() then
byPlayer = 1
else
local master = killer:getMaster()
if master and master ~= killer and master:isPlayer() then
killer = master
byPlayer = 1
end
end
killerName = killer:isMonster() and killer:getType():getNameDescription() or killer:getName()
else
killerName = 'field item'
end
local byPlayerMostDamage = 0
local mostDamageKillerName
if mostDamageKiller ~= nil then
if mostDamageKiller:isPlayer() then
byPlayerMostDamage = 1
else
local master = mostDamageKiller:getMaster()
if master and master ~= mostDamageKiller and master:isPlayer() then
mostDamageKiller = master
byPlayerMostDamage = 1
end
end
mostDamageName = mostDamageKiller:isMonster() and mostDamageKiller:getType():getNameDescription() or mostDamageKiller:getName()
else
mostDamageName = 'field item'
end
local playerGuid = player:getGuid()
db.query('INSERT INTO
local resultId = db.storeQuery('SELECT
local deathRecords = 0
local tmpResultId = resultId
while tmpResultId ~= false do
tmpResultId = result.next(resultId)
deathRecords = deathRecords + 1
end
if resultId ~= false then
result.free(resultId)
end
if byPlayer == 1 then
local targetGuild = player:getGuild()
targetGuild = targetGuild and targetGuild:getId() or 0
if targetGuild ~= 0 then
local killerGuild = killer:getGuild()
killerGuild = killerGuild and killerGuild:getId() or 0
if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer.uid) then
local warId = false
resultId = db.storeQuery('SELECT
((
(
if resultId ~= false then
warId = result.getNumber(resultId, 'id')
result.free(resultId)
end
if warId ~= false then
db.asyncQuery('INSERT INTO
VALUES (' .. db.escapeString(killerName) .. ', ' .. db.escapeString(player:getName()) .. ', ' .. killerGuild .. ', \z
' .. targetGuild .. ', ' .. os.time() .. ', ' .. warId .. ')')
end
end
end
end
end
playerDeath:register()
local playerDeath = CreatureEvent("PlayerDeath")
function playerDeath.onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
local playerId = player:getId()
if nextUseStaminaTime[playerId] ~= nil then
nextUseStaminaTime[playerId] = nil
end
player:sendTextMessage(MESSAGE_BEYOND_LAST, 'You are dead.')
if player:getStorageValue(Storage.SvargrondArena.PitDoor) > 0 then
player:setStorageValue(Storage.SvargrondArena.PitDoor, 0)
end
if not deathListEnabled then
return
end
local byPlayer = 0
local killerName
if killer ~= nil then
if killer:isPlayer() then
byPlayer = 1
else
local master = killer:getMaster()
if master and master ~= killer and master:isPlayer() then
killer = master
byPlayer = 1
end
end
killerName = killer:isMonster() and killer:getType():getNameDescription() or killer:getName()
else
killerName = 'field item'
end
local byPlayerMostDamage = 0
local mostDamageKillerName
if mostDamageKiller ~= nil then
if mostDamageKiller:isPlayer() then
byPlayerMostDamage = 1
else
local master = mostDamageKiller:getMaster()
if master and master ~= mostDamageKiller and master:isPlayer() then
mostDamageKiller = master
byPlayerMostDamage = 1
end
end
mostDamageName = mostDamageKiller:isMonster() and mostDamageKiller:getType():getNameDescription() or mostDamageKiller:getName()
else
mostDamageName = 'field item'
end
local playerGuid = player:getGuid()
db.query('INSERT INTO
player_deaths
(player_id
, time
, level
, killed_by
, is_player
, mostdamage_by
, mostdamage_is_player
, unjustified
, mostdamage_unjustified
) VALUES (' .. playerGuid .. ', ' .. os.time() .. ', ' .. player:getLevel() .. ', ' .. db.escapeString(killerName) .. ', ' .. byPlayer .. ', ' .. db.escapeString(mostDamageName) .. ', ' .. byPlayerMostDamage .. ', ' .. (unjustified and 1 or 0) .. ', ' .. (mostDamageUnjustified and 1 or 0) .. ')')local resultId = db.storeQuery('SELECT
player_id
FROM player_deaths
WHERE player_id
= ' .. playerGuid)local deathRecords = 0
local tmpResultId = resultId
while tmpResultId ~= false do
tmpResultId = result.next(resultId)
deathRecords = deathRecords + 1
end
if resultId ~= false then
result.free(resultId)
end
if byPlayer == 1 then
local targetGuild = player:getGuild()
targetGuild = targetGuild and targetGuild:getId() or 0
if targetGuild ~= 0 then
local killerGuild = killer:getGuild()
killerGuild = killerGuild and killerGuild:getId() or 0
if killerGuild ~= 0 and targetGuild ~= killerGuild and isInWar(playerId, killer.uid) then
local warId = false
resultId = db.storeQuery('SELECT
id
FROM guild_wars
WHERE status
= 1 AND \z((
guild1
= ' .. killerGuild .. ' AND guild2
= ' .. targetGuild .. ') OR \z(
guild1
= ' .. targetGuild .. ' AND guild2
= ' .. killerGuild .. '))')if resultId ~= false then
warId = result.getNumber(resultId, 'id')
result.free(resultId)
end
if warId ~= false then
db.asyncQuery('INSERT INTO
guildwar_kills
(killer
, target
, killerguild
, targetguild
, time
, warid
) \zVALUES (' .. db.escapeString(killerName) .. ', ' .. db.escapeString(player:getName()) .. ', ' .. killerGuild .. ', \z
' .. targetGuild .. ', ' .. os.time() .. ', ' .. warId .. ')')
end
end
end
end
end
playerDeath:register()
-----
login events.lua
local loginEvents = CreatureEvent("LoginEvents")
function loginEvents.onLogin(player)
local events = {
--Monster
"LowerRoshamuul",
--Others
"AdvanceSave",
"BestiaryOnKill",
"BossParticipation",
"DropLoot",
"PlayerDeath",
"PreyLootBonusKill",
"RookgaardAdvance",
"FamiliarLogin",
"AdvanceFamiliar",
--Quests
--Adventurers Guild Quest
"Thegreatdragonhuntkill",
--Bigfoot Burden Quest
"BossesWarzone",
"ParasiteWarzone",
"VersperothKill",
"WigglerKill",
--Cults Of Tibia Quest
"BossesCults",
"MinotaurTask",
"VortexCarlin",
"LeidenHeal",
"GlowingRubbishAmulet",
"DestroyedPillar",
"HealthPillar",
"YalahariHealth",
--Dangerous Depths Quest
"LostExileKill",
"SnailSlimeKill",
"TheBaronFromBelowKill",
--Dawnport Quest
"MorrisMinotaurKill",
"MorrisGoblinKill",
"MorrisTrollKill",
--Elemental Spheres Quest
"OverlordKill",
--Ferumbras Ascendant Quest
"AscendantBossesKill",
"TheShattererKill",
--Firewalker Boots
"PythiusTheRottenKill",
--Forgotten Knowledge Quest
"BossesForgottenKill",
"AstralPower",
"EnergyPrismDeath",
"ReplicaServant",
--Hero Of Rathleton
"RathletonBossKill",
--Secret Service
"BlackKnightKill",
--Service Of Yalahar
"DiseasedTrio",
"Azerus",
"QuaraLeaders",
--Inquisition
"InquisitionBossKill",
"UngreezKill",
--Killing In The Name Of
"KillingInTheNameOfKill",
"KillingInTheNameOfMinotaurKill",
--Kilmaresh
"BragrumolKill",
"MozradekKill",
"XogixathKill",
"FafnarKill",
--Liquid Black
"DeeplingBosses",
--Raging Mage Worldchange
"EnergizedRagingMageKill",
"RagingMageKill",
"YielothaxKill",
--Spike Tasks
"LowerSpikeKill",
"UpperSpikeKill",
"MiddleSpikeKill",
--Svargrond Arena
"SvargrondArenaKill",
--The First Dragon
"KillDragon",
"SomewhatBeatableDeath",
--The New Frontier
"ShardOfCorruptionKill",
"TireczKill",
--Thieves Guild
"NomadKill",
--Wrath of the Emperor
"LizardMagistratusKill",
"LizardNobleKill",
"KeeperKill",
"BossesKill",
"ZalamonKill",
-- The Rookie Guard
"VascalirRatKills"
}
for i = 1, #events do
player:registerEvent(events)
end
return true
end
loginEvents:register()
function loginEvents.onLogin(player)
local events = {
--Monster
"LowerRoshamuul",
--Others
"AdvanceSave",
"BestiaryOnKill",
"BossParticipation",
"DropLoot",
"PlayerDeath",
"PreyLootBonusKill",
"RookgaardAdvance",
"FamiliarLogin",
"AdvanceFamiliar",
--Quests
--Adventurers Guild Quest
"Thegreatdragonhuntkill",
--Bigfoot Burden Quest
"BossesWarzone",
"ParasiteWarzone",
"VersperothKill",
"WigglerKill",
--Cults Of Tibia Quest
"BossesCults",
"MinotaurTask",
"VortexCarlin",
"LeidenHeal",
"GlowingRubbishAmulet",
"DestroyedPillar",
"HealthPillar",
"YalahariHealth",
--Dangerous Depths Quest
"LostExileKill",
"SnailSlimeKill",
"TheBaronFromBelowKill",
--Dawnport Quest
"MorrisMinotaurKill",
"MorrisGoblinKill",
"MorrisTrollKill",
--Elemental Spheres Quest
"OverlordKill",
--Ferumbras Ascendant Quest
"AscendantBossesKill",
"TheShattererKill",
--Firewalker Boots
"PythiusTheRottenKill",
--Forgotten Knowledge Quest
"BossesForgottenKill",
"AstralPower",
"EnergyPrismDeath",
"ReplicaServant",
--Hero Of Rathleton
"RathletonBossKill",
--Secret Service
"BlackKnightKill",
--Service Of Yalahar
"DiseasedTrio",
"Azerus",
"QuaraLeaders",
--Inquisition
"InquisitionBossKill",
"UngreezKill",
--Killing In The Name Of
"KillingInTheNameOfKill",
"KillingInTheNameOfMinotaurKill",
--Kilmaresh
"BragrumolKill",
"MozradekKill",
"XogixathKill",
"FafnarKill",
--Liquid Black
"DeeplingBosses",
--Raging Mage Worldchange
"EnergizedRagingMageKill",
"RagingMageKill",
"YielothaxKill",
--Spike Tasks
"LowerSpikeKill",
"UpperSpikeKill",
"MiddleSpikeKill",
--Svargrond Arena
"SvargrondArenaKill",
--The First Dragon
"KillDragon",
"SomewhatBeatableDeath",
--The New Frontier
"ShardOfCorruptionKill",
"TireczKill",
--Thieves Guild
"NomadKill",
--Wrath of the Emperor
"LizardMagistratusKill",
"LizardNobleKill",
"KeeperKill",
"BossesKill",
"ZalamonKill",
-- The Rookie Guard
"VascalirRatKills"
}
for i = 1, #events do
player:registerEvent(events)
end
return true
end
loginEvents:register()
----
login.lua
local function onMovementRemoveProtection(cid, oldPos, time)
local player = Player(cid)
if not player then
return true
end
local playerPos = player:getPosition()
if (playerPos.x ~= oldPos.x or playerPos.y ~= oldPos.y or playerPos.z ~= oldPos.z) or player:getTarget() then
player:setStorageValue(Storage.combatProtectionStorage, 0)
return true
end
addEvent(onMovementRemoveProtection, 1000, cid, oldPos, time - 1)
end
local function protectionZoneCheck(playerName)
doRemoveCreature(playerName)
return true
end
local playerLogin = CreatureEvent("PlayerLogin")
function playerLogin.onLogin(player)
local items = {
{2120, 1},
{2148, 3}
}
if player:getLastLoginSaved() == 0 then
player:addMount(1)
player:sendOutfitWindow()
local backpack = player:addItem(1988)
if backpack then
for i = 1, #items do
backpack:addItem(items[1], items[2])
end
end
player:addItem(2050, 1, true, 1, CONST_SLOT_AMMO)
else
player:sendTextMessage(MESSAGE_STATUS, "Welcome to " .. SERVER_NAME .. "!")
player:sendTextMessage(MESSAGE_LOGIN, string.format("Your last visit in ".. SERVER_NAME ..": %s.", os.date("%d. %b %Y %X", player:getLastLoginSaved())))
end
local playerId = player:getId()
-- kick other players from account
if configManager.getBoolean(configKeys.ONE_PLAYER_ON_ACCOUNT) then
local resultId = db.storeQuery("SELECT players.name FROM
if resultId ~= false then
repeat
if player:getAccountType() <= ACCOUNT_TYPE_GOD and player:getGroup():getId() < GROUP_TYPE_GOD then
local name = result.getDataString(resultId, "name")
if getCreatureCondition(Player(name), CONDITION_INFIGHT) == false then
Player(name):remove()
else
addEvent(protectionZoneCheck, 2000, player:getName())
doPlayerPopupFYI(player, "You cant login now.")
end
end
until not result.next(resultId)
result.free(resultId)
end
end
-- End kick other players from account
if isPremium(player) then
player:setStorageValue(Storage.PremiumAccount, 1)
end
-- Premium Ends Teleport to Temple, change addon (citizen) houseless
local defaultTown = "Thais" -- default town where player is teleported if his home town is in premium area
local freeTowns = {"Ab'Dendriel", "Carlin", "Kazordoon", "Thais", "Venore", "Rookgaard", "Dawnport", "Dawnport Tutorial", "Island of Destiny"} -- towns in free account area
if isPremium(player) == false and isInArray(freeTowns, player:getTown():getName()) == false then
local town = player:getTown()
local sex = player:getSex()
local home = getHouseByPlayerGUID(getPlayerGUID(player))
town = isInArray(freeTowns, town:getName()) and town or Town(defaultTown)
player:teleportTo(town:getTemplePosition())
player:setTown(town)
player:sendTextMessage(MESSAGE_FAILURE, "Your premium time has expired.")
player:setStorageValue(Storage.PremiumAccount, 0)
if sex == 1 then
player:setOutfit({lookType = 128, lookFeet = 114, lookLegs = 134, lookHead = 114,lookAddons = 0})
elseif sex == 0 then
player:setOutfit({lookType = 136, lookFeet = 114, lookLegs = 134, lookHead = 114, lookAddons = 0})
end
if home ~= nil and not isPremium(player) then
setHouseOwner(home, 0)
player:sendTextMessage(MESSAGE_GAME_HIGHLIGHT, 'You\'ve lost your house because you are not premium anymore.')
player:sendTextMessage(MESSAGE_GAME_HIGHLIGHT, 'Your items from house are send to your inbox.')
end
end
-- End 'Premium Ends Teleport to Temple'
-- Recruiter system
local resultId = db.storeQuery('SELECT
local recruiterStatus = result.getNumber(resultId, 'recruiter')
local sex = player:getSex()
if recruiterStatus >= 1 then
if sex == 1 then
local outfit = player:hasOutfit(746)
if outfit == false then
player:addOutfit(746)
end
else
local outfit = player:hasOutfit(745)
if outfit == false then
player:addOutfit(745)
end
end
end
if recruiterStatus >= 3 then
if sex == 1 then
local outfit = player:hasOutfit(746,1)
if outfit == false then
player:addOutfitAddon(746,1)
end
else
local outfit = player:hasOutfit(745,1)
if outfit == false then
player:addOutfit(745,1)
end
end
end
if recruiterStatus >= 10 then
if sex == 1 then
local outfit = player:hasOutfit(746,2)
if outfit == false then
player:addOutfitAddon(746,2)
end
else
local outfit = player:hasOutfit(745,2)
if outfit == false then
player:addOutfit(745,2)
end
end
end
-- End recruiter system
DailyReward.init(playerId)
player:loadSpecialStorage()
if player:getGroup():getId() >= GROUP_TYPE_GAMEMASTER then
player:setGhostMode(true)
end
-- Boosted creature
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Today's boosted creature: " .. Game.getBoostedCreature() .. " \
Boosted creatures yield more experience points, carry more loot than usual and respawn at a faster rate.")
-- Stamina
nextUseStaminaTime[playerId] = 1
-- EXP Stamina
nextUseXpStamina[playerId] = 1
-- Prey Small Window
for slot = CONST_PREY_SLOT_FIRST, CONST_PREY_SLOT_THIRD do
player:sendPreyData(slot)
end
-- New prey
nextPreyTime[playerId] = {
[CONST_PREY_SLOT_FIRST] = 1,
[CONST_PREY_SLOT_SECOND] = 1,
[CONST_PREY_SLOT_THIRD] = 1
}
if (player:getAccountType() == ACCOUNT_TYPE_TUTOR) then
local msg = [[:: Tutor Rules
1 *> 3 Warnings you lose the job.
2 *> Without parallel conversations with players in Help, if the player starts offending, you simply mute it.
3 *> Be educated with the players in Help and especially in the Private, try to help as much as possible.
4 *> Always be on time, if you do not have a justification you will be removed from the staff.
5 *> Help is only allowed to ask questions related to tibia.
6 *> It is not allowed to divulge time up or to help in quest.
7 *> You are not allowed to sell items in the Help.
8 *> If the player encounters a bug, ask to go to the website to send a ticket and explain in detail.
9 *> Always keep the Tutors Chat open. (required).
10 *> You have finished your schedule, you have no tutor online, you communicate with some CM in-game
or ts and stay in the help until someone logs in, if you can.
11 *> Always keep a good Portuguese in the Help, we want tutors who support, not that they speak a satanic ritual.
12 *> If you see a tutor doing something that violates the rules, take a print and send it to your superiors. "
- Commands -
Mute Player: /mute nick, 90 (90 seconds)
Unmute Player: /unmute nick.
- Commands -]]
playeropupFYI(msg)
end
-- Open channels
if table.contains({TOWNS_LIST.DAWNPORT, TOWNS_LIST.DAWNPORT_TUTORIAL}, player:getTown():getId())then
playerpenChannel(3) -- World chat
else
playerpenChannel(3) -- World chat
playerpenChannel(5) -- Advertsing main
end
-- Rewards
local rewards = #player:getRewardList()
if(rewards > 0) then
player:sendTextMessage(MESSAGE_LOGIN, string.format("You have %d %s in your reward chest.",
rewards, rewards > 1 and "rewards" or "reward"))
end
-- Update player id
local stats = player:inBossFight()
if stats then
stats.playerId = player:getId()
end
if player:getStorageValue(Storage.combatProtectionStorage) < 1 then
player:setStorageValue(Storage.combatProtectionStorage, 1)
onMovementRemoveProtection(playerId, player:getPosition(), 10)
end
-- Set Client XP Gain Rate
local baseExp = 100
if Game.getStorageValue(GlobalStorage.XpDisplayMode) > 0 then
baseExp = getRateFromTable(experienceStages, player:getLevel(), configManager.getNumber(configKeys.RATE_EXP))
end
local staminaMinutes = player:getStamina()
local doubleExp = false --Can change to true if you have double exp on the server
local staminaBonus = (staminaMinutes > 2340) and 150 or ((staminaMinutes < 840) and 50 or 100)
if doubleExp then
baseExp = baseExp * 2
end
player:setStaminaXpBoost(staminaBonus)
player:setBaseXpGain(baseExp)
if player:getStorageValue(Storage.isTraining) == 1 then --Reset exercise weapon storage
player:setStorageValue(Storage.isTraining,0)
end
return true
end
playerLogin:register()
local player = Player(cid)
if not player then
return true
end
local playerPos = player:getPosition()
if (playerPos.x ~= oldPos.x or playerPos.y ~= oldPos.y or playerPos.z ~= oldPos.z) or player:getTarget() then
player:setStorageValue(Storage.combatProtectionStorage, 0)
return true
end
addEvent(onMovementRemoveProtection, 1000, cid, oldPos, time - 1)
end
local function protectionZoneCheck(playerName)
doRemoveCreature(playerName)
return true
end
local playerLogin = CreatureEvent("PlayerLogin")
function playerLogin.onLogin(player)
local items = {
{2120, 1},
{2148, 3}
}
if player:getLastLoginSaved() == 0 then
player:addMount(1)
player:sendOutfitWindow()
local backpack = player:addItem(1988)
if backpack then
for i = 1, #items do
backpack:addItem(items[1], items[2])
end
end
player:addItem(2050, 1, true, 1, CONST_SLOT_AMMO)
else
player:sendTextMessage(MESSAGE_STATUS, "Welcome to " .. SERVER_NAME .. "!")
player:sendTextMessage(MESSAGE_LOGIN, string.format("Your last visit in ".. SERVER_NAME ..": %s.", os.date("%d. %b %Y %X", player:getLastLoginSaved())))
end
local playerId = player:getId()
-- kick other players from account
if configManager.getBoolean(configKeys.ONE_PLAYER_ON_ACCOUNT) then
local resultId = db.storeQuery("SELECT players.name FROM
players
INNER JOIN players_online
WHERE players_online.player_id=players.id and players_online.player_id!=" .. player:getGuid() .. " and players.account_id=" .. player:getAccountId())if resultId ~= false then
repeat
if player:getAccountType() <= ACCOUNT_TYPE_GOD and player:getGroup():getId() < GROUP_TYPE_GOD then
local name = result.getDataString(resultId, "name")
if getCreatureCondition(Player(name), CONDITION_INFIGHT) == false then
Player(name):remove()
else
addEvent(protectionZoneCheck, 2000, player:getName())
doPlayerPopupFYI(player, "You cant login now.")
end
end
until not result.next(resultId)
result.free(resultId)
end
end
-- End kick other players from account
if isPremium(player) then
player:setStorageValue(Storage.PremiumAccount, 1)
end
-- Premium Ends Teleport to Temple, change addon (citizen) houseless
local defaultTown = "Thais" -- default town where player is teleported if his home town is in premium area
local freeTowns = {"Ab'Dendriel", "Carlin", "Kazordoon", "Thais", "Venore", "Rookgaard", "Dawnport", "Dawnport Tutorial", "Island of Destiny"} -- towns in free account area
if isPremium(player) == false and isInArray(freeTowns, player:getTown():getName()) == false then
local town = player:getTown()
local sex = player:getSex()
local home = getHouseByPlayerGUID(getPlayerGUID(player))
town = isInArray(freeTowns, town:getName()) and town or Town(defaultTown)
player:teleportTo(town:getTemplePosition())
player:setTown(town)
player:sendTextMessage(MESSAGE_FAILURE, "Your premium time has expired.")
player:setStorageValue(Storage.PremiumAccount, 0)
if sex == 1 then
player:setOutfit({lookType = 128, lookFeet = 114, lookLegs = 134, lookHead = 114,lookAddons = 0})
elseif sex == 0 then
player:setOutfit({lookType = 136, lookFeet = 114, lookLegs = 134, lookHead = 114, lookAddons = 0})
end
if home ~= nil and not isPremium(player) then
setHouseOwner(home, 0)
player:sendTextMessage(MESSAGE_GAME_HIGHLIGHT, 'You\'ve lost your house because you are not premium anymore.')
player:sendTextMessage(MESSAGE_GAME_HIGHLIGHT, 'Your items from house are send to your inbox.')
end
end
-- End 'Premium Ends Teleport to Temple'
-- Recruiter system
local resultId = db.storeQuery('SELECT
recruiter
from accounts
where id
='..getAccountNumberByPlayerName(getPlayerName(player)))local recruiterStatus = result.getNumber(resultId, 'recruiter')
local sex = player:getSex()
if recruiterStatus >= 1 then
if sex == 1 then
local outfit = player:hasOutfit(746)
if outfit == false then
player:addOutfit(746)
end
else
local outfit = player:hasOutfit(745)
if outfit == false then
player:addOutfit(745)
end
end
end
if recruiterStatus >= 3 then
if sex == 1 then
local outfit = player:hasOutfit(746,1)
if outfit == false then
player:addOutfitAddon(746,1)
end
else
local outfit = player:hasOutfit(745,1)
if outfit == false then
player:addOutfit(745,1)
end
end
end
if recruiterStatus >= 10 then
if sex == 1 then
local outfit = player:hasOutfit(746,2)
if outfit == false then
player:addOutfitAddon(746,2)
end
else
local outfit = player:hasOutfit(745,2)
if outfit == false then
player:addOutfit(745,2)
end
end
end
-- End recruiter system
DailyReward.init(playerId)
player:loadSpecialStorage()
if player:getGroup():getId() >= GROUP_TYPE_GAMEMASTER then
player:setGhostMode(true)
end
-- Boosted creature
player:sendTextMessage(MESSAGE_BOOSTED_CREATURE, "Today's boosted creature: " .. Game.getBoostedCreature() .. " \
Boosted creatures yield more experience points, carry more loot than usual and respawn at a faster rate.")
-- Stamina
nextUseStaminaTime[playerId] = 1
-- EXP Stamina
nextUseXpStamina[playerId] = 1
-- Prey Small Window
for slot = CONST_PREY_SLOT_FIRST, CONST_PREY_SLOT_THIRD do
player:sendPreyData(slot)
end
-- New prey
nextPreyTime[playerId] = {
[CONST_PREY_SLOT_FIRST] = 1,
[CONST_PREY_SLOT_SECOND] = 1,
[CONST_PREY_SLOT_THIRD] = 1
}
if (player:getAccountType() == ACCOUNT_TYPE_TUTOR) then
local msg = [[:: Tutor Rules
1 *> 3 Warnings you lose the job.
2 *> Without parallel conversations with players in Help, if the player starts offending, you simply mute it.
3 *> Be educated with the players in Help and especially in the Private, try to help as much as possible.
4 *> Always be on time, if you do not have a justification you will be removed from the staff.
5 *> Help is only allowed to ask questions related to tibia.
6 *> It is not allowed to divulge time up or to help in quest.
7 *> You are not allowed to sell items in the Help.
8 *> If the player encounters a bug, ask to go to the website to send a ticket and explain in detail.
9 *> Always keep the Tutors Chat open. (required).
10 *> You have finished your schedule, you have no tutor online, you communicate with some CM in-game
or ts and stay in the help until someone logs in, if you can.
11 *> Always keep a good Portuguese in the Help, we want tutors who support, not that they speak a satanic ritual.
12 *> If you see a tutor doing something that violates the rules, take a print and send it to your superiors. "
- Commands -
Mute Player: /mute nick, 90 (90 seconds)
Unmute Player: /unmute nick.
- Commands -]]
playeropupFYI(msg)
end
-- Open channels
if table.contains({TOWNS_LIST.DAWNPORT, TOWNS_LIST.DAWNPORT_TUTORIAL}, player:getTown():getId())then
playerpenChannel(3) -- World chat
else
playerpenChannel(3) -- World chat
playerpenChannel(5) -- Advertsing main
end
-- Rewards
local rewards = #player:getRewardList()
if(rewards > 0) then
player:sendTextMessage(MESSAGE_LOGIN, string.format("You have %d %s in your reward chest.",
rewards, rewards > 1 and "rewards" or "reward"))
end
-- Update player id
local stats = player:inBossFight()
if stats then
stats.playerId = player:getId()
end
if player:getStorageValue(Storage.combatProtectionStorage) < 1 then
player:setStorageValue(Storage.combatProtectionStorage, 1)
onMovementRemoveProtection(playerId, player:getPosition(), 10)
end
-- Set Client XP Gain Rate
local baseExp = 100
if Game.getStorageValue(GlobalStorage.XpDisplayMode) > 0 then
baseExp = getRateFromTable(experienceStages, player:getLevel(), configManager.getNumber(configKeys.RATE_EXP))
end
local staminaMinutes = player:getStamina()
local doubleExp = false --Can change to true if you have double exp on the server
local staminaBonus = (staminaMinutes > 2340) and 150 or ((staminaMinutes < 840) and 50 or 100)
if doubleExp then
baseExp = baseExp * 2
end
player:setStaminaXpBoost(staminaBonus)
player:setBaseXpGain(baseExp)
if player:getStorageValue(Storage.isTraining) == 1 then --Reset exercise weapon storage
player:setStorageValue(Storage.isTraining,0)
end
return true
end
playerLogin:register()
Thank !!