Ir para conteúdo

Featured Replies

Postado

Eae Galera blz ? Eu queria pedir a ajuda de vocês para min tirar umas duvidas, e ajuda a mudar algumas coisas se possível, uma coisa que eu tenho duvida como é que arruma é que quando o player abre o cast para os player vê ele, se ele tiver guild e abrir o chat , as pessoas que assistem ele pode comentar no chat da guild, e fica o mesmo nome dele, e as outras duvidas é se tem como mudar a mensagem que aparece no chat do cast quando um player começa a assistir a pessoa, queria que essa mensagem fosse no em outro channel, o defaut.

Spoiler

Screenshot_54.png

A outra duvida é como mudar o nick do player que está assistindo, será que que alguém poderia min ajuda por favor.

 

protocolgame.cpp

 

Script Cast

Spoiler

function onSay(cid, words, param, channel)
	local tmp = param:explode(" ")
	if not(tmp[1]) then
		return doPlayerSendCancel(cid, "Parameters needed")
	end
	
	if tmp[1] == "on" then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has started.")
		doPlayerSetCastState(cid, true)
		doPlayerSave(cid)
	elseif getPlayerCast(cid).status == false then
		return doPlayerSendCancel(cid, "Your cast has to be running for this action.")
	elseif tmp[1] == "off" then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has ended.")
		doPlayerSetCastState(cid, false)
				doPlayerSave(cid)
	elseif isInArray({"pass", "password", "p"}, tmp[1]) then
		if not(tmp[2]) then
			return doPlayerSendCancel(cid, "You need to set a password")
		end
		
		if tmp[2]:len() > 10 then
			return doPlayerSendCancel(cid, "The password is too long. (Max.: 10 letters)")
		end
		
		if tmp[2] == "off" then
			doPlayerSetCastPassword(cid, "")
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast password has been removed.")
		else
			doPlayerSetCastPassword(cid, tmp[2])
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast password was set to: " .. tmp[2])
		end
	elseif isInArray({"desc", "description", "d"}, tmp[1]) then
		local d = param:gsub(tmp[1]..(tmp[2] and " " or ""), "")
		
		if not(d) or d:len() == 0 then
			return doPlayerSendCancel(cid, "You need to specify a description.")
		end
		
		if d:len() > 50 then
			return doPlayerSendCancel(cid, "The description is too long. (Max.: 50 letters)")
		end
		
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast description was set to: ")
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, d)
		doPlayerSetCastDescription(cid, d)
	elseif tmp[1] == "ban" then
		if not(tmp[2]) then
			return doPlayerSendCancel(cid, "Specify a spectator that you want to ban.")
		end
		
		if doPlayerAddCastBan(cid, tmp[2]) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been banned.")
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be banned.")
		end
	elseif tmp[1] == "unban" then
		if not(tmp[2]) then
			return doPlayerSendCancel(cid, "Specify the person you want to unban.")
		end
		
		if doPlayerRemoveCastBan(cid, tmp[2]) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been unbanned.")
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be unbanned.")
		end
	elseif param == "bans" then
		local t = getCastBans(cid)
		local text = "Cast Bans:\n\n"
		for k, v in pairs(t) do
			text = text .. "*" .. v.name .. "\n"
		end 
		if text == "Cast Bans:\n\n" then
			text = text .. "No bans."
		end
		doShowTextDialog(cid, 5958, text)
	elseif tmp[1] == "mute" then
		if not(tmp[2]) then
			return doPlayerSendCancel(cid, "Specify a spectator that you want to mute.")
		end
		
		if doPlayerAddCastMute(cid, tmp[2]) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been muted.")
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be muted.")
		end
	elseif tmp[1] == "unmute" then
		if not(tmp[2]) then
			return doPlayerSendCancel(cid, "Specify the person you want to unmute.")
		end
		
		if doPlayerRemoveCastMute(cid, tmp[2]) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been unmuted.")
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be unmuted.")
		end
	elseif param == "mutes" then
		local t = getCastMutes(cid)
		local text = "Cast Mutes:\n\n"
		for k, v in pairs(t) do
			text = text .. "*" .. v.name .. "\n"
		end 
		if text == "Cast Bans:\n\n" then
			text = text .. "No mutes."
		end
		doShowTextDialog(cid, 5958, text)
	elseif param == "viewers" then
		local t = getCastViewers(cid)
		local text, count = "Cast Viewers:\n#Viewers: |COUNT|\n\n", 0
		for _,v in pairs(t) do
			count = count + 1
			text = text .. "*" .. v.name .."\n"
		end
		
		if text == "Cast Viewers:\n#Viewers: |COUNT|\n\n" then text = "Cast Viewers:\n\nNo viewers." end
		text = text:gsub("|COUNT|", count)
		doShowTextDialog(cid, 5958, text)
	elseif param == "status" then
		local t, c = getCastViewers(cid), getPlayerCast(cid)
		local count = 0
		for _,v in pairs(t) do count = count + 1 end
		
		doShowTextDialog(cid, 5958, "Cast Status:\n\n*Viewers:\n      " .. count .. "\n*Description:\n      "..(c.description == "" and "Not set" or c.description).."\n*Password:\n      " .. (c.password == "" and "Not set" or "Set - '"..c.password.."'"))
	elseif param == "update" then
		if getPlayerStorageValue(cid, 656544) > os.time() then
			return doPlayerSendCancel(cid, "You used this command lately. Wait: " .. (getPlayerStorageValue(cid, 656544)-os.time()) .. " sec.")
		end
		doPlayerSave(cid)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The cast settings have been updated.")
		doPlayerSetStorageValue(cid, 656544, os.time()+60)
	end
	return true
end

 

 

Editado por Wase Wiss (veja o histórico de edições)

Postado
  • Autor

@up, alguém min ajuda por favor, eu estava olhando aki no arquivo da source protocolgame.cpp, e achei isso aki

		if(!WaitingList::getInstance()->login(player))
		{
			if(OutputMessage_ptr output = OutputMessagePool::getInstance()->getOutputMessage(this, false))
			{
				TRACK_MESSAGE(output);
				std::stringstream ss;
				ss << "Too many players online.\n" << "You are ";

				int32_t slot = WaitingList::getInstance()->getSlot(player);
				if(slot)
				{
					ss << "at ";
					if(slot > 0)
						ss << slot;
					else
						ss << "unknown";

					ss << " place on the waiting list.";
				}
				else
					ss << "awaiting connection...";

				output->put<char>(0x16);
				output->putString(ss.str());
				output->put<char>(WaitingList::getTime(slot));
				OutputMessagePool::getInstance()->send(output);
			}

			getConnection()->close();
			return false;
		}

		if(!IOLoginData::getInstance()->loadPlayer(player, name))
		{
			disconnectClient(0x14, "Your character could not be loaded.");
			return false;
		}

		player->setClientVersion(version);
		player->setOperatingSystem(operatingSystem);
		if(!g_game.placeCreature(player, player->getLoginPosition()) && !g_game.placeCreature(player, player->getMasterPosition(), false, true))
		{
			disconnectClient(0x14, "Temple position is wrong. Contact with the administration.");
			return false;
		}

		player->lastIP = player->getIP();
		player->lastLoad = OTSYS_TIME();
		player->lastLogin = std::max(time(NULL), player->lastLogin + 1);

		m_acceptPackets = true;
		return true;
	}
	else if(_player->client)
	{
		if((m_eventConnect || !g_config.getBool(ConfigManager::REPLACE_KICK_ON_LOGIN)) && !castAccount)
		{
			//A task has already been scheduled just bail out (should not be overriden)
			disconnectClient(0x14, "You are already logged in.");
			return false;
		}
		
		if(!castAccount) {
    		g_chat.removeUserFromAllChannels(_player);
    		_player->disconnect();
    		_player->isConnecting = true;
        }

		addRef();
		if(!castAccount)
			m_eventConnect = Scheduler::getInstance().addEvent(createSchedulerTask(
				1000, boost::bind(&ProtocolGame::connect, this, _player->getID(), operatingSystem, version, castAccount)));
		else
			connect(_player->getID(), operatingSystem, version, castAccount);
		return true;
	}

	addRef();
	return connect(_player->getID(), operatingSystem, version, castAccount);
}

bool ProtocolGame::logout(bool displayEffect, bool forceLogout)
{
	//dispatcher thread
	if(!player)
		return false;
		
	if(getIsCast() && !player->isAccountManager())
	{
		PlayerCast pc = player->getCast();
		for(AutoList<ProtocolGame>::iterator it = Player::cSpectators.begin(); it != Player::cSpectators.end(); ++it)
			if(it->second == this)
				if(Connection_ptr connection = it->second->getConnection())
				{
					PrivateChatChannel* channel = g_chat.getPrivateChannel(player);
					if(channel) {
						channel->talk("", SPEAK_CHANNEL_RA, (getViewerName() + " has left the cast."));
					}

					connection->close();
					player->removeCastViewer(it->first);
				}
		return false;
	}

	if(!player->isRemoved())
	{
		if(!forceLogout)
		{
			if(!IOLoginData::getInstance()->hasCustomFlag(player->getAccount(), PlayerCustomFlag_CanLogoutAnytime))
			{
				if(player->getTile()->hasFlag(TILESTATE_NOLOGOUT))
				{
					player->sendCancelMessage(RET_YOUCANNOTLOGOUTHERE);
					return false;
				}

				if(player->getZone() != ZONE_PROTECTION && player->hasCondition(CONDITION_INFIGHT))
				{
					player->sendCancelMessage(RET_YOUMAYNOTLOGOUTDURINGAFIGHT);
					return false;
				}

				if(!g_creatureEvents->playerLogout(player, false)) //let the script handle the error message
					return false;
			}
			else
				g_creatureEvents->playerLogout(player, true);
		}
		else if(!g_creatureEvents->playerLogout(player, true))
			return false;

		if(displayEffect && !player->isGhost())
			g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
	}

	player->kickCastViewers();

	if(Connection_ptr connection = getConnection())
		connection->close();

	if(player->isRemoved())
		return true;

	return g_game.removeCreature(player);
}

bool ProtocolGame::connect(uint32_t playerId, OperatingSystem_t operatingSystem, uint16_t version, bool castAccount)
{
	if(!castAccount)
		unRef();
		
	m_eventConnect = 0;

	Player* _player = g_game.getPlayerByID(playerId);
	if(castAccount)
	{
		PlayerCast pc = _player->getCast();
		for(std::list<CastBan>::iterator it = pc.bans.begin(); it != pc.bans.end(); ++it)
			if(it->ip == getIP())
			{
				disconnectClient(0x14, "You are banned from this cast.");
				return false;
			}

		if(_player->getCastViewerCount() >= 50)
		{
			disconnectClient(0x14, "The cast reached the maximum viewer limit (50).");
			return false;
		}

		player = _player;
		player->addRef();
		m_acceptPackets = true;
		isCast = true;
		player->addCastViewer(this);
		sendAddCreature(_player, _player->getPosition(), _player->getTile()->getClientIndexOfThing(_player, _player));

		PrivateChatChannel* channel = g_chat.getPrivateChannel(_player);
		if(channel)
		{
			sendCreatePrivateChannel(channel->getId(), channel->getName());
			channel->talk("", SPEAK_CHANNEL_RA, (getViewerName() + " has joined the cast."));
			sendCreatureSay(player, SPEAK_PRIVATE, "Cast communication is turned on.");
		}
		else 
			sendCreatureSay(player, SPEAK_PRIVATE, "Cast communication is turned off.");
		return true;
	}

Ae eu queria que essa mensagem "has left the cast" aparece no defaut normal, e aparecesse "Telespectador (N°DOCARAQUESAIU) abandonou a Stream" e essa mensagem "has joined the cast" aparecesse no defaut também, "Telespectador (N°DOCARAQUE ENTROU) Entrou na sua Stream", será que alguém poderia min ajudar por favor, tem mais um bug também, eu queria que o cara que tivesse assistindo não tivesse como vê quem ta na lista vip do cara, será que pode min ajudar por favor, desde já orbigado <3

 

Spoiler

@KotZletY da Rep- não mano por favor, eu cliquei em subir tópico topico antes de comentar isso aki, eu só estou falando isso por que eu acho que poderia ajuda a pessoa que estiver interessada em min ajuda, por avor mano, eu já quase nem tenho rep+ :( 

 

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo