Can someone compile something for me haveing trobble menu

User Tag List

Results 1 to 2 of 2
  1. #1
    *Alexz*'s Avatar Member
    Reputation
    105
    Join Date
    May 2007
    Posts
    521
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can someone compile something for me haveing trobble

    #1
    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    uint32 add_gold, new_gold, current_gold, hasGold, hasItems;
    uint64 charID;
    char query[225];
    
    class SCRIPT_DECL WelcomeNPC : public GossipScript
    {
    public:
    void GossipHello(Object * pObject, Player* Plr, bool Autosend);
    void GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code);
    void GossipEnd(Object * pObject, Player* Plr);
    void Destroy()
    {
    delete this;
    }
    };
    
    void WelcomeNPC::GossipHello(Object * pObject, Player* Plr, bool Autosend)
    {
    GossipMenu *Menu;
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    Creature * pCreature = (pObject->GetTypeId() == TYPEID_UNIT) ? ((Creature*)pObject) : NULL;
    
    Menu->AddItem(0, "May I have some gold? (Level 1)", 1);
    Menu->AddItem(0, "I'd like some items please. (Level 5)", 2);
    Menu->AddItem(0, "Nevermind..", 3);
    if (Autosend)
    Menu->SendTo(Plr);
    }
    
    void WelcomeNPC::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
    {
    GossipMenu *Menu;
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    Creature * pCreature = (pObject->GetTypeId() == TYPEID_UNIT) ? ((Creature*)pObject) : NULL;
    charID = Plr->GetGUID(); // Get character ID.
    
    if(pCreature==NULL)
    return;
    
    switch (IntId)
    {
    case 1: // Gold
    {
    current_gold = Plr->GetUInt32Value(PLAYER_FIELD_COINAGE); // Grab players current amount of gold.
    
    // Insert the player data into the database if it doesnt exsist, will cause a crash if not.
    sprintf(query, "SELECT * FROM welcomenpc WHERE guid=%i", charID);
    QueryResult* result = CharacterDatabase.Query(query);
    
    if(!result)
    {
    sprintf(query, "INSERT INTO welcomenpc VALUES (%i, '', '')", charID);
    CharacterDatabase.Query(query);
    }
    
    CharacterDatabase.FreeQueryResult(result);
    
    // Lets check if the player has already got their x amount of gold.
    sprintf(query, "SELECT hasGold FROM welcomenpc WHERE guid=%i", charID);
    QueryResult* result1 = CharacterDatabase.Query(query);
    
    // Get the value from the database
    Field* Fields = result1->Fetch();
    hasGold = Fields[0].GetUInt32();
    
    if(hasGold == 0)
    {
    add_gold = 50000000; // Amount NPC Should Add
    new_gold = current_gold + add_gold; // Final Amount
    Plr->SetUInt32Value(PLAYER_FIELD_COINAGE, new_gold); // Add the gold
    pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Very well, happy hunting.");
    sWorld.SendWorldText("You recieved 5000 Gold.");
    
    // Lets update the database to say the user has recieved their gold.
    sprintf(query, "UPDATE welcomenpc SET hasGold = '1' WHERE guid=%i", charID);
    CharacterDatabase.Query(query);
    Plr->Gossip_Complete();
    
    }
    else
    {
    pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I have no more money to give you sorry.");
    Plr->Gossip_Complete();
    }
    
    CharacterDatabase.FreeQueryResult(result1);
    
    }break;
    
    case 2: // Items
    {
    
    if(Plr->getLevel() >= 5) // Make sure the player is level 5.
    {
    // Insert the player data into the database if it doesnt exsist, will cause a crash if not.
    sprintf(query, "SELECT * FROM welcomenpc WHERE guid=%i", charID);
    QueryResult* result = CharacterDatabase.Query(query);
    
    if(!result)
    {
    sprintf(query, "INSERT INTO welcomenpc VALUES (%i, '', '')", charID);
    CharacterDatabase.Query(query);
    }
    
    CharacterDatabase.FreeQueryResult(result);
    
    // Lets check if the player has had their free items.
    sprintf(query, "SELECT hasItems FROM welcomenpc WHERE guid=%i", charID);
    QueryResult* result1 = CharacterDatabase.Query(query);
    
    Field* Fields = result1->Fetch();
    hasItems = Fields[0].GetUInt32();
    
    if(hasItems == 0)
    {
    if(Plr->_HasSkillLine(433)) // Sheild Wearers
    {
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(1201, Plr));
    sWorld.SendWorldText("You recieved a sheild.");
    }
    
    if(Plr->_HasSkillLine(413)) // Mail Wearers
    {
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(2392, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(2393, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(2394, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(2395, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(2396, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(2397, Plr));
    sprintf(query, "UPDATE welcomenpc SET hasItems = '1' WHERE guid=%i", charID);
    CharacterDatabase.Query(query);
    sWorld.SendWorldText("You recieved a mail item set.");
    Plr->Gossip_Complete();
    }
    else if(Plr->_HasSkillLine(414)) // Leather Wearers
    {
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(85, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(209, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(714, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(1835, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(1836, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(3595, Plr));
    sprintf(query, "UPDATE welcomenpc SET hasItems = '1' WHERE guid=%i", charID);
    CharacterDatabase.Query(query);
    sWorld.SendWorldText("You recieved a leather item set.");
    Plr->Gossip_Complete();
    }
    else if(Plr->_HasSkillLine(415)) // Cloth Wearers
    {
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(193, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(194, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(195, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(711, Plr));
    Plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(3596, Plr));
    sprintf(query, "UPDATE welcomenpc SET hasItems = '1' WHERE guid=%i", charID);
    sWorld.SendWorldText("You recieved a cloth item set.");
    CharacterDatabase.Query(query);
    Plr->Gossip_Complete();
    }
    }
    else
    {
    pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "I have no more items for you sorry.");
    Plr->Gossip_Complete();
    }
    
    CharacterDatabase.FreeQueryResult(result1);
    }
    else
    {
    pCreature->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Sorry your not strong enough to recieve these items yet, please train harder and become level 5.");
    Plr->Gossip_Complete();
    }
    }break;
    
    case 3: // Nevermind..
    {
    Plr->Gossip_Complete();
    }break;
    }
    }
    
    void WelcomeNPC::GossipEnd(Object *pObject, Player* Plr)
    {
    GossipScript::GossipEnd(pObject, Plr);
    }
    
    void SetupWelcomeNPC(ScriptMgr * mgr)
    {
    GossipScript * gs = (GossipScript*) new WelcomeNPC();
    mgr->register_gossip_script(600001, gs);
    }
    #2
    Code:
    void GMCheck (Player *Plr)
    {
        if(Plr->GetSession()->CanUseCommand('a'))
        {
            char display_str[255];
            sprintf(display_str, "[NOTICE] <GM>|cffCC0000%s|r has logged in!", Plr->GetName());
            sWorld.SendWorldText(display_str);
            delete display_str;
        }
    }
    
    extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
    {
        mgr->register_hook(SERVER_HOOK_EVENT_ON_ENTER_WORLD, &GMCheck);
    }

    Thanks in advance will +rep

    Can someone compile something for me haveing trobble
  2. #2
    *Alexz*'s Avatar Member
    Reputation
    105
    Join Date
    May 2007
    Posts
    521
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bump(filter)

Similar Threads

  1. Can Someone Update this for newest Arc Emu?
    By Darksid in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 01-02-2010, 04:15 AM
  2. Can u do something for this.
    By mr.freaky in forum World of Warcraft General
    Replies: 5
    Last Post: 11-22-2009, 08:58 AM
  3. [Request] can someone convert this for me?
    By arthas242 in forum WoW ME Questions and Requests
    Replies: 4
    Last Post: 02-08-2008, 03:40 PM
  4. Can someone do this for me? please?
    By Elunian in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 09-10-2007, 02:25 PM
  5. can someone change maexxna for me?
    By KuRIoS in forum World of Warcraft General
    Replies: 1
    Last Post: 08-15-2006, 04:02 PM
All times are GMT -5. The time now is 04:55 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search