User Tag List

Results 1 to 4 of 4

Thread: Need help with script

  1. #1
    Member
    Join Date
    Sep 2016
    Posts
    13
    XP
    447
    Level
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Need help with script

    Code:
    /*********************
    *  Made by: KuSaNaGy *
    *********************/
    /*
    //#include "ScriptPCH.h" este script include no se debe usar en los scritp custom
    */
    #include "Player.h"
    #include "PlayerDump.h"
    #include "ScriptMgr.h"
    #include "ScriptedGossip.h"
     
    /*
    cualquier inquietud comunicate conmigo
    karlos kaxtilla tkd
    https://www.facebook.com/carlos.castilla.79
    */
     
    class npc_promo : public CreatureScript
     
    {
    public:
        npc_promo() : CreatureScript("npc_promo") { }
     
        bool OnGossipHello(Player* player, Creature* creature)
        {
          player->AddGossipItemFor(7, "Seleccione tu Promo: ", GOSSIP_SENDER_MAIN, 99); //7 igual nuemero restringido del menu
            switch (player->getClass())
            {
                    case CLASS_DRUID: player->AddGossipItemFor(10, "Promocion - Druida", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 30); break; //10 actuacion 30a 39 numeros de casos
                    case CLASS_SHAMAN: player->AddGossipItemFor(10, "Promocion - Shaman", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 31); break;
                    case CLASS_PALADIN: player->AddGossipItemFor(10, "Promocion - Paladin", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 32); break;
                    case CLASS_WARRIOR: player->AddGossipItemFor(10, "Promocion - Guerrero", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 33); break;
                    case CLASS_PRIEST: player->AddGossipItemFor(10, "Promocion - Sacerdote", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 34); break;
                    case CLASS_DEATH_KNIGHT: player->AddGossipItemFor(10, "Promocion - DK", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 35); break;
                    case CLASS_ROGUE: player->AddGossipItemFor(10, "Promocion - Picaro", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 36); break;
                    case CLASS_HUNTER: player->AddGossipItemFor(10, "Promocion - Cazador", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 37); break;
                    case CLASS_MAGE: player->AddGossipItemFor(10, "Promocion - Mago", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 38); break;
                    case CLASS_WARLOCK: player->AddGossipItemFor(10, "Promocion - Brujo", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +3 9); break;
            }
          player->SendGossipMenuFor(1, creature->GetGUID());
          return true;
        }
     
        bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 actions)
        {
            if (player->getLevel() == 1)  //confirmamos si player es lvl igual o estricto a 1 continuamos
            {
                uint32 accountID = player->GetSession()->GetAccountId();
                QueryResult result = CharacterDatabase.PQuery("SELECT COUNT(`guid`) FROM `characters` WHERE `account`=%u", accountID);
                Field *fields = result->Fetch();
                uint32 personajes = fields[0].GetUInt32();
     
                if (personajes == 2)        //aqui damos la instruciones para cuantos player necesitamos que reciban promocion
                   {
                            if (actions == 99) //condicional de actuacion de casos
                            {
                                ClearGossipMenuFor(player);
                                return false;
                            }
                            player->GetSession()->SendAreaTriggerMessage("Felicidades!! has obtenido tu Promocion!.");
                            //aca podemos colocar que el npc de a cualquier player que venga por promo para no repetir en cada uno estas instruciones
                            player->GiveLevel(80);
                            player->SetMoney(200000000);
                            //podemos colocar spell, dinero, item, emblemas lo que deses
                            switch(actions)
                              {                              
                                      case GOSSIP_ACTION_INFO_DEF + 30: // Druid
                                      player->AddItem(45983, 1); // por ejemplo  player->AddItem(42584, 1);// reliquia pvp dps donde (primero va la ID del items,  luego cantidad)
                                      player->CloseGossipMenuFor(); 
                                      break;
     
                                      case GOSSIP_ACTION_INFO_DEF + 31: // Shaman
                                      player->AddItem(45983, 1);
                                      player->CloseGossipMenuFor();     
                                      break;
     
                                      case GOSSIP_ACTION_INFO_DEF + 32: // Paladin
                                      player->AddItem(45983, 1);
                                      player->CloseGossipMenuFor(); 
                                      break;
     
                                      case GOSSIP_ACTION_INFO_DEF + 33: // Warrior
                                      player->AddItem(45983, 1);
                                      player->CloseGossipMenuFor(); 
                                      break;
     
                                      case GOSSIP_ACTION_INFO_DEF + 34: // Priest
                                      player->AddItem(45983, 1);
                                      player->CloseGossipMenuFor(); 
                                      break;
     
                                      case GOSSIP_ACTION_INFO_DEF + 35: // DK
                                      player->AddItem(45983, 1);
                                      player->CloseGossipMenuFor(); 
                                      break;
     
                                      case GOSSIP_ACTION_INFO_DEF + 36: // Rogue
                                      player->AddItem(45983, 1);
                                      player->CloseGossipMenuFor(); 
                                      break;
     
                                      case GOSSIP_ACTION_INFO_DEF + 37: // Hunter
                                      player->AddItem(45983, 1);
                                      player->CloseGossipMenuFor(); 
                                      break;
     
                                      case GOSSIP_ACTION_INFO_DEF + 38: // Mage
                                      player->AddItem(45983, 1);
                                      player->CloseGossipMenuFor(); 
                                      break;
     
                                      case GOSSIP_ACTION_INFO_DEF + 39: // Warlock
                                      player->AddItem(45983, 1);                                 
                                      player->CloseGossipMenuFor(); 
                                      break;
                               }
                   }
                       
                           if (personajes > 2) //si el personaje es mayor a 1 entonce diga tal mensaje
                        {
                            player->GetSession()->SendAreaTriggerMessage("La promocion solo es para 2 Personaje por Cuenta y tiene que tener Lvl 1 para poder reclamar su Promo.");
                                  return true;
                        }
               
                ClearGossipMenuFor(player); //cierro el menu completo
            }
            return true;
        }
    };
     
    void AddSC_npc_promo()
    {
        new npc_promo();
    }
    Please.help me fix this script.

    I don't know what's wrong with it.

    Here is a screenshot of the errors.

    http://prnt.sc/dscf5k

  2. #2
    Epic Member <span style='color: #9400D3'><span class='glow_000000'>AlexeWarr</span></span>'s Avatar
    Join Date
    Apr 2013
    Location
    Romania
    Posts
    324
    XP
    6,622
    Level
    24
    Thanks
    46
    Thanked 107 Times in 46 Posts
    Awards:
    Repacker Scripter
    Epic win LoL


  3. #3
    Moderator / Eluna Dev <span style='color: #FF0000'><span class='glow_8B0000'>Rochet2</span></span>'s Avatar
    Join Date
    Apr 2013
    Location
    Finland
    Posts
    1,871
    XP
    13,718
    Level
    35
    Thanks
    95
    Thanked 595 Times in 421 Posts
    if the above doesnt work, then you are using the function wrong in your original script.
    its used like this AddGossipItemFor(player, GOSSIP_ICON_DOT, OZ_GM_GOSSIP1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
    Awards:
    Support LOL Scripter Facepalm! Raffle Winner
    rochet2.github.io - Home of great codes

  4. #4
    Founder <span style='color: #FF4500'>Tommy</span>'s Avatar
    Join Date
    Apr 2013
    Posts
    7,399
    XP
    3,449,919
    Level
    378
    Thanks
    891
    Thanked 1,859 Times in 1,121 Posts
    Quote Originally Posted by AlexeWarr View Post
    That's not how we want to help users around here. Instead of changing the code and saying, "here you go!" without any indication of what was changed, tell the user what was done and how it will affect the script..

  5. The Following User Says Thank You to Tommy For This Useful Post:


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •