Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Olá pessoal, vou posta meu npc Bank para vocês!
O desgraçado funciona quando quer e bem entende, as vez pega o dinheiro e depois não pega mais, dai da um tempo volta funcionar!!

Bizarrrrroooo Não sei por que faz isso mas vamos lá!

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local config = {
transferDisabledVocations = {0} -- disable non vocation characters
}

local talkState, count, transfer = {}, {}, {}

function onCreatureAppear(cid)              npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)           npcHandler:onCreatureDisappear(cid)         end
function onCreatureSay(cid, type, msg)      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


--///////////////////////////START SCRIPT(bank)///////////////////////////--
if(not getPlayerBalance) then
	getPlayerBalance = function(cid)
	local result = db.getResult("SELECT `balance` FROM `players` WHERE `id` = " .. getPlayerGUID(cid))
	if(result:getID() == -1) then
	return false
	end

	local value = tonumber(result:getDataString("balance"))
	result:free()
	return value
	end

	doPlayerSetBalance = function(cid, balance)
	db.executeQuery("UPDATE `players` SET `balance` = " .. balance .. " WHERE `id` = " .. getPlayerGUID(cid))
	return true
	end

	doPlayerWithdrawMoney = function(cid, amount)
	local balance = getPlayerBalance(cid)
	if(amount > balance or not doPlayerAddMoney(cid, amount)) then
	return false
	end

	doPlayerSetBalance(cid, balance - amount)
	return true
	end

	doPlayerDepositMoney = function(cid, amount)
	if(not doPlayerRemoveMoney(cid, amount)) then
		return false
	end

	doPlayerSetBalance(cid, getPlayerBalance(cid) + amount)
	return true
	end

	doPlayerTransferMoneyTo = function(cid, target, amount)
	local balance = getPlayerBalance(cid)
	if(amount > balance) then
		return false
	end

	local tid = getPlayerByName(target)
	if(tid > 0) then
		doPlayerSetBalance(tid, getPlayerBalance(tid) + amount)
	else
	if(playerExists(target) == FALSE) then
		return false
	end

	db.executeQuery("UPDATE `player_storage` SET `value` = `value` + '" .. amount .. "' WHERE `player_id` = (SELECT `id` FROM `players` WHERE `name` = '" .. escapeString(player) .. "') AND `key` = '" .. balance_storage .. "'")
	end

	doPlayerSetBalance(cid, getPlayerBalance(cid) - amount)
	return true
	end
end

local function getPlayerVocationByName(name)
	local result = db.getResult("SELECT `vocation` FROM `players` WHERE `name` = " .. db.escapeString(name))
	if(result:getID() == -1) then
	return false
	end

	local value = result:getDataString("vocation")
	result:free()
	return value
end

local function isValidMoney(money)
	return (isNumber(money) and money > 0 and money < 4294967295)
end

local function getCount(string)
	local b, e = string:find("%d+")
	local money = b and e and tonumber(string:sub(b, e)) or -1
	if(isValidMoney(money)) then
	return money
	end
	return -1
end

function greetCallback(cid)
	talkState[cid], count[cid], transfer[cid] = 0, nil, nil
	return true
end

function creatureSayCallback(cid, type, msg)

if(not npcHandler:isFocused(cid)) then
return false
end

---------------------------- help ------------------------
	if msgcontains(msg, 'advanced') then
	if isInArray(config.transferDisabledVocations, getPlayerVocation(cid)) then
		selfSay("Once you are on the Tibian mainland, you can access new functions of your bank account, such as transferring money to other players safely or taking part in house auctions.", cid)
	else
		selfSay("Renting a house has never been this easy. Simply make a bid for an auction. We will check immediately if you have enough money.", cid)
	end
	talkState[cid] = 0
	
	elseif msgcontains(msg, 'help') or msgcontains(msg, 'functions') then
		selfSay("You can check the {balance} of your bank account, {deposit} money or {withdraw} it. You can also {transfer} money to other characters, provided that they have a vocation.", cid)
		talkState[cid] = 0
		
	elseif msgcontains(msg, 'bank') then
		npcHandler:say("We can change money for you. You can also access your bank account.", cid)
		talkState[cid] = 0

	elseif msgcontains(msg, 'job') then
		npcHandler:say("I work in this bank. I can change money for you and help you with your bank account.", cid)
		talkState[cid] = 0
		
---------------------------- balance ---------------------
	elseif msgcontains(msg, 'balance') then
		if getPlayerBalance(cid) >= 1000000000 then
			npcHandler:say('SURREAL! You must be very important, one of the billionaire players of this world! Your account balance is incredible ' .. doNumberFormat(getPlayerBalance(cid)) .. ' gold.', cid)
			talkState[cid] = 0
		elseif getPlayerBalance(cid) >= 100000000 then
			npcHandler:say('I think you must be one of the richest inhabitants in the world! Your account balance is ' .. doNumberFormat(getPlayerBalance(cid)) .. ' gold.', cid)
			talkState[cid] = 0
		elseif getPlayerBalance(cid) >= 10000000 then
			npcHandler:say('You have made ten millions and it still grows! Your account balance is ' .. doNumberFormat(getPlayerBalance(cid)) .. ' gold.', cid)
			talkState[cid] = 0
		elseif getPlayerBalance(cid) >= 1000000 then
			npcHandler:say('Wow, you have reached the magic number of a million gp!!! Your account balance is ' .. doNumberFormat(getPlayerBalance(cid)) .. ' gold!', cid)
			talkState[cid] = 0
		elseif getPlayerBalance(cid) >= 100000 then
			npcHandler:say('You certainly have made a pretty penny. Your account balance is ' .. doNumberFormat(getPlayerBalance(cid)) .. ' gold.', cid)
			talkState[cid] = 0
		else
			selfSay("Your account balance is " .. doNumberFormat(getPlayerBalance(cid)) .. " gold.", cid)
			talkState[cid] = 0
		end
	
---------------------------- deposit ---------------------
	elseif msgcontains(msg, 'deposit all') and getPlayerMoney(cid) > 0 then
		count[cid] = getPlayerMoney(cid) - getPlayerBalance(cid)
	if not isValidMoney(count[cid]) then
		selfSay("Sorry, but you can't deposit that much.", cid)
		talkState[cid] = 0
		return false
	end

	if count[cid] < 1 then
		selfSay("You don't have any money to deposit in you inventory..", cid)
		talkState[cid] = 0
	else
		selfSay("Would you really like to deposit " .. count[cid] .. " gold?", cid)
		talkState[cid] = 2
	end
	
	elseif msgcontains(msg, 'deposit') then
		if getCount(msg) == 0 then
			selfSay("You are joking, aren't you??", cid)
			talkState[cid] = 0
			
		elseif getCount(msg) ~= -1 then
			if getPlayerMoney(cid) - getPlayerBalance(cid) >= getCount(msg) then
				count[cid] = getCount(msg)
				
				if isValidMoney(count[cid]) then
					selfSay("Would you really like to deposit " .. count[cid] .. " gold?", cid)
					talkState[cid] = 2
				end
			else
				selfSay("You do not have enough gold.", cid)
				talkState[cid] = 0
			end
		else
			selfSay("Please tell me how much gold it is you would like to deposit.", cid)
			talkState[cid] = 1
		end
			
		elseif talkState[cid] == 1 then
			if getCount(msg) == -1 then
				selfSay("Please tell me how much gold it is you would like to deposit.", cid)
				talkState[cid] = 1
			else				
			if getPlayerMoney(cid) >= getCount(msg) then
				count[cid] = getCount(msg)
				
				if isValidMoney(count[cid]) then
					selfSay("Would you really like to deposit " .. count[cid] .. " gold?", cid)
					talkState[cid] = 2
				end
			else
				selfSay("You do not have enough gold.", cid)
				talkState[cid] = 0
			end
			end
		
	elseif talkState[cid] == 2 then
		if msgcontains(msg, 'yes') then
		if not doPlayerDepositMoney(cid, count[cid]) then
			selfSay("You don\'t have enough gold.", cid)
		else
			selfSay("Alright, we have added the amount of " .. count[cid] .. " gold to your balance. You can withdraw your money anytime you want to. Your account balance is " .. getPlayerBalance(cid) .. ".", cid)
		end
		elseif msgcontains(msg, 'no') then
			selfSay("As you wish. Is there something else I can do for you?", cid)
		end
			talkState[cid] = 0
			
---------------------------- withdraw --------------------
	elseif msgcontains(msg, 'withdraw') then
		if getCount(msg) == 0 then
			selfSay("Sure, you want nothing you get nothing!'", cid)
			talkState[cid] = 0
			
		elseif getCount(msg) ~= -1 then
			if getPlayerBalance(cid) >= getCount(msg) then
				count[cid] = getCount(msg)
				
				if isValidMoney(count[cid]) then
					selfSay("Are you sure you wish to withdraw " .. count[cid] .. " gold from your bank account?", cid)
					talkState[cid] = 7
				else
					selfSay("There is not enough gold on your account.", cid)
					talkState[cid] = 0
				end
			else
				selfSay("There is not enough gold on your account.", cid)
				talkState[cid] = 0
			end
		else
			selfSay("Please tell me how much gold you would like to withdraw.", cid)
			talkState[cid] = 6
		end
			
		elseif talkState[cid] == 6 then
			if getCount(msg) == -1 then
				selfSay("Please tell me how much gold you would like to withdraw.", cid)
				talkState[cid] = 6
			else				
			if getPlayerBalance(cid) >= getCount(msg) then
				count[cid] = getCount(msg)
				
				if isValidMoney(count[cid]) then
					selfSay("Are you sure you wish to withdraw " .. count[cid] .. " gold from your bank account?", cid)
					talkState[cid] = 7
				end
			else
				selfSay("There is not enough gold on your account.", cid)
				talkState[cid] = 0
			end
			end
	
	elseif talkState[cid] == 7 then
	if msgcontains(msg, 'yes') then
	if not doPlayerWithdrawMoney(cid, count[cid]) then
		selfSay("There is not enough gold on your account. Your account balance is " .. getPlayerBalance(cid) .. ". Please tell me the amount of gold coins you would like to withdraw.", cid)
		talkState[cid] = 0
	else
		selfSay("Here you are, " .. count[cid] .. " gold. Please let me know if there is something else I can do for you.", cid)
		talkState[cid] = 0
	end
	
	elseif msgcontains(msg, 'no') then
		selfSay("As you wish. Is there something else I can do for you?", cid)
		talkState[cid] = 0
	end
	
---------------------------- transfer --------------------
	elseif msgcontains(msg, 'transfer') then
		selfSay("Please tell me the amount of gold you would like to transfer.", cid)
		talkState[cid] = 11
		
	elseif talkState[cid] == 11 then
		count[cid] = getCount(msg)
		
		if getPlayerBalance(cid) < count[cid] then
			selfSay("You dont have enough money on your bank account.", cid)
			talkState[cid] = 0
			return true
		end

		if isValidMoney(count[cid]) then
			selfSay("Who would you like transfer " .. count[cid] .. " gold to?", cid)
			talkState[cid] = 12
		else
			selfSay("Is isnt valid amount of gold to transfer.", cid)
			talkState[cid] = 0
		end
		
	elseif talkState[cid] == 12 then
		transfer[cid] = msg

		if getCreatureName(cid) == transfer[cid] then
			selfSay("Ekhm, You want transfer money to yourself? Its impossible!", cid)
			talkState[cid] = 0
			return true
		end

		if isInArray(config.transferDisabledVocations, getPlayerVocation(cid)) then
			selfSay("Your vocation cannot transfer money.", cid)
			talkState[cid] = 0
		end

		if playerExists(transfer[cid]) then
			selfSay("So you would like to transfer " .. count[cid] .. " gold to \"" .. transfer[cid] .. "\" ?", cid)
			talkState[cid] = 13
		else
			selfSay("Player with name \"" .. transfer[cid] .. "\" doesnt exist.", cid)
			talkState[cid] = 0
		end
		
	elseif talkState[cid] == 13 then
		if msgcontains(msg, 'yes') then
		local targetVocation = getPlayerVocationByName(transfer[cid])
		if not targetVocation or isInArray(config.transferDisabledVocations, targetVocation) or not doPlayerTransferMoneyTo(cid, transfer[cid], count[cid]) then
			selfSay("This player does not exist on this world or have no vocation.", cid)
		else
			selfSay("You have transferred " .. count[cid] .. " gold to \"" .. transfer[cid] .."\".", cid)
			transfer[cid] = nil
		end
		
		elseif msgcontains(msg, 'no') then
			selfSay("As you wish. Is there something else I can do for you?", cid)
		end
			talkState[cid] = 0
	end
	return true
end
--///////////////////////////END SCRIPT(bank)///////////////////////////--

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Link para o post
Compartilhar em outros sites

Usa esse mod

cria um arquivo bank.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<mod name="Custom Bank" version="1.0" author="slawkens - edited by: mattyx14" contact="[email protected]" enabled="yes">


	<!-- Bank Command -->
	<config name="command-bank-config"><![CDATA[
		transferDisabledVocations = {0} -- disable non vocation characters
	]]></config>

	<talkaction words="!bank;/bank" event="script"><![CDATA[
		domodlib('command-bank-config')
		local config = {
			transferDisabledVocations = transferDisabledVocations
		}

		local function validAmount(amount)
			return (isNumber(amount) and amount > 0 and amount < 4294967296)
		end
		local function getAmount(amount, cid, f)
			return (amount == 'all' and f(cid) or tonumber(amount))
		end
		local function getPlayerVocationByName(name)
			local result = db.getResult("SELECT `vocation` FROM `players` WHERE `name` = " .. db.escapeString(name))
			if(result:getID() == -1) then
				return false
			end

			local value = result:getDataString("vocation")
			result:free()
			return value
		end

		function onSay(cid, words, param, channel)
			if(param == '') then
				doPlayerPopupFYI(cid,
					"Bank management manual.\n\n" ..
					"!bank or /bank balance - show your account balance\n" ..
					"!bank or /bank deposit 100 - deposit 100 gold\n" ..
					"!bank or /bank withdraw 50 - withdraw 50 gold\n" ..
					"!bank or /bank transfer 30 God - transfer 30 gold to player God\n\n" ..
					"Tip: you can also use 'all' as amount.\n" ..
					"!bank or /bank deposit all - deposit all gold you have\n" ..
					"!bank or /bank withdraw all - withdraw all gold from your bank account"
				)
				return true
			end

			local t = string.explode(param, " ", 2)
			local command = t[1]:lower()
			if(command == 'balance') then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your account balance is " .. getPlayerBalance(cid) .. " gold.")
			elseif(command == 'deposit') then
				if(not t[2]) then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Amount is required.")
					return true
				end

				local amount = getAmount(t[2], cid, getPlayerMoney)
				if(validAmount(amount) and getPlayerMoney(cid) >= amount and doPlayerDepositMoney(cid, amount)) then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, amount .. " gold has been deposited.")
				else
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough money to deposit.")
				end
			elseif(command == 'withdraw') then
				if(not t[2]) then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Amount is required.")
					return true
				end

				local amount = getAmount(t[2], cid, getPlayerBalance)
				if(validAmount(amount) and getPlayerBalance(cid) >= amount and doPlayerWithdrawMoney(cid, amount)) then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, amount .. " gold has been withdrawn.")
				else
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough money to withdraw.")
				end
			elseif(command == 'transfer') then
				if(not t[2]) then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Amount is required.")
					return true
				end

				if(not t[3]) then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player name to transfer is required.")
					return true
				end

				local amount, target = tonumber(t[2]), t[3]
				if(getPlayerGUID(cid) == getPlayerGUIDByName(target)) then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot transfer money to yourself.")
				elseif(isInArray(config.transferDisabledVocations, getPlayerVocation(cid))) then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vocation cannot transfer money.")
				elseif(not validAmount(amount) or getPlayerBalance(cid) < amount) then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough money to transfer.")
				else
					local targetVocation = getPlayerVocationByName(target)
					if(not playerExists(target) or not targetVocation or isInArray(config.transferDisabledVocations, targetVocation) or not doPlayerTransferMoneyTo(cid, target, amount)) then
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "This player does not exist on this world or have no vocation.")
					else
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have transferred " .. amount .. " gold to \"" .. target .."\".")
					end
				end
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid command usage. Use '!bank' to view manual.")
			end

			return true
		end
	]]></talkaction>


