Jump to content
Serpente

Scripting Spellbook não mostra as magias

Recommended Posts

Base Utilizada:

 

TFS 0.3.7 (Crying Damson)

 

 

 

Qual erro está surgindo/O que você procura?

 

Spellbook não está mostrando as magias como deveria, ao utiliza-lo ele vem vazio ao invés de vir escrito as magias da devida vocação, o script já veio com o datapack, e quando utilizo o spellbook não aparece nenhum erro no console.

 

 

Você tem o código disponível? Se tiver publique-o aqui:

Esses são os códigos que já estão presentes no datapack:

 

actions/scripts/others/spellbook.lua

 function onUse(cid, item, fromPosition, itemEx, toPosition)
	local t = {}
	for i = 0, getPlayerInstantSpellCount(cid) - 1 do
		local spell = getPlayerInstantSpellInfo(cid, i)
		if(spell.level ~= 0) then
			if(spell.manapercent > 0) then
				spell.mana = spell.manapercent .. "%"
			end

			table.insert(t, spell)
		end
	end

	table.sort(t, function(a, b) return a.level < b.level end)
	local text, prevLevel = "", -1
	for i, spell in ipairs(t) do
		local line = ""
		if(prevLevel ~= spell.level) then
			if(i ~= 1) then
				line = "\n"
			end

			line = line .. "Spells for Level " .. spell.level .. "\n"
			prevLevel = spell.level
		end

		text = text .. line .. "  " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
	end

	doShowTextDialog(cid, item.itemid, text)
	return true
end

actions/spellbook.xml

<?xml version="1.0" encoding="UTF-8"?>
<actions>
	<!-- Default script, responsible for destroyItem -->
	<action default="yes" event="script" value="default.lua"/>

	<!-- Quests -->
	<action actionid="2000-2001" event="script" value="quests/system.lua"/>
	<action itemid="1740;1747-1749" event="script" value="quests/quests.lua"/>

	<!-- Text -->
	<action itemid="1957;7722;10122" event="script" value="other/text.lua"/>

	<!-- Change gold -->
	<action itemid="2148;2152;2160" event="script" value="other/changegold.lua"/>

	<!-- Tools -->
	<action itemid="2420;2442" event="script" value="tools/machete.lua"/>
	<action itemid="2550" event="script" value="tools/scythe.lua"/>
	<action itemid="2580" event="script" value="tools/fishing.lua" allowfaruse="1"/>
	<action itemid="2554;5710" event="script" value="tools/shovel.lua"/>
	<action itemid="2120" event="script" value="tools/rope.lua"/>
	<action itemid="2553" event="script" value="tools/pick.lua"/>
	<action itemid="5908;5942" event="script" value="tools/skinning.lua"/>

	<!-- Consumables (Liquids+Foods) -->
	<action itemid="1775;2005-2009;2011-2015;2023;2031-2034;2562;2574-2577;3941-3942" event="script" value="liquids/potions.lua"/>
	<action itemid="2328;2362;2666-2691;2695-2696;2787-2796" event="script" value="foods/food.lua"/>

	<!-- Spellbooks -->
	<action itemid="2175;6120" event="script" value="other/spellbook.lua"/>

	<!-- Construction kits -->
	<action itemid="3901-3938;5086-5088;6114-6115;6372-6373" event="script" value="other/constructionkits.lua"/>

	<!-- Music, instruments -->
	<action itemid="2070-2085;2094-2095;2332;2364;2367-2374;3951-3953;3957;5786;6123;9561;6572" event="script" value="other/music.lua"/>

	<!-- Teleport (stairs, ladders) -->
	<action itemid="430;1369;1386;3678;5543" event="script" value="other/teleport.lua"/>

	<!-- Bread Creating -->
	<action itemid="2692;2694" event="script" value="other/createbread.lua"/>

	<!-- Doors -->
		<!-- Doors -->
	<action itemid="1209-1214;1219-1262;1539-1542;3535-3552;4913-4918;5082-5085;5098-5145;5278-5295;5515-5518;5732-5737;5745-5749;6192-6209;6249-6266;6795-6802;6891-6908;7033-7050;7054-7057" event="script" value="other/doors.lua"/>
		<!-- Keys -->
	<action itemid="2086-2092" event="script" value="other/keys.lua"/>
		<!-- Windows -->
	<action itemid="5303-5305;6436-6473;6788-6791;7025-7032" event="script" value="other/windows.lua"/>

	<!-- Watches -->
	<action itemid="1728-1731;1877;1881;2036;6091-6092" event="script" value="other/watch.lua"/>

	<!-- Dolls -->
	<action itemid="5080;5669;5791;6512;6388;6566" event="script" value="other/reaction.lua"/>

	<!-- Other -->
	<action itemid="2566;2096" event="script" value="other/pumpkinhead.lua"/>
	<action itemid="2114" event="script" value="other/piggybank.lua"/>
	<action itemid="2600" event="script" value="tools/inkwell.lua"/>
	<action itemid="2785" event="script" value="other/blueberrybush.lua"/>
	<action itemid="5792-5797" event="script" value="other/dice.lua"/>
	<action itemid="6570-6571" event="script" value="other/surprisebag.lua"/>
	<action itemid="6576" event="script" value="other/fireworksrocket.lua"/>
	<action itemid="6578" event="script" value="other/partyhat.lua"/>
	<action itemid="6561" event="script" value="other/blessings.lua"/>

	<!-- offLineTraining -->
	<action itemid="1444;1448;1449;3705;3739" event="script" value="other/offlinetraining.lua"/>
</actions>

 

e data/lib/101-compact.lua

Quote

--[[
 * File containing deprecated functions and constants used by alot of scripts and other engines
]]--

TRUE = true
FALSE = false
LUA_ERROR = false
LUA_NO_ERROR = true
LUA_NULL = nil

TALKTYPE_SPELL = TALKTYPE_SAY
TALKTYPE_PRIVATE_PN = TALKTYPE_NPC_TO
TALKTYPE_PRIVATE_NP = TALKTYPE_NPC_FROM
TALKTYPE_PRIVATE_FROM = TALKTYPE_PRIVATE
TALKTYPE_PRIVATE_TO = TALKTYPE_PRIVATE
TALKTYPE_CHANNEL_Y = TALKTYPE_CHANNEL
TALKTYPE_CHANNEL_W = TALKTYPE_CHANNEL_MANAGEMENT
TALKTYPE_CHANNEL_RA = TALKTYPE_CHANNEL_MANAGEMENT
TALKTYPE_CHANNEL_R2 = TALKTYPE_CHANNEL_MANAGEMENT
TALKTYPE_BROADCAST = TALKTYPE_GAMEMASTER_BROADCAST
TALKTYPE_CHANNEL_RN = TALKTYPE_GAMEMASTER_CHANNEL
TALKTYPE_PRIVATE_RED = TALKTYPE_GAMEMASTER_PRIVATE
TALKTYPE_GAMEMASTER_PRIVATE_FROM = TALKTYPE_GAMEMASTER_PRIVATE
TALKTYPE_GAMEMASTER_PRIVATE_TO = TALKTYPE_GAMEMASTER_PRIVATE
TALKTYPE_CHANNEL_O = TALKTYPE_CHANNEL_ORANGE
TALKTYPE_CHANNEL_ORANGE = TALKTYPE_CHANNEL_HIGHLIGHT
TALKTYPE_MONSTER = TALKTYPE_MONSTER_SAY
TALKTYPE_ORANGE_1 = TALKTYPE_MONSTER_SAY
TALKTYPE_ORANGE_2 = TALKTYPE_MONSTER_YELL

TEXTCOLOR_BLACK = COLOR_BLACK
TEXTCOLOR_BLUE = COLOR_BLUE
TEXTCOLOR_GREEN = COLOR_GREEN
TEXTCOLOR_LIGHTGREEN = COLOR_LIGHTGREEN
TEXTCOLOR_DARKBROWN = COLOR_DARKBROWN
TEXTCOLOR_LIGHTBLUE = COLOR_LIGHTBLUE
TEXTCOLOR_DARKRED = COLOR_DARKRED
TEXTCOLOR_DARKPURPLE = COLOR_DARKPURPLE
TEXTCOLOR_BROWN = COLOR_BROWN
TEXTCOLOR_GREY = COLOR_GREY
TEXTCOLOR_TEAL = COLOR_TEAL
TEXTCOLOR_DARKPINK = COLOR_DARKPINK
TEXTCOLOR_PURPLE = COLOR_PURPLE
TEXTCOLOR_DARKORANGE = COLOR_DARKORANGE
TEXTCOLOR_RED = COLOR_RED
TEXTCOLOR_PINK = COLOR_PINK
TEXTCOLOR_ORANGE = COLOR_ORANGE
TEXTCOLOR_DARKYELLOW = COLOR_DARKYELLOW
TEXTCOLOR_YELLOW = COLOR_YELLOW
TEXTCOLOR_WHITE = COLOR_WHITE
TEXTCOLOR_NONE = COLOR_NONE

CONDITION_PARAM_STAT_MAXHITPOINTS = CONDITION_PARAM_STAT_MAXHEALTH
CONDITION_PARAM_STAT_MAXMANAPOINTS = CONDITION_PARAM_STAT_MAXMANA
CONDITION_PARAM_STAT_SOULPOINTS = CONDITION_PARAM_STAT_SOUL
CONDITION_PARAM_STAT_MAGICPOINTS = CONDITION_PARAM_STAT_MAGICLEVEL
CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT = CONDITION_PARAM_STAT_MAXHEALTHPERCENT
CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT = CONDITION_PARAM_STAT_MAXMANAPERCENT
CONDITION_PARAM_STAT_SOULPOINTSPERCENT = CONDITION_PARAM_STAT_SOULPERCENT
CONDITION_PARAM_STAT_MAGICPOINTSPERCENT = CONDITION_PARAM_STAT_MAGICLEVELPERCENT

CONDITION_PHYSICAL = CONDITION_BLEEDING

STACKPOS_FIRST_ITEM_ABOVE_GROUNDTILE = 1
STACKPOS_SECOND_ITEM_ABOVE_GROUNDTILE = 2
STACKPOS_THIRD_ITEM_ABOVE_GROUNDTILE = 3
STACKPOS_FOURTH_ITEM_ABOVE_GROUNDTILE = 4
STACKPOS_FIFTH_ITEM_ABOVE_GROUNDTILE = 5

WORLD_TYPE_NO_PVP = WORLDTYPE_OPTIONAL
WORLD_TYPE_PVP = WORLDTYPE_OPEN
WORLD_TYPE_PVP_ENFORCED = WORLDTYPE_HARDCORE

WORLDTYPE_NO_PVP = WORLDTYPE_OPTIONAL
WORLDTYPE_PVP = WORLDTYPE_OPEN
WORLDTYPE_PVP_ENFORCED = WORLDTYPE_HARDCORE

GUILDLEVEL_MEMBER = GUILD_MEMBER
GUILDLEVEL_VICE = GUILD_VICE
GUILDLEVEL_LEADER = GUILD_LEADER

DATABASE_ENGINE_NONE = DATABASE_NONE
DATABASE_ENGINE_MYSQL = DATABASE_MYSQL
DATABASE_ENGINE_SQLITE = DATABASE_SQLITE
DATABASE_ENGINE_POSTGRESQL = DATABASE_POSTGRESQL
DATABASE_ENGINE_ODBC = DATABASE_ODBC

CHANNEL_STAFF = 4
CHANNEL_COUNSELOR = 2
CHANNEL_GAMECHAT = 5
CHANNEL_TRADE = 6
CHANNEL_TRADEROOK = 7
CHANNEL_RLCHAT = 8

BANTYPE_IP_BANISHMENT = 1
BANTYPE_NAMELOCK = 2
BANTYPE_BANISHMENT = 3
BANTYPE_NOTATION = 4
BANTYPE_DELETION = 3

CONST_PROP_MOVEABLE = CONST_PROP_MOVABLE
CONST_PROP_BLOCKINGANDNOTMOVEABLE = CONST_PROP_BLOCKINGANDNOTMOVABLE

CONDITION_EARTH = CONDITION_POISON

STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE = STACKPOS_TOP_MOVABLE_ITEM_OR_CREATURE

RETURNVALUE_NOTMOVEABLE = RETURNVALUE_NOTMOVABLE

SKILLS = SKILL_NAMES

