Little c++ Problem menu

User Tag List

Results 1 to 12 of 12
  1. #1
    zsolt333's Avatar Member
    Reputation
    8
    Join Date
    Jun 2008
    Posts
    72
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Little c++ Problem

    I want to create a portal what teleports you to a custom location but only if you have a minimum lvl (like 60 or 70 it don't matter)


    I dont know the code for the arc emu portal to get the lvl of a player when he access it




    Code:
    class NAME: public GameObjectAIScript
    {
    public:
        NAME(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
        void OnActivate(Player * pPlayer)
        {
            pPlayer->SafeTeleport(MAP, 0, X, Y, Z, 1);
        }
        static GameObjectAIScript *Create(GameObject * GO) { return new NAME(GO); }
    };
    GameObjectAIScript * create_goIDNUMBER(GameObject * GO) { return new NAME(GO); }


    And maybe add a message : You dont have lvl xx Cant use the portal... something like this


    thx a loot guys

    Little c++ Problem
  2. #2
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are two easy options to teleport a player:

    Player->EventTeleport(uint32 mapid, float x, float y, float z);

    of using the Safe teleport

    Player->SafeTeleport(uint32 mapid, LocationVector vector);

    Here is a sample:
    Code:
    class NAME: public GameObjectAIScript
    {
    public:
        NAME(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
        void OnActivate(Player * pPlayer)
        {
           //Using SafeTeleport
            pPlayer->SafeTeleport(MAPID, LocationVector(x, y, z);
          //Using EventTeleport
            pPlayer->EventTeleport(MAPID, x, y, z);
        }
        static GameObjectAIScript *Create(GameObject * GO) { return new NAME(GO); }
    };
    GameObjectAIScript * create_go

  3. #3
    zsolt333's Avatar Member
    Reputation
    8
    Join Date
    Jun 2008
    Posts
    72
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and how do i add the lvl restriction and the message ?

  4. #4
    Aznex's Avatar Contributor
    Reputation
    128
    Join Date
    Feb 2008
    Posts
    770
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If (pPlayer->getLevel() > 60)

  5. #5
    zsolt333's Avatar Member
    Reputation
    8
    Join Date
    Jun 2008
    Posts
    72
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thx ill try it and report back

  6. #6
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    heres the example of what you want

    Code:
    class NAME: public GameObjectAIScript
    {
    public:
        NAME(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
        void OnActivate(Player * pPlayer)
        {
           if(pPlayer->GetLevel() >= 60)
           {
            pPlayer->SafeTeleport(MAP, 0, X, Y, Z, 1);
           }
           else
           {
             pPlayer->BroadcastMessage("You must be level 60 to pass through this portal");
        }
        static GameObjectAIScript *Create(GameObject * GO) { return new NAME(GO); }
    };
    GameObjectAIScript * create_goIDNUMBER(GameObject * GO) { return new NAME(GO); }

    p.s. hey guys im back : ) lol
    Lunar Gaming - Reaching For The Stars

  7. #7
    zsolt333's Avatar Member
    Reputation
    8
    Join Date
    Jun 2008
    Posts
    72
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is cool but have a little problem


    Code:
    class NAME: public GameObjectAIScript
    {
    public:
        NAME(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
        void OnActivate(Player * pPlayer)
        {
           if(pPlayer->GetLevel() >= 60)
           {
            pPlayer->SafeTeleport(MAP, 0, X, Y, Z, 1);
           }
           else
           {
             pPlayer->BroadcastMessage("You must be level 60 to pass through this portal");
        }
        static GameObjectAIScript *Create(GameObject * GO) { return new NAME(GO); }
    };
    GameObjectAIScript * create_goIDNUMBER(GameObject * GO) { return new NAME(GO); }


    The only problem is now I am getting this error


    Code:
    1>..\src\ExtraScripts\Portals.cpp(310) : error C2039: 'GetLevel' : is not a member of 'Player'
    1>        e:\server core\new arcemu\trunk\src\arcemu-world\Player.h(788) : see declaration of 'Player'

  8. #8
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it is:

    pPlayer->getLevel();


    Many get this error, misstaking it is a big letter in get.

  9. #9
    Aznex's Avatar Contributor
    Reputation
    128
    Join Date
    Feb 2008
    Posts
    770
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Link_S View Post
    Many get this error, mistaking it is a big letter in get.
    Exactly, I find it weird how sometimes people can't fix stuff like that themselves, even after making a script like that.

  10. #10
    mager1794's Avatar Member
    Reputation
    356
    Join Date
    Feb 2008
    Posts
    703
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oops sorry for that mistake lol forgot that its a small g and i wrote that in notepad so i didn't have VC++ helpin me
    Lunar Gaming - Reaching For The Stars

  11. #11
    zsolt333's Avatar Member
    Reputation
    8
    Join Date
    Jun 2008
    Posts
    72
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem i did it my self after a little reserch

    Here is the code if anyone needs it :wave:


    Code:
    class tele_Name: public GameObjectAIScript
    {
    public:
        tele_Name(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
        void OnActivate(Player * pPlayer)
        {
           if(uint32 plr_level = pPlayer->getLevel() >= 70)
           {
            pPlayer->SafeTeleport(MAP, 0, X, Y, Z, 1);
           }
           else
           {
            pPlayer->BroadcastMessage("You must be level 70 to pass through this portal !!");
    		}
        }
        static GameObjectAIScript *Create(GameObject * GO) { return new tele_Name(GO); }
    };
    GameObjectAIScript * create_goXXXXXX (GameObject * GO) { return new tele_Name(GO); }// XXXXXX is The GO ID


    Regards BloodLord

  12. #12
    Link_S's Avatar Member
    Reputation
    125
    Join Date
    Dec 2008
    Posts
    293
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code is wrong ^^

    You did use pPlayer->SafeTeleport, you need to declare a LocationVector variable in that.

    pPlayer->SafeTeleport(MAPID, LocationVector(x, y, z));

    The code:

    Code:
    class tele_Name: public GameObjectAIScript
    {
    public:
        tele_Name(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
        void OnActivate(Player * pPlayer)
        {
           if(pPlayer->getLevel() > 70)
           {
            pPlayer->SafeTeleport(MAP, LocationVector(x, y, z);
           }
           else
           {
            pPlayer->BroadcastMessage("You must be level 70 to pass through this portal !!");
    		}
        }
        static GameObjectAIScript *Create(GameObject * GO) { return new tele_Name(GO); }
    };
    GameObjectAIScript * create_goXXXXXX (GameObject * GO) { return new tele_Name(GO); }// XXXXXX is The GO ID
    Last edited by Link_S; 01-11-2009 at 09:36 AM.

Similar Threads

  1. Having a little problem here...
    By sonnyd666 in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 03-24-2008, 09:16 AM
  2. A little help for people who have problem with ...
    By Lappe in forum WoW EMU Guides & Tutorials
    Replies: 4
    Last Post: 03-06-2008, 03:59 AM
  3. [help] Realms.conf - = Repack - little problem!
    By adnano in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 01-01-2008, 11:31 AM
  4. Little Problem
    By DJGonn in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 10-08-2007, 03:50 PM
All times are GMT -5. The time now is 11:13 PM. 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