• 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] Need Help For Update Some Script

Status
Not open for further replies.

Estorn

Respected Member
Code:
    /* Announce Login
    * Scripted by: Faded
    * Edited by: Est0rn
    * (C)Nomsoftware 'Nomsoft' 2012-2014
    */
     
    #include "ScriptPCH.h"
     
    class announce_login : public PlayerScript
    {
    public:
        announce_login() : PlayerScript("announce_login") { }
     
        void OnLogin(Player* player)
        {
            if (player->GetTeam() == ALLIANCE)
                    {
                std::ostringstream ss;
                            ss << "Welcome A New Champion|r |CFFFF0303" << player->GetName() << "|r To  PvP-Zone Instant 80";
                sWorld->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str());
                    }
                    else
                    {
                std::ostringstream ss;
                            ss << "Welcome A New Champion|r |CFFFF0303" << player->GetName() << "|r To  PvP Instant 80";
                sWorld->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str());
                    }
            }
    };
     
    void AddSC_announce_login()
    {
        new announce_login;
    }

And

Code:
#include "ScriptPCH.h"

class Tools_NPC : public CreatureScript
{
public:
    Tools_NPC() : CreatureScript("Tools_NPC") { }

    bool OnGossipHello(Player *player, Creature *creature)
    {
		player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "|TInterface\\icons\\Achievement_BG_most_damage_killingblow_dieleast:28|tRestore Health and Mana", GOSSIP_SENDER_MAIN, 1);
		player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "|TInterface\\icons\\Ability_Hunter_Harass:28|tReset Instances", GOSSIP_SENDER_MAIN, 2);
		player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "|TInterface\\icons\\Spell_Holy_PrayerofSpirit:28|tReset Cooldowns", GOSSIP_SENDER_MAIN, 3);
		player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "|TInterface\\icons\\Ability_DualWieldSpecialization:28|tReset Combat", GOSSIP_SENDER_MAIN, 4);
		player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "|TInterface\\icons\\Ability_Paladin_ArtofWar:28|tRemove Sickness", GOSSIP_SENDER_MAIN, 5);
		player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "|TInterface\\icons\\INV_Misc_Wrench_01:28|tRepair Items", GOSSIP_SENDER_MAIN, 6);
		player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "|TInterface\\icons\\INV_Misc_Map_01:28|tExit", GOSSIP_SENDER_MAIN, 8);
        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 1: // Restore HP and MP
            if(player->IsInCombat())
            {
                creature->MonsterWhisper("You're in combat!", player, false);
                player->CLOSE_GOSSIP_MENU();
                return false;
            }
            else if(player->getPowerType() == POWER_MANA)
                player->SetPower(POWER_MANA, player->GetMaxPower(POWER_MANA));

            player->SetHealth(player->GetMaxHealth());
            player->CLOSE_GOSSIP_MENU();
            break;
        case 2: // Reset Instances
            for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
            {
                Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
                for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
                {
                    player->UnbindInstance(itr, Difficulty(i));
                }
            }
            player->CLOSE_GOSSIP_MENU();
            break;
        case 3: // Reset Cooldowns
            if(player->IsInCombat())
            {
                creature->MonsterWhisper("You're in combat!", player, false);
                player->CLOSE_GOSSIP_MENU();
                return false;
            }

            player->RemoveAllSpellCooldown();
            player->CLOSE_GOSSIP_MENU();
            break;
        case 4: // Reset Combat
            player->CombatStop();
            player->CLOSE_GOSSIP_MENU();
            break;
        case 5: // Remove Sickness
            if(player->HasAura(15007))
                player->RemoveAura(15007);

            player->CLOSE_GOSSIP_MENU();
            break;
        case 6: // Repair Items
            player->DurabilityRepairAll(false, 0, false);
            player->CLOSE_GOSSIP_MENU();
            break;
        case 8:
            player->CLOSE_GOSSIP_MENU();
            break;
        case 73: // ...Back
			player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "|TInterface\\icons\\Achievement_BG_most_damage_killingblow_dieleast:28|tRestore HP and MP", GOSSIP_SENDER_MAIN, 1);
			player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "|TInterface\\icons\\Ability_Hunter_Harass:28|tReset Instances", GOSSIP_SENDER_MAIN, 2);
			player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "|TInterface\\icons\\Spell_Holy_PrayerofSpirit:28|tReset Cooldowns", GOSSIP_SENDER_MAIN, 3);
			player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "|TInterface\\icons\\Ability_DualWieldSpecialization:28|tReset Combat", GOSSIP_SENDER_MAIN, 4);
			player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "|TInterface\\icons\\Ability_Paladin_ArtofWar:28|tRemove Sickness", GOSSIP_SENDER_MAIN, 5);
			player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "|TInterface\\icons\\INV_Misc_Wrench_01:28|tRepair Items", GOSSIP_SENDER_MAIN, 6);
			player->ADD_GOSSIP_ITEM(GOSSIP_ICON_INTERACT_1, "|TInterface\\icons\\INV_Misc_Map_01:28|tExit", GOSSIP_SENDER_MAIN, 8);
            player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
            break;
        }
        return true;
    }
};

void AddSC_Tools_NPC()
{
    new Tools_NPC();
}

I Can't Update Script Please help me

Update That Script For Last Trinity Tnq Have Some error
 
Last edited by a moderator:

Estorn

Respected Member
3>C:\Users\devel_000\Desktop\\src\server\scripts\C ustom\AnnounceWelcome.cpp(14): error C4263: 'void announce_login::OnLogin(Player *)' : member function does not override any base class virtual member function
3>C:\Users\devel_000\Desktop\\src\server\scripts\C ustom\AnnounceWelcome.cpp(29): error C4264: 'void PlayerScript::OnLogin(Player *,bool)' : no override available for virtual member function from base 'PlayerScript'; function is hidden
3> C:\Users\devel_000\Desktop\\src\server\game\Script ing\ScriptMgr.h(747) : see declaration of 'PlayerScript::OnLogin'
3> C:\Users\devel_000\Desktop\\src\server\game\Script ing\ScriptMgr.h(680) : see declaration of 'PlayerScript'
3>C:\Users\devel_000\Desktop\PvP-Zone\src\server\scripts\Custom\CrazyDoctor.cpp(28) : error C2039: 'MonsterWhisper' : is not a member of 'Creature'
3> C:\Users\devel_000\Desktop\\src\server\game\Entiti es\Creature\Creature.h(424) : see declaration of 'Creature'
3>C:\Users\devel_000\Desktop\\src\server\scripts\C ustom\CrazyDoctor.cpp(52): error C2039: 'MonsterWhisper' : is not a member of 'Creature'
3> C:\Users\devel_000\Desktop\\src\server\game\Entiti es\Creature\Creature.h(424) : see declaration of 'Creature'
 

Tommy

Founder
Code:
 void OnLogin(Player* player)

Should be:

Code:
void OnLogin(Player* player, bool firstLogin)

You can view all the PlayerScript hooks in ScriptMgr.h, along with other hooks if you have more errors towards them: https://github.com/TrinityCore/Trin...server/game/Scripting/ScriptMgr.h#L1062-L1091

"MonsterWhisper", "MonsterYell", etc were changed awhile back to just "Whisper", "Yell", etc. View Unit.h for those methods: https://github.com/TrinityCore/Trin.../server/game/Entities/Unit/Unit.h#L2164-L2168
 

Estorn

Respected Member
Code:
 void OnLogin(Player* player)

Should be:

Code:
void OnLogin(Player* player, bool firstLogin)

You can view all the PlayerScript hooks in ScriptMgr.h, along with other hooks if you have more errors towards them: https://github.com/TrinityCore/Trin...server/game/Scripting/ScriptMgr.h#L1062-L1091

"MonsterWhisper", "MonsterYell", etc were changed awhile back to just "Whisper", "Yell", etc. View Unit.h for those methods: https://github.com/TrinityCore/Trin.../server/game/Entities/Unit/Unit.h#L2164-L2168
Error 2 error C2039: 'MonsterTalk' : is not a member of 'Creature' C:\Users\devel_000\Desktop\\src\server\scripts\Custom\CrazyDoctor.cpp 52 1 scripts


Have error agaien i changed
 

Tommy

Founder
Not sure how obvious I can get. All you had to do was remove "MONSTER" from the method, as I was saying. I was even giving you the appropriate link to the correct methods, "Whisper", "Yell", "Say", etc, for you to use. Even if you had intellisense whilst using Visual Studio, it even shows the method names.
 

Estorn

Respected Member
Code:
creature->Whisper("You're in combat!", player, false);

Error 1 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 2 from 'Player *' to 'Language' C:\Users\devel_000\Desktop\PvP-Zone\src\server\scripts\Custom\CrazyDoctor.cpp 28 1 scripts
 

slp13at420

Mad Scientist
Error 1 error C2664: 'void Unit::Whisper(uint32,Player *,bool)' : cannot convert argument 2 from 'Player *' to 'Language' C:\Users\devel_000\Desktop\PvP-Zone\src\server\scripts\Custom\CrazyDoctor.cpp 28 1 scripts

you applied `player` to argument 2 . but argument 2 requires a value for language. player is required for argument 3 as shown below. also found in the link from tommy.
Code:
virtual void Whisper(std::string const& text, Language language, Player* target, bool isBossWhisper = false);

from what i'm reading from the link it should be like this:
Code:
creature->Whisper("You're in combat!", LANG_UNIVERSAL,player, false);
`LANG_UNIVERSAL` = all . tnx [MENTION=1214]Visa[/MENTION].
 
Last edited:
Status
Not open for further replies.
Top