doSetCreatureDropLoot = doCreatureSetDropLoot
doPlayerSay = doCreatureSay
doPlayerAddMana = doCreatureAddMana
playerLearnInstantSpell = doPlayerLearnInstantSpell
doPlayerRemOutfit = doPlayerRemoveOutfit
pay = doPlayerRemoveMoney
broadcastMessage = doBroadcastMessage
getPlayerName = getCreatureName
getCreaturePosition = getThingPosition
getPlayerPosition = getCreaturePosition
getCreaturePos = getCreaturePosition
creatureGetPosition = getCreaturePosition
getPlayerMana = getCreatureMana
getPlayerMaxMana = getCreatureMaxMana
hasCondition = hasCreatureCondition
getCreatureCondition = hasCreatureCondition
isMoveable = isMovable
isItemMoveable = isItemMovable
saveData = saveServer
savePlayers = saveServer
getPlayerSkill = getPlayerSkillLevel
getPlayerSkullType = getCreatureSkullType
getCreatureSkull = getCreatureSkullType
getAccountNumberByName = getAccountIdByName
getIPByName = getIpByName
getPlayersByIP = getPlayersByIp
getThingFromPos = getThingFromPosition
getThingfromPos = getThingFromPos
getHouseFromPos = getHouseFromPosition
getPlayersByAccountNumber = getPlayersByAccountId
getIPByPlayerName = getIpByName
getPlayersByIPNumber = getPlayersByIp
getAccountNumberByPlayerName = getAccountIdByName
convertIntToIP = doConvertIntegerToIp
convertIPToInt = doConvertIpToInteger
queryTileAddThing = doTileQueryAdd
getTileHouseInfo = getHouseFromPos
executeRaid = doExecuteRaid
saveServer = doSaveServer
cleanHouse = doCleanHouse
cleanMap = doCleanMap
shutdown = doShutdown
mayNotMove = doCreatureSetNoMove
getTileItemsByType = getTileItemByType
doPlayerSetNoMove = doCreatureSetNoMove
getPlayerNoMove = getCreatureNoMove
getConfigInfo = getConfigValue
doPlayerAddExp = doPlayerAddExperience
isInArea = isInRange
doPlayerSetSkillRate = doPlayerSetRate
getCreatureLookDir = getCreatureLookDirection
getPlayerLookDir = getCreatureLookDirection
getPlayerLookDirection = getCreatureLookDirection
doCreatureSetLookDir = doCreatureSetLookDirection
getPlayerLookPos = getCreatureLookPosition
setPlayerStamina = doPlayerSetStamina
setPlayerPromotionLevel = doPlayerSetPromotionLevel
setPlayerGroupId = doPlayerSetGroupId
setPlayerPartner = doPlayerSetPartner
doPlayerSetStorageValue = doCreatureSetStorage
setPlayerStorageValue = doPlayerSetStorageValue
getPlayerStorageValue = getCreatureStorage
getGlobalStorageValue = getStorage
setGlobalStorageValue = doSetStorage
getPlayerMount = canPlayerRideMount
setPlayerBalance = doPlayerSetBalance
doAddMapMark = doPlayerAddMapMark
doSendTutorial = doPlayerSendTutorial
getWaypointsList = getWaypointList
getPlayerLastLoginSaved = getPlayerLastLogin
getThingPos = getThingPosition
doAreaCombatHealth = doCombatAreaHealth
doAreaCombatMana = doCombatAreaMana
doAreaCombatCondition = doCombatAreaCondition
doAreaCombatDispel = doCombatAreaDispel
getItemDescriptionsById = getItemInfo
hasProperty = hasItemProperty
hasClient = hasPlayerClient
print = std.cout
getPosByDir = getPositionByDirection
isNumber = isNumeric
doSetItemActionId = doItemSetActionId
getOnlinePlayers = getPlayersOnlineEx
addDialog = doPlayerAddDialog
doSendPlayerExtendedOpcode = doPlayerSendExtendedOpcode

PlayerFlag_CannotUseCombat = 0
PlayerFlag_CannotAttackPlayer = 1
PlayerFlag_CannotAttackMonster = 2
PlayerFlag_CannotBeAttacked = 3
PlayerFlag_CanConvinceAll = 4
PlayerFlag_CanSummonAll = 5
PlayerFlag_CanIllusionAll = 6
PlayerFlag_CanSenseInvisibility = 7
PlayerFlag_IgnoredByMonsters = 8
PlayerFlag_NotGainInFight = 9
PlayerFlag_HasInfiniteMana = 10
PlayerFlag_HasInfiniteSoul = 11
PlayerFlag_HasNoExhaustion = 12
PlayerFlag_CannotUseSpells = 13
PlayerFlag_CannotPickupItem = 14
PlayerFlag_CanAlwaysLogin = 15
PlayerFlag_CanBroadcast = 16
PlayerFlag_CanEditHouses = 17
PlayerFlag_CannotBeBanned = 18
PlayerFlag_CannotBePushed = 19
PlayerFlag_HasInfiniteCapacity = 20
PlayerFlag_CanPushAllCreatures = 21
PlayerFlag_CanTalkRedPrivate = 22
PlayerFlag_CanTalkRedChannel = 23
PlayerFlag_TalkOrangeHelpChannel = 24
PlayerFlag_NotGainExperience = 25
PlayerFlag_NotGainMana = 26
PlayerFlag_NotGainHealth = 27
PlayerFlag_NotGainSkill = 28
PlayerFlag_SetMaxSpeed = 29
PlayerFlag_SpecialVIP = 30
PlayerFlag_NotGenerateLoot = 31
PlayerFlag_CanTalkRedChannelAnonymous = 32
PlayerFlag_IgnoreProtectionZone = 33
PlayerFlag_IgnoreSpellCheck = 34
PlayerFlag_IgnoreWeaponCheck = 35
PlayerFlag_CannotBeMuted = 36
PlayerFlag_IsAlwaysPremium = 37
PlayerFlag_38 = 38 -- ignore
PlayerFlag_39 = 39 -- ignore
PlayerFlag_ShowGroupNameInsteadOfVocation = 40
PlayerFlag_HasInfiniteStamina = 41
PlayerFlag_CannotMoveItems = 42
PlayerFlag_CannotMoveCreatures = 43
PlayerFlag_CanReportBugs = 44
PlayerFlag_45 = 45 -- ignore
PlayerFlag_CannotBeSeen = 46
PlayerFlag_HideHealth = 47
PlayerFlag_CanPassThroughAllCreatures = 48

PlayerCustomFlag_AllowIdle = 0
PlayerCustomFlag_CanSeePosition	= 1
PlayerCustomFlag_CanSeeItemDetails = 2
PlayerCustomFlag_CanSeeCreatureDetails = 3
PlayerCustomFlag_NotSearchable = 4
PlayerCustomFlag_GamemasterPrivileges = 5
PlayerCustomFlag_CanThrowAnywhere = 6
PlayerCustomFlag_CanPushAllItems = 7
PlayerCustomFlag_CanMoveAnywhere = 8
PlayerCustomFlag_CanMoveFromFar = 9
PlayerCustomFlag_CanUseFar = 10
PlayerCustomFlag_CanLoginMultipleCharacters = 11
PlayerCustomFlag_CanLogoutAnytime = 12
PlayerCustomFlag_HideLevel = 13
PlayerCustomFlag_IsProtected = 14
PlayerCustomFlag_IsImmune = 15
PlayerCustomFlag_NotGainSkull = 16
PlayerCustomFlag_NotGainUnjustified = 17
PlayerCustomFlag_IgnorePacification = 18
PlayerCustomFlag_IgnoreLoginDelay = 19
PlayerCustomFlag_CanStairhop = 20
PlayerCustomFlag_CanTurnhop = 21
PlayerCustomFlag_IgnoreHouseRent = 22
PlayerCustomFlag_CanWearAllAddons = 23
PlayerCustomFlag_IsWalkable = 24
PlayerCustomFlag_25 = 25 -- ignore
PlayerCustomFlag_HasFullLight = 26

Creature = {}
Player = {}
Monster = {}
Npc = {}
Game = {}
Condition = {}
Combat = {}

function createClass(class, inheritance)
	setmetatable(class, {
		__index = inheritance and inheritance or nil,
		__call =
		function(self, cid)
		if not cid then
			self = {__index = class}
			setmetatable(self, self)
			return self
		end
		local cid = type(cid) == "number" and cid or type(cid) == "string" and getPlayerByNameWildcard(cid)
		if cid then
			if not self[cid] then
				self[cid] = {__index = class}
				setmetatable(self[cid], self[cid])
				self[cid].cid = cid
				return self[cid]
			else
				return self[cid]
			end
		else
			return nil
		end
	end
	})
end

createClass(Creature)
createClass(Player, Creature)
createClass(Monster, Creature)
createClass(Npc, Creature)
createClass(Game)
createClass(Condition)
createClass(Combat)

-- access metatable functions from creature
function Creature:getPlayer() return Player(self.cid) end
function Creature:getMonster() return Monster(self.cid) end
function Creature:getNpc() return Npc(self.cid) end

-- Creature
-- Creature get functions
function Creature:getId() return self.cid end
function Creature:getName() return getCreatureName(self.cid) end
function Creature:getHealth() return getCreatureHealth(self.cid) end
function Creature:getMaxHealth() return getCreatureMaxHealth(self.cid) end
function Creature:getMana() return getCreatureMana(self.cid) end
function Creature:getMaxMana() return getCreatureMaxMana(self.cid) end
function Creature:getStorageValue(id) return getCreatureStorageValue(self.cid, id) end
function Creature:getHiddenHealth() return getCreatureHideHealth(self.cid) end
function Creature:getSpeakType() return getCreatureSpeakType(self.cid) end
function Creature:getLookDirection() return getCreatureLookDirection(self.cid) end

-- Creature set functions
function Creature:setMaxHealth(health) return setCreatureMaxHealth(self.cid, health) end
function Creature:setMaxMana(mana) return setCreatureMaxMana(self.cid, mana) end
function Creature:setStorageValue(storage, value) return setCreatureStorageValue(self.cid, storage, value) end
function Creature:setHiddenHealth(hide) doCreatureSetHideHealth(self.cid, hide) end
function Creature:setSpeakType(type) doCreatureSetSpeakType(self.cid, type) end

-- Creature misc. functions
function Creature:teleportTo(newpos, pushmove) doTeleportThing(self.cid, newpos, pushmove or false) end
function Creature:addHealth(health, hitEffect, hitColor, force) doCreatureAddHealth(self.cid, health, hitEffect, hitColor, force) end
function Creature:addMana(mana) doCreatureAddMana(self.cid, mana) end
function Creature:say(text, type, ghost, cid, pos) doCreatureSay(self.cid, text, type or SPEAK_SAY, ghost or false, cid or 0, pos) end
function Creature:addCondition(condition) doAddCondition(self.cid, condition) end
function Creature:removeCondition(onlyPersistent, type, subId) if onlyPersistent then doRemoveConditions(self.cid, onlyPersistent) else doRemoveCondition(self.cid, type, subId) end end
function Creature:moveCreature(direction) doMoveCreature(self.cid, direction) end
function Creature:isCreature() return isCreature(self.cid) end
function Creature:isPlayer() return isPlayer(self.cid) end
function Creature:isMonster() return isMonster(self.cid) end
function Creature:isNpc() return isNpc(self.cid) end
function Creature:remove(forceLogout) doRemoveCreature(self.cid, forceLogout or true) end

-- Player
-- Player get functions
function Player:getLevel() return getPlayerLevel(self.cid) end
function Player:getExperience() return getPlayerExperience(self.cid) end
function Player:getMagicLevel(ignoreBuffs) return getPlayerMagLevel(self.cid, ignoreBuffs) end
function Player:getManaSpent() return getPlayerSpentMana(self.cid) end
function Player:getFood() return getPlayerFood(self.cid) end
function Player:getAccess() return getPlayerAccess(self.cid) end
function Player:getGhostAccess() return getPlayerGhostAccess(self.cid) end
function Player:getSkillLevel(skillid) return getPlayerSkillLevel(self.cid, skillid) end
function Player:getSkillTries(skillid) return getPlayerSkillTries(self.cid, skillid) end
function Player:getTown() return getPlayerTown(self.cid) end
function Player:getVocation() return getPlayerVocation(self.cid) end
function Player:getBaseVocation() local vocation = self:getVocation(); return vocation > 4 and vocation - 4 or vocation end
function Player:getIp() return getPlayerIp(self.cid) end
function Player:getRequiredMana(magicLevel) return getPlayerRequiredMana(self.cid, magicLevel) end
function Player:getRequiredSkillTries(skillId, skillLevel) return getPlayerRequiredSkillTries(self.cid, skillId, skillLevel) end
function Player:getItemCount(itemid, subType) return getPlayerItemCount(self.cid, itemid, subType or -1) end
function Player:getMoney() return getPlayerMoney(self.cid) end
function Player:getSoul() return getPlayerSoul(self.cid) end
function Player:getCap() return getPlayerFreeCap(self.cid) end
function Player:getLight() return getPlayerLight(self.cid) end
function Player:getSlotItem(slot) return getPlayerSlotItem(self.cid, slot) end

-- Player set functions
function Player:setMaxCap(cap) doPlayerSetMaxCapacity(self.cid, cap) end
function Player:setTown(townid) doPlayerSetTown(self.cid, townid) end
function Player:setVocation(vocation) doPlayerSetVocation(self.cid, vocation) end


-- Player send functions
function Player:sendCancelMsg(text) doPlayerSendCancel(self.cid, text) end
function Player:sendDefaultCancelMsg(ReturnValue) doPlayerSendDefaultCancel(self.cid, ReturnValue) end
function Player:sendTextMessage(MessageClasses, message) doPlayerSendTextMessage(self.cid, MessageClasses, message) end
function Player:sendChannelMessage(author, message, SpeakClasses, channel) doPlayerSendChannelMessage(self.cid, author, message, SpeakClasses, channel) end
function Player:sendToChannel(targetId, SpeakClasses, message, channel, time) doPlayerSendToChannel(self.cid, targetId, SpeakClasses, message, channel, time) end
function Player:addMoney(money) doPlayerAddMoney(self.cid, money) end
function Player:removeMoney(money) doPlayerRemoveMoney(self.cid, money) end
function Player:transferMoney(target, money) doPlayerTransferMoneyTo(self.cid, target, money) end
function Player:showTextDialog(itemid, text) doShowTextDialog(self.cid, itemid, text) end
function Player:addSkillTries(skillid, n, useMultiplier) doPlayerAddSkillTry(self.cid, skillid, n, useMultiplier or false) end

-- Player misc. functions
function Player:feed(food) doPlayerFeed(self.cid, food) end
function Player:addSpentMana(amount, useMultiplier) doPlayerAddSpentMana(self.cid, amount, useMultiplier) end
function Player:addSoul(soul) doPlayerAddSoul(self.cid, soul) end
function Player:addItem(itemid, count, canDropOnMap, subtype) return doPlayerAddItem(self.cid, itemid, count, canDropOnMap, subtype) end
function Player:addItemEx(uid, canDropOnMap) return doPlayerAddItemEx(self.cid, uid, canDropOnMap or false) end
function Player:addExperience(amount) doPlayerAddExperience(self.cid, amount) end
function Player:savePlayer(shallow) doPlayerSave(self.cid, shallow or false) end
function Player:isPzLocked() return isPlayerPzLocked(self.cid) end

-- Game
function Game.getStorageValue(key) return getGlobalStorageValue(key) end
function Game.setStorageValue(key, value) setGlobalStorageValue(key, value) end
function Game.getChannelUsers(channelId) return getChannelUsers(channelId) end
function Game.setWorldType(type) return setWorldType(type) end
function Game.getWorldType() return getWorldType() end
function Game.getSpectators(centerPos, rangex, rangey, multifloor) return getSpecators(centerPos, rangex, rangey, multifloor or false) end
function Game.getPlayers() return getPlayersOnline() end
function Game.getExperienceStage(level) return getExperienceStage(level) end
function Game.getGameState() return getGameState() end
function Game.setGameState(state) return doSetGameState(state) end
function Game.startRaid(raid) return doExecuteRaid(raid) end
function Game.createItem(itemId, count, position) return doCreateItem(itemId, count, position) end
function Game.createMonster(name, pos, extend, force, displayError) return doCreateMonster(name, pos, extend or false, force or false, displayError or true) end
function Game.createNpc(name, pos, displayError) return doCreateNpc(name, pos, displayError or true) end

-- Condition
--

-- Combat
--

 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.

spellbook.png

Edited by Serpente (see edit history)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Similar Content

    • By victor4312
      Gostaria de alterar a forma de pagamento desse npc, ao invés de pagar com money, queria que o script aceitasse uma moeda com id especifico
      tfs 0.5 exclusive edition
      ( OBS: Se alguém puder também fazer o favor de mover o tópico para tibia classico agradeço, acabei postando errado)
      local nme = getCreatureName(getNpcCid()) local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) NpcSystem.parseParameters(npcHandler,cid) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local msg = string.lower(msg) if msgcontains(msg,"quest") then if getPlayerLevel(cid) >= 800 then selfSay(gm(cid,nme,1),cid) talkState[talkUser] = 20 else if isKnight(cid) then selfSay(gm(cid,nme,2),cid) talkState[talkUser] = 30 else selfSay(gm(cid,nme,3),cid) talkState[talkUser] = 40 end end elseif agreeNPC(msg) and talkState[talkUser] == 20 then if doPlayerRemoveMoney(cid,50000000) then doTeleportThing(cid,{x = 37556, y = 38925, z = 7}) selfSay(gm(cid,nme,5),cid) else selfSay(gm(cid,nme,6).." 50kk",cid) end elseif agreeNPC(msg) and talkState[talkUser] == 30 then if doPlayerRemoveMoney(cid,200000000) then doTeleportThing(cid,{x = 37556, y = 38925, z = 7}) selfSay(gm(cid,nme,5),cid) else selfSay(gm(cid,nme,6).." 200kk",cid) end elseif agreeNPC(msg) and talkState[talkUser] == 40 then if doPlayerRemoveMoney(cid,100000000) then doTeleportThing(cid,{x = 37556, y = 38925, z = 7}) selfSay(gm(cid,nme,5),cid) else selfSay(gm(cid,nme,6).." 100kk",cid) end elseif disagreeNPC(msg) and isInArray({20,30,40},talkState[talkUser]) then selfSay("Ok...",cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())  
    • By deltora mapper
      .Qual servidor ou website você utiliza como base? 
       
      Qual o motivo deste tópico? 
       
      Está surgindo algum erro? Se sim coloque-o aqui. 
       
      Você tem o código disponível? Se tiver publique-o aqui: 
      function onSay(cid, words, param)
      if (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Você precisa está em área protegida para utilizar este comando.")
      return TRUE
      end
      if (getPlayerStorageValue(cid, 11548) >= os.time()) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED,"Por medidas de segurança você só pode utilizar este comando em " .. (getPlayerStorageValue(cid, 11548)-os.time()+(0)) .. " segundos.")
      return TRUE
      end

      if(param ~= "") and (param ~= "sd") and (param ~= "uh")  and (param ~= "explo") and (param ~= "vip10") and (param ~= "vip30") and  (param ~= "skillclub") and (param ~= "skillsword") and (param ~= "skillaxe") and (param ~= "skilldistance") and (param ~= "skillshielding") and (param ~= "magiclevel") and (param ~= "magiclevel5") and (param ~= "skillclub10") and (param ~= "skillsword10") and (param ~= "skillaxe10") and (param ~= "skilldistance10") and (param ~= "skillshielding10") and (param ~= "removerfrag") and (param ~= "novark") then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Para comprar digite !comprar (nome do item)\nOpcoes:\nsd = 4000 em SD por 50 barras.\nuh = 6000 em UH por 40 barras.\nexplo = 6000 em explosion por 10 barras.\nvip10 = 10 dias de vip por 5 barras.\nvip30 = 30 dias de vip por 10 barras.\ndivine staff = divine staff por 30 barras.\ndivine axe = divine axe por 30 barras.\nlivro nivel 6 = livro nivel 6 por 60 barras.\ndivine club = divine club por 30 barras.\ndivine sword = divine sword por 30 barras.\ndivine crossbow = divine crossbow por 30 barras.\nlivro nivel 5 = livro nivel 5 por 30 barras.")
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "\nsuper divine axe = super divine axe por 60 barras.\nsuper divine club = super divine club por 60 barras.\nsuper divine sword = super divine sword por 60 barras.\nsuper divine staff = super divine staff por 60 barras.\nsuper divine crossbow = super divine crossbow por 60 barras.\nskillclub = adiciona 1 skill club por 1 barras.\nskillsword = adiciona 1 skill sword por 1 barras.\nskillaxe = adiciona 1 skill axe por 1 barras.\nskilldistance = adiciona 1 skill distance por 1 barras.")
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "\nskillshielding = adiciona 1 skill shielding por 1 barras.\nmagiclevel = adiciona 1 magic level por 3 barras.\nmagiclevel5 = adiciona 5 magic level por 15 barras.\nskillclub10 = adiciona 10 skills club por 10 barras.\nskillsword10 = adiciona 10 skills sword por 10 barras.\nskillaxe10 = adiciona 10 skills axe por 10 barras.\nskilldistance10 = adiciona 10 skill distance por 10 barras.\nskillshielding10 = adiciona 10 skill shielding por 10 barras.\nremoverfrag = remove todos frags por 100000k.")
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O Item desejado não existe em nosso stock. Veja a cima os detalhes dos items disponíveis.")
      return TRUE
      end
      if(param == "") then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Para comprar digite !comprar (nome do item)\nOpcoes:\nsd = 4000 em SD por 50 barras.\nuh = 6000 em UH por 40 barras.\nexplo = 6000 em explosion por 10 barras.\nvip10 = 10 dias de vip por 5 barras.\nvip30 = 30 dias de vip por 10 barras.\ndivine staff = divine staff por 30 barras.\ndivine axe = divine axe por 30 barras.\ndivine club = divine club por 30 barras.\ndivine sword = divine sword por 30 barras.\ndivine crossbow = divine crossbow por 30 barras.\nlivro nivel 5 = livro nivel 5 por 30 barras.")
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "\nskillclub = adiciona 1 skill club por 1 barras.\nskillsword = adiciona 1 skill sword por 1 barras.\nskillaxe = adiciona 1 skill axe por 1 barras.\nskilldistance = adiciona 1 skill distance por 1 barras.")
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "\nskillshielding = adiciona 1 skill shielding por 1 barras.\nmagiclevel = adiciona 1 magic level por 3 barras.\nmagiclevel5 = adiciona 5 magic level por 15 barras.\nskillclub10 = adiciona 10 skills club por 10 barras.\nskillsword10 = adiciona 10 skills sword por 10 barras.\nskillaxe10 = adiciona 10 skills axe por 10 barras.\nskilldistance10 = adiciona 10 skill distance por 10 barras.\nskillshielding10 = adiciona 10 skill shielding por 10 barras.\nremoverfrag = remove um frag por 100000k.")
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "\nnovark = gera uma nova RK para sua account por 10 barras.\n")
      return TRUE
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "sd") then
      if getPlayerItemCount(cid, 9971) >= 50 then
      local bag = doPlayerAddItem(cid, 5926, 1)
      doAddContainerItem(bag, 2268, 2000)
      local bag = doPlayerAddItem(cid, 5926, 1)
      doAddContainerItem(bag, 2268, 2000)
      doPlayerRemoveItem(cid, 9971, 30)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns você comprou 4k de SD com sucesso.")
      setPlayerStorageValue(cid,11548,os.time()+30)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "uh") then
      if getPlayerItemCount(cid, 9971) >= 30 then
      local bag = doPlayerAddItem(cid, 2002, 1)
      doAddContainerItem(bag, 2273, 2000)
      local bag = doPlayerAddItem(cid, 2002, 1)
      doAddContainerItem(bag, 2273, 2000)
      local bag = doPlayerAddItem(cid, 2002, 1)
      doAddContainerItem(bag, 2273, 2000)
      doPlayerRemoveItem(cid, 9971, 30)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns você comprou 6k de UH com sucesso.")
      setPlayerStorageValue(cid,11548,os.time()+10)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "explo") then
      if getPlayerItemCount(cid, 9971) >= 10 then
      local bag = doPlayerAddItem(cid, 2001, 1)
      doAddContainerItem(bag, 2313, 2000)
      local bag = doPlayerAddItem(cid, 2001, 1)
      doAddContainerItem(bag, 2313, 2000)
      local bag = doPlayerAddItem(cid, 2001, 1)
      doAddContainerItem(bag, 2313, 2000)
      doPlayerRemoveItem(cid, 9971, 10)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns você comprou 6k de Explosion com sucesso.")
      setPlayerStorageValue(cid,11548,os.time()+30)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "vip10") then
      if getPlayerItemCount(cid, 9971) >= 5 then
      doPlayerAddPremiumDays(cid, 10)
      doPlayerRemoveItem(cid, 9971, 5)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns você comprou 10 dias de vip com sucesso.")
      setPlayerStorageValue(cid,11548,os.time()+30)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "vip30") then
      if getPlayerItemCount(cid, 9971) >= 10 then
      doPlayerAddPremiumDays(cid, 30)
      doPlayerRemoveItem(cid, 9971, 10)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns você comprou 30 dias de vip com sucesso.")
      setPlayerStorageValue(cid,11548,os.time()+30)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "super divine axe") then
      if getPlayerItemCount(cid, 9971) >= 60 then
      local bag = doPlayerAddItem(cid, 1997, 1)
      local new_item = doAddContainerItem(bag, 8926, 1)
      doItemSetAttribute(new_item, "description", "Este item pode ser adquirido através do shopping. Adquirido dia " .. os.date("%d/%m/%Y - %X") .." por ".. getPlayerName(cid) ..". Serial: "..  getPlayerGUID(cid) ..".")
      doPlayerRemoveItem(cid, 9971, 60)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você comprou um super divine axe com sucesso.")
      setPlayerStorageValue(cid,11548,os.time()+30)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "super divine staff") then
      if getPlayerItemCount(cid, 9971) >= 60 then
      local bag = doPlayerAddItem(cid, 1997, 1)
      local new_item = doAddContainerItem(bag, 8922, 1)
      doItemSetAttribute(new_item, "description", "Este item pode ser adquirido através do shopping. Adquirido dia " .. os.date("%d/%m/%Y - %X") .." por ".. getPlayerName(cid) ..". Serial: "..  getPlayerGUID(cid) ..".")
      doPlayerRemoveItem(cid, 9971, 60)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você comprou um super divine staff com sucesso.")
      setPlayerStorageValue(cid,11548,os.time()+30)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "super divine club") then
      if getPlayerItemCount(cid, 9971) >= 60 then
      local bag = doPlayerAddItem(cid, 1997, 1)
      local new_item = doAddContainerItem(bag, 7423, 1)
      doItemSetAttribute(new_item, "description", "Este item pode ser adquirido através do shopping. Adquirido dia " .. os.date("%d/%m/%Y - %X") .." por ".. getPlayerName(cid) ..". Serial: "..  getPlayerGUID(cid) ..".")
      doPlayerRemoveItem(cid, 9971, 60)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você comprou um super divine club com sucesso.")
      setPlayerStorageValue(cid,11548,os.time()+30)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "super divine sword") then
      if getPlayerItemCount(cid, 9971) >= 60 then
      local bag = doPlayerAddItem(cid, 1997, 1)
      local new_item = doAddContainerItem(bag, 7403, 1)
      doItemSetAttribute(new_item, "description", "Este item pode ser adquirido através do shopping. Adquirido dia " .. os.date("%d/%m/%Y - %X") .." por ".. getPlayerName(cid) ..". Serial: "..  getPlayerGUID(cid) ..".")
      doPlayerRemoveItem(cid, 9971, 60)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você comprou um super divine sword com sucesso.")
      setPlayerStorageValue(cid,11548,os.time()+30)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "super divine crossbow") then
      if getPlayerItemCount(cid, 9971) >= 60 then
      local bag = doPlayerAddItem(cid, 1997, 1)
      local new_item = doAddContainerItem(bag, 8851, 1)
      doItemSetAttribute(new_item, "description", "Este item pode ser adquirido através do shopping. Adquirido dia " .. os.date("%d/%m/%Y - %X") .." por ".. getPlayerName(cid) ..". Serial: "..  getPlayerGUID(cid) ..".")
      doPlayerRemoveItem(cid, 9971, 60)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você comprou um super divine crossbow com sucesso.")
      setPlayerStorageValue(cid,11548,os.time()+30)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "livro nivel 6") then
      if getPlayerItemCount(cid, 9971) >= 60 then
      local bag = doPlayerAddItem(cid, 1997, 1)
      local new_item = doAddContainerItem(bag, 8921, 1)
      doItemSetAttribute(new_item, "description", "Este item pode ser adquirido através do shopping. Adquirido dia " .. os.date("%d/%m/%Y - %X") .." por ".. getPlayerName(cid) ..". Serial: "..  getPlayerGUID(cid) ..".")
      doPlayerRemoveItem(cid, 9971, 60)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você comprou um livro nivel 6 com sucesso.")
      setPlayerStorageValue(cid,11548,os.time()+30)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "magiclevel") then
      if getPlayerMagLevel(cid) >= 200 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter magic level acima de 200.")
      return TRUE
      end
      if(not isSorcerer(cid) and not isDruid(cid) and not isInfernalist(cid)) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Sorcerers, Druids e Infernalists podem comprar magic level.")
      return TRUE
      end
      if getPlayerItemCount(cid, 9971) >= 3 then
      local pid = getPlayerGUID(cid) 
      doPlayerRemoveItem(cid, 9971, 3)
      setPlayerStorageValue(cid,11548,os.time()+0)
      doRemoveCreature(cid)
      db.query("UPDATE `players` SET `maglevel` = `maglevel` + 1 WHERE `id` = "..pid)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "skillclub") then
      if getPlayerSkillLevel(cid, SKILL_CLUB) >= 350 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
      return TRUE
      end
      if not isDrunou(cid) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Drunous podem comprar skill de club.")
      return TRUE
      end
      if getPlayerItemCount(cid, 9971) >= 1 then
      local pid = getPlayerGUID(cid)
      local club = getPlayerSkillLevel(cid, SKILL_CLUB) 
      doPlayerRemoveItem(cid, 9971, 1)
      setPlayerStorageValue(cid,11548,os.time()+0)
      doRemoveCreature(cid)
      db.query("UPDATE `player_skills` SET `value` = " .. (club + 1) .. ", `count` = 0 WHERE `skillid` = 1 and `player_id` = " .. pid .. ";")
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "skillsword") then
      if getPlayerSkillLevel(cid, SKILL_SWORD) >= 350 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
      return TRUE
      end
      if not isKnight(cid) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Knights podem comprar skill de sword.")
      return TRUE
      end
      if getPlayerItemCount(cid, 9971) >= 1 then
      local pid = getPlayerGUID(cid)
      local sword = getPlayerSkillLevel(cid, SKILL_SWORD) 
      doPlayerRemoveItem(cid, 9971, 1)
      setPlayerStorageValue(cid,11548,os.time()+0)
      doRemoveCreature(cid)
      db.query("UPDATE `player_skills` SET `value` = " .. (sword + 1) .. ", `count` = 0 WHERE `skillid` = 2 and `player_id` = " .. pid .. ";")
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "skillaxe") then
      if getPlayerSkillLevel(cid, SKILL_AXE) >= 350 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
      return TRUE
      end
      if not isKnight(cid) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Knights podem comprar skill de axe.")
      return TRUE
      end
      if getPlayerItemCount(cid, 9971) >= 1 then
      local pid = getPlayerGUID(cid)
      local axe = getPlayerSkillLevel(cid, SKILL_AXE) 
      doPlayerRemoveItem(cid, 9971, 1)
      setPlayerStorageValue(cid,11548,os.time()+0)
      doRemoveCreature(cid)
      db.query("UPDATE `player_skills` SET `value` = " .. (axe + 1) .. ", `count` = 0 WHERE `skillid` = 3 and `player_id` = " .. pid .. ";")
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "skilldistance") then
      if getPlayerSkillLevel(cid, SKILL_DISTANCE) >= 350 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
      return TRUE
      end
      if not isPaladin(cid) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Paladins podem comprar skill de distance.")
      return TRUE
      end
      if getPlayerItemCount(cid, 9971) >= 1 then
      local pid = getPlayerGUID(cid)
      local distance = getPlayerSkillLevel(cid, SKILL_DISTANCE) 
      doPlayerRemoveItem(cid, 9971, 1)
      setPlayerStorageValue(cid,11548,os.time()+0)
      doRemoveCreature(cid)
      db.query("UPDATE `player_skills` SET `value` = " .. (distance + 1) .. ", `count` = 0 WHERE `skillid` = 4 and `player_id` = " .. pid .. ";")
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "skillshielding") then
      if getPlayerSkillLevel(cid, SKILL_SHIELD) >= 350 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
      return TRUE
      end
      if(not isPaladin(cid) and not isKnight(cid) and not isDrunou(cid)) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Paladins, Knights e Drunous podem comprar skill de shield.")
      return TRUE
      end
      if getPlayerItemCount(cid, 9971) >= 1 then
      local pid = getPlayerGUID(cid)
      local shield = getPlayerSkillLevel(cid, SKILL_SHIELD) 
      doPlayerRemoveItem(cid, 9971, 1)
      setPlayerStorageValue(cid,11548,os.time()+0)
      doRemoveCreature(cid)
      db.query("UPDATE `player_skills` SET `value` = " .. (shield + 1) .. ", `count` = 0 WHERE `skillid` = 5 and `player_id` = " .. pid .. ";")
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "magiclevel5") then
      if getPlayerMagLevel(cid) >= 196 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter magic level acima de 200.")
      return TRUE
      end
      if(not isSorcerer(cid) and not isDruid(cid) and not isInfernalist(cid)) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Sorcerers, Druids e Infernalists podem comprar magic level.")
      return TRUE
      end
      if getPlayerItemCount(cid, 9971) >= 15 then
      local pid = getPlayerGUID(cid) 
      doPlayerRemoveItem(cid, 9971, 15)
      setPlayerStorageValue(cid,11548,os.time()+0)
      doRemoveCreature(cid)
      db.query("UPDATE `players` SET `maglevel` = `maglevel` + 5 WHERE `id` = "..pid)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "skillclub10") then
      if getPlayerSkillLevel(cid, SKILL_CLUB) >= 341 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
      return TRUE
      end
      if not isDrunou(cid) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Drunous podem comprar skill de club.")
      return TRUE
      end
      if getPlayerItemCount(cid, 9971) >= 10 then
      local pid = getPlayerGUID(cid)
      local club = getPlayerSkillLevel(cid, SKILL_CLUB) 
      doPlayerRemoveItem(cid, 9971, 10)
      setPlayerStorageValue(cid,11548,os.time()+0)
      doRemoveCreature(cid)
      db.query("UPDATE `player_skills` SET `value` = " .. (club + 10) .. ", `count` = 0 WHERE `skillid` = 1 and `player_id` = " .. pid .. ";")
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "skillsword10") then
      if getPlayerSkillLevel(cid, SKILL_SWORD) >= 341 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
      return TRUE
      end
      if not isKnight(cid) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Knights podem comprar skill de sword.")
      return TRUE
      end
      if getPlayerItemCount(cid, 9971) >= 10 then
      local pid = getPlayerGUID(cid)
      local sword = getPlayerSkillLevel(cid, SKILL_SWORD) 
      doPlayerRemoveItem(cid, 9971, 10)
      setPlayerStorageValue(cid,11548,os.time()+0)
      doRemoveCreature(cid)
      db.query("UPDATE `player_skills` SET `value` = " .. (sword + 10) .. ", `count` = 0 WHERE `skillid` = 2 and `player_id` = " .. pid .. ";")
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "skillaxe10") then
      if getPlayerSkillLevel(cid, SKILL_AXE) >= 341 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
      return TRUE
      end
      if not isKnight(cid) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Knights podem comprar skill de axe.")
      return TRUE
      end
      if getPlayerItemCount(cid, 9971) >= 10 then
      local pid = getPlayerGUID(cid)
      local axe = getPlayerSkillLevel(cid, SKILL_AXE) 
      doPlayerRemoveItem(cid, 9971, 10)
      setPlayerStorageValue(cid,11548,os.time()+0)
      doRemoveCreature(cid)
      db.query("UPDATE `player_skills` SET `value` = " .. (axe + 10) .. ", `count` = 0 WHERE `skillid` = 3 and `player_id` = " .. pid .. ";")
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "skilldistance10") then
      if getPlayerSkillLevel(cid, SKILL_DISTANCE) >= 341 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
      return TRUE
      end
      if not isPaladin(cid) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Paladins podem comprar skill de distance.")
      return TRUE
      end
      if getPlayerItemCount(cid, 9971) >= 10 then
      local pid = getPlayerGUID(cid)
      local distance = getPlayerSkillLevel(cid, SKILL_DISTANCE) 
      doPlayerRemoveItem(cid, 9971, 10)
      setPlayerStorageValue(cid,11548,os.time()+0)
      doRemoveCreature(cid)
      db.query("UPDATE `player_skills` SET `value` = " .. (distance + 10) .. ", `count` = 0 WHERE `skillid` = 4 and `player_id` = " .. pid .. ";")
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "skillshielding10") then
      if getPlayerSkillLevel(cid, SKILL_SHIELD) >= 341 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
      return TRUE
      end
      if(not isPaladin(cid) and not isKnight(cid) and not isDrunou(cid)) then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Paladins, Knights e Drunous podem comprar skill de shield.")
      return TRUE
      end
      if getPlayerItemCount(cid, 9971) >= 10 then
      local pid = getPlayerGUID(cid)
      local shield = getPlayerSkillLevel(cid, SKILL_SHIELD) 
      doPlayerRemoveItem(cid, 9971, 10)
      setPlayerStorageValue(cid,11548,os.time()+0)
      doRemoveCreature(cid)
      db.query("UPDATE `player_skills` SET `value` = " .. (shield + 10) .. ", `count` = 0 WHERE `skillid` = 5 and `player_id` = " .. pid .. ";")
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "removerfrag") then
      if getPlayerItemCount(cid, 2160) >= 10 then
      doPlayerRemoveItem(cid, 2160, 100000)
      db.query("UPDATE `killers` SET `unjustified` = 0 WHERE `unjustified` = 1 AND `id` IN (SELECT `kill_id` FROM `player_killers` WHERE `player_id` = " .. getPlayerGUID(cid) .. ") LIMIT 1;")
      setPlayerStorageValue(cid,11548,os.time()+30)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Parabéns você removeu seus frags com sucesso.")
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      return TRUE
      end
      end
      -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      if(param == "novark") then
      if getPlayerItemCount(cid, 9971) >= 10 then
      setPlayerRecoveryKey(cid)
      doPlayerRemoveItem(cid, 9971, 10)
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "ATENÇÃO! Esta será a única vez que sua RK será mostrada, portanto, anote-a em um lugar seguro fora de seu computador!\n" .. setPlayerRecoveryKey(cid) .. "")
      setPlayerStorageValue(cid,11548,os.time()+30)
      return TRUE
      else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
      end
      end
      return TRUE
      end
       
      Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 
       
    • By FearWar
      Olá Tks,
      Estou com um problema, adicionei uma nova moeda no meu servidor (source), porém o change gold não está funcionando.
       

       
      local config = { [ITEM_GOLD_COIN] = {changeTo = ITEM_PLATINUM_COIN}, [ITEM_PLATINUM_COIN] = {changeBack = ITEM_GOLD_COIN, changeTo = ITEM_CRYSTAL_COIN}, [ITEM_CRYSTAL_COIN] = {changeBack = ITEM_PLATINUM_COIN, changeTo = ITEM_GOLDEN_BAR}, [ITEM_GOLDEN_BAR] = {changeBack = ITEM_CRYSTAL_COIN} } function onUse(player, item, fromPosition, target, toPosition, isHotkey) local coin = config[item:getId()] if coin.changeTo and item.type == 100 then item:remove() player:addItem(coin.changeTo, 1) elseif coin.changeBack then item:remove(1) player:addItem(coin.changeBack, 100) else return false end return true end  
    • By Biel Oliveira
      .tenho um servidor que estou com sistema de reset sem storage, e estou tentando criar magias de acordo com o reset do player, consegui criar a magia mas quando o player com "1" resets solta a magia não sai nada
       
      alguem poderia me ajudar por favor ?
       
      Esta é a magia me ajudem plizzz
         
       
       
    • By victor4312
      TFS EXCLUSIVE EDTION 0.5
      tentei varios scripts do forum e nenhum funciona, o problema é que também não aparece erros na distro,
      se alguem puder me ajudar a fazer esse script funcionar agradeço
       
       
       
  • Recently Browsing   0 members

    No registered users viewing this page.


Open Tibia Server

Quer aprender a criar seu próprio servidor de Tibia? Então está no lugar certo, aqui você encontrará milhares de tutorias, scripts, códigos, mapas e utilitários para que você possa fazer o seu próprio servidor de Tibia começando do zero.

Redes Sociais

Anuncie no Tibia King

Precisa de mais visibilidade em seus projetos? Quer fazer um plano publicitário para o seu servidor? Anuncie no Tibia King e faça sua divulgação, possuímos centenas de acessos simultâneos e milhares diários, com certeza será a sua solução!

×
×
  • Create New...