</mod>

 

Link para o post
Compartilhar em outros sites
  • 2 weeks later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por cloudrun2023
      CloudRun - Sua Melhor Escolha para Hospedagem de OTServer!
      Você está procurando a solução definitiva para hospedar seu OTServer com desempenho imbatível e segurança inigualável? Não procure mais! Apresentamos a CloudRun, sua parceira confiável em serviços de hospedagem na nuvem.
       
      Recursos Exclusivos - Proteção DDoS Avançada:
      Mantenha seu OTServer online e seguro com nossa robusta proteção DDoS, garantindo uma experiência de jogo ininterrupta para seus jogadores.
       
      Servidores Ryzen 7 Poderosos: Desfrute do poder de processamento superior dos servidores Ryzen 7 para garantir um desempenho excepcional do seu OTServer. Velocidade e estabilidade garantidas!
       
      Armazenamento NVMe de Alta Velocidade:
      Reduza o tempo de carregamento do jogo com nosso armazenamento NVMe ultrarrápido. Seus jogadores vão adorar a rapidez com que podem explorar o mundo do seu OTServer.
       
      Uplink de até 1GB:
      Oferecemos uma conexão de alta velocidade com até 1GB de largura de banda, garantindo uma experiência de jogo suave e livre de lag para todos os seus jogadores, mesmo nos momentos de pico.
       
      Suporte 24 Horas:
      Estamos sempre aqui para você! Nossa equipe de suporte está disponível 24 horas por dia, 7 dias por semana, para resolver qualquer problema ou responder a qualquer pergunta que você possa ter. Sua satisfação é a nossa prioridade.
       
      Fácil e Rápido de Começar:
      Configurar seu OTServer na CloudRun é simples e rápido. Concentre-se no desenvolvimento do seu jogo enquanto cuidamos da hospedagem.
       
      Entre em Contato Agora!
      Website: https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
      Email: [email protected]
      Telefone: (47) 99902-5147

      Não comprometa a qualidade da hospedagem do seu OTServer. Escolha a CloudRun e ofereça aos seus jogadores a melhor experiência de jogo possível. Visite nosso site hoje mesmo para conhecer nossos planos e começar!
       
      https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
       
      CloudRun - Onde a Velocidade Encontra a Confiabilidade!
       

    • Por FeeTads
      SALVE rapaziada do TK, esses dias vim pensando em novos scripts pro meu OT, e em um deles eu precisava que determinada area não contasse frag pro player que matasse outros, PORÉM eu precisava que os players que morressem nessa area ainda assim tivessem as penalidades da sua morte, procurei por ai, achei alguns scripts que apenas tiravam o SKULL e não realmente o FRAG do player.

      **script atualizado 22/10/2023** - melhorado e otimizado, levei o script pra puxar as infos por .lua / creatureScripts

      vou disponibilizar o code aqui, e o que fazer pra determinada area não contar frag.

      SOURCE OTX 2 / TFS 0.x, Funciona em TFS 1.x mudando as tags e ajeitando as sintaxes.

      vá em creatureevent.cpp

      procure por:
      else if(type == "preparedeath") _type = CREATURE_EVENT_PREPAREDEATH;
      Adiciona abaixo:
      else if(type == "nocountfrag") _type = CREATURE_EVENT_NOCOUNTFRAG;

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath";  
      Adicione abaixo: 
      case CREATURE_EVENT_NOCOUNTFRAG: return "noCountFragArea";

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "cid, deathList";
      Adicione abaixo:
      case CREATURE_EVENT_NOCOUNTFRAG: return "cid, target";

      agora no mesmo arquivo, vá até o final do arquivo e adicione essa função:
      uint32_t CreatureEvent::executeNoCountFragArea(Creature* creature, Creature* target) { //noCountFragArea(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::ostringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; if(m_scriptData) scriptstream << *m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::ostringstream desc; desc << creature->getName(); env->setEvent(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::noCountFragArea] Call stack overflow." << std::endl; return 0; } }

      agora vá em creatureevent.h

      procure por:
      CREATURE_EVENT_PREPAREDEATH
      adicione abaixo:
      CREATURE_EVENT_NOCOUNTFRAG

      procure por:
      uint32_t executePrepareDeath(Creature* creature, DeathList deathList);
      Adicione abaixo:
      uint32_t executeNoCountFragArea(Creature* creature, Creature* target);

      agora vá em player.cpp

      procure por:
      bool Player::onKilledCreature(Creature* target, DeathEntry& entry)
      abaixo de:
      War_t enemy; if(targetPlayer->getEnemy(this, enemy)) { if(entry.isLast()) IOGuild::getInstance()->updateWar(enemy); entry.setWar(enemy); }
      Adicione o seguinte código:
      if (targetPlayer){ CreatureEventList killEvents = getCreatureEvents(CREATURE_EVENT_NOCOUNTFRAG); for (const auto &event : killEvents) { if (!event->executeNoCountFragArea(this, target)) { return true; } } }

      //

      Feito isso, tudo completo na sua source, agora é necessário adicionar o creaturescript dentro do servidor

      vá até creaturescripts/scripts
      crie um arquivo chamado, "noCountFragInArea.lua"
      e dentro dele cole o código:
       
      --[[ script feito por feetads / TibiaKing ]]-- --[[ discord: feetads / FeeTads#0246 ]]-- -- Add positions here for which you do not want to count frags local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, -- from = area superior esquerda / to = area inferior direita (formando um quadrado) } local onlyKillerInArea = false -- only killer need to be in area? function noCountFragArea(cid, target) if not isCreature(cid) or not isCreature(target) then return true end local posKiller = getPlayerPosition(cid) local posTarget = getPlayerPosition(target) for i = 1, #areas do local area = areas[i] if isInArea(posKiller, area.from, area.to) then if onlyKillerInArea then return false elseif isInArea(posTarget, area.from, area.to) then return false end end end return true end
      agora em creaturescripts.xml
      <event type="nocountfrag" name="fragarea" event="script" value="noCountFragInArea.lua"/>
      agora em creaturescripts/scripts/login.lua
       procure por OU semelhante a esse:
      registerCreatureEvent(cid, "AdvanceSave")
      e abaixo adicione:
      registerCreatureEvent(cid, "fragarea")

      //


      Agora tudo certo, quando quiser adiciona uma area que não pega frag, vá até o script e apenas coloque a area, igual o demonstrado no script

      Exemplo:
      local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, [2] = {from = {x = 1000, y = 1000, z = 7}, to = {x = 1100, y = 1100, z = 7}}, }
      assim somente colocando a area no script e abrindo o server ou dando /reload, já funcionará a area como não pegar frag.
      Esse sistema pode ser bom pra areas de pvp ativo, onde você ainda quer que o player que morrer perca os atributos, como se fosse uma morte normal, porém não conta frag pra quem matar.
      Bom pra sistemas tipo castle 48h (guild war), onde há diversas mortes e risco de pegar red, atrapalhando a war.

      Façam bom proveito dos scripts, e deixem os créditos no script rsrs

      **Eu fiz as alterações e o simples código por isso vim disponibilizar, créditos meus**
    • Por Muvuka
      Abri canal a força creaturescript acho que funcione no creaturescript cria script creaturescript
       
      <channel id="9" name="HELP" logged="yes"/>
      <channel id="12" name="Report Bugs" logged="yes"/>
      <channel id="13" name="Loot" logged="yes"/>
      <channel id="14" name="Report Character Rules Tibia Rules" logged="yes"/>
      <channel id="15" name="Death Channel"/>
      <channel id="6548" name="DexSoft" level="1"/>
      <channel id="7" name="Reports" logged="yes"/>
       
      antes de 
              if(lastLogin > 0) then adicione isso:
                      doPlayerOpenChannel(cid, CHANNEL_HELP) doPlayerOpenChannel(cid, 1,  2, 3) = 1,2 ,3 Channels, entendeu? NÃO FUNCIONA EU QUERO UM MEIO DE ABRI SEM USA A SOURCE
       
      EU NÃO CONSEGUI ABRI EU NÃO TENHO SOURCE
       
       
    • Por bolachapancao
      Rapaziada seguinte preciso de um script que ao utilizar uma alavanca para até 4 jogadores.
      Os jogadores serão teleportados para hunt durante uma hora e depois de uma hora os jogadores serão teleportados de volta para o templo.
       
      Observação: caso o jogador morra ou saia da hunt o evento hunt é cancelado.

      Estou a base canary
      GitHub - opentibiabr/canary: Canary Server 13.x for OpenTibia community.
       
    • Por RAJADAO
      .Qual servidor ou website você utiliza como base? 
      Sabrehaven 8.0
      Qual o motivo deste tópico? 
      Ajuda com novos efeitos
       
      Olá amigos, gostaria de ajuda para introduzir os seguintes efeitos no meu servidor (usando o Sabrehaven 8.0 como base), adicionei algumas runas novas (avalanche, icicle, míssil sagrado, stoneshower & Thunderstorm) e alguns novos feitiços (exevo mas san, exori san, exori tera, exori frigo, exevo gran mas frigo, exevo gran mas tera, exevo tera hur, exevo frigo hur) mas nenhum dos efeitos dessas magias parece existir no servidor, alguém tem um link para um tutorial ou algo assim para que eu possa fazer isso funcionar?
      Desculpe pelo mau inglês, sou brasileiro.

      Obrigado!


      AVALANCHE RUNE id:3161 \/
      (COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

      STONESHOWER RUNE id:3175 \/
      (COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_STONES)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

      THUNDERSTORM RUNE id:3202 \/
      (COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_E NERGYHIT)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)

      ICICLE RUNE id:3158 \/
      COMBAT_ICEDAMAGE
      CONST_ME_ICEAREA
      CONST_ANI_ICE

      SANTO MÍSSIL RUNA id:3182 \/
      (COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

      CONST_ME_PLANTATTACK (exevo gran mas tera)
      CONST_ME_ICETORNADO (exevo gran mas frigo)
      CONST_ME_SMALLPLANTS (exevo tera hur)
      CONST_ME_ICEAREA (exevo frigo hur)
      CONST_ME_ICEATTACK (exori frigo)
      CONST_ME_CARNIPHILA (exori tera)

      EXORI SAN \/
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
      CONST_ME_HOLYDAM IDADE

      EXEVO MAS SAN \/
      CONST_ME_HOLYAREA
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo