• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] The new creation of the players online time to customize the project script

Status
Not open for further replies.

yunfan

Emulation Addict
Has solved this problem, thank you
=================================================================================================================

Code:
#include "ScriptPCH.h"
#pragma execution_character_set("utf-8")

class Pao_Dian_Shi_Jian_NPC : public CreatureScript
{
	public:
	Pao_Dian_Shi_Jian_NPC () : CreatureScript("Pao_Dian_Shi_Jian_NPC") { }
	
	bool OnGossipHello(Player* player, Creature* creature)
	{
		player->PlayerTalkClass->ClearMenus();
		player->ADD_GOSSIP_ITEM(6, "me time", GOSSIP_SENDER_MAIN, 10);
		player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
		return true;
	}
	bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action)
	{
		player->PlayerTalkClass->ClearMenus();
		
		switch (action)
		{
			case 10:  
			{
				QueryResult result = CharacterDatabase.PQuery("SELECT totaltime FROM characters WHERE guid=%u;",player->GetGUIDLow());			   
 			    Field *fields = result->Fetch();
                uint32 totaltime = fields[0].GetUInt32();
				std::stringstream qq;
				qq << "me time:" << totaltime;
				player->ADD_GOSSIP_ITEM(6, qq.str(), GOSSIP_SENDER_MAIN, 999);
			    player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
			}
			break;

		}
		return true;
	}
};

void AddSC_Pao_Dian_Shi_Jian_NPC()
{
    new Pao_Dian_Shi_Jian_NPC();
}

====================================================================================================
 
Last edited:

Tommy

Founder
Next time use
Code:
 tags for your code.

What is the purpose of this script? What does it do? What are you trying to accomplish with that variable/minor calculation? More info would be nice.
 

yunfan

Emulation Addict
Good thank you, I first send a post do not understand this setting, I am sorry

This problem has been solved, thank you
 

Tommy

Founder
Good thank you, I first send a post do not understand this setting, I am sorry

This problem has been solved, thank you

Next time give more info. Also, don't delete the contents of your thread just because it is "solved". That is against the rules.
 
Status
Not open for further replies.
Top