Can you guys correct my C++ script? menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can you guys correct my C++ script?

    Alright guys, I've been working on this, and I thought I had done this perfectly, but I guess I messed up somewhere. Here is my script:
    #include "StdAfx.h"
    #include "Setup.h"

    class Orb_of_Translocation : public GameObjectAIScript
    {
    public:
    Orb_of_Translocation(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
    static GameObjectAIScript *Create(GameObject * GO) { return new Orb_of_Translocation(GO); }

    void OnActivate(Player * pPlayer)
    {
    if(Plr->getRace() == RACE_HUMAN)
    pPlayer->SafeTeleport(0, 0, -8949.95, -132.493, 83.5312)
    }
    else if(Plr->getRace() == RACE_ORC)
    pPlayer->SafeTeleport(1, 0, -618.518, -4251.67, 38.71
    }
    else if(Plr->getRace() == RACE_DWARF)
    pPlayer->SafeTeleport(0, 0, -6240.32, 331.033, 382.75
    }
    else if(Plr->getRace() == RACE_NIGHTELF)
    pPlayer->SafeTeleport(1, 0, 10311.3, 832.463, 1326.41)
    }
    else if(Plr->getRace() == RACE_UNDEAD)
    pPlayer->SafeTeleport(0, 0, 1676.35, 1677.45, 121.67)
    }
    else if(Plr->getRace() == RACE_TAUREN)
    pPlayer->SafeTeleport(10, 0, -2917.58, -257.98, 52.996
    }
    else if(Plr->getRace() == RACE_GNOME)
    pPlayer->SafeTeleport(0, 0, -6240.32, 331.033, 382.75
    }
    else if(Plr->getRace() == RACE_TROLL)
    pPlayer->SafeTeleport(1, 0,-618.518, -4251.67, 38.71
    }
    else if(Plr->getRace() == RACE_BLOODELF)
    pPlayer->SafeTeleport(530, 0, 10349.6, -6357.29, 33.4026)
    }
    else if(Plr->getRace() == RACE_DRAENEI)
    pPlayer->SafeTeleport(530, 0, -3961.64, -13931.2, 100.615)
    }
    }
    };

    void SetupOrb_of_Translocation(ScriptMgr * mgr)
    {
    mgr->register_gameobject_script(910000, &Orb_of_Translocation::Create);
    }
    I dunno what's wrong with it.

    By the way, the name of the object is Orb of Translocation, so if the problem is that I put the underscore there, just let me know.

    Can you guys correct my C++ script?
  2. #2
    doublehex's Avatar Member
    Reputation
    34
    Join Date
    Mar 2007
    Posts
    385
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
     			 				#include "StdAfx.h"
    #include "Setup.h"
     
    class Orb_of_Translocation : public GameObjectAIScript
    {
    public:
    Orb_of_Translocation(GameObject* goinstance) : GameObjectAIScript(goinstance) {}
    static GameObjectAIScript *Create(GameObject * GO) { return new Orb_of_Translocation(GO); }
     
    void OnActivate(Player * Plr)
    {
    	if(Plr->getRace() == RACE_HUMAN)
    	pPlayer->SafeTeleport(0, 0, -8949.95, -132.493, 83.5312);
    	else
    {
     if(Plr->getRace() == RACE_ORC)
    	pPlayer->SafeTeleport(1, 0, -618.518, -4251.67, 38.718);
    	else
    {
    if(Plr->getRace() == RACE_DWARF)
    	pPlayer->SafeTeleport(0, 0, -6240.32, 331.033, 382.758);
    	else 
    {
    if(Plr->getRace() == RACE_NIGHTELF)
    	pPlayer->SafeTeleport(1, 0, 10311.3, 832.463, 1326.41);
    else 
    {
    if(Plr->getRace() == RACE_UNDEAD)
    	pPlayer->SafeTeleport(0, 0, 1676.35, 1677.45, 121.67);
    else
    {
     if(Plr->getRace() == RACE_TAUREN)
    	pPlayer->SafeTeleport(10, 0, -2917.58, -257.98, 52.9968);
    else
    {
    if(Plr->getRace() == RACE_GNOME)
    	pPlayer->SafeTeleport(0, 0, -6240.32, 331.033, 382.758);
    else
    {
    if(Plr->getRace() == RACE_TROLL)
    	pPlayer->SafeTeleport(1, 0,-618.518, -4251.67, 38.718);
    else
    {
    if(Plr->getRace() == RACE_BLOODELF)
    	pPlayer->SafeTeleport(530, 0, 10349.6, -6357.29, 33.4026);
    else
    {
     if(Plr->getRace() == RACE_DRAENEI)
    	pPlayer->SafeTeleport(530, 0, -3961.64, -13931.2, 100.615);
    else
    {
    Plr->BroadcastMessage("Error! You are an incorrect race!");
    }}}}}}}}
    };
     
    void SetupOrb_of_Translocation(ScriptMgr * mgr)
    {
    mgr->register_gameobject_script(910000, &Orb_of_Translocation::Create);
    }
    try that and if you get errors post them here.


  3. #3
    Deamie's Avatar Member
    Reputation
    11
    Join Date
    Jan 2007
    Posts
    133
    Thanks G/R
    1/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Whats is it for? I dont know jack about this stuff =P

  4. #4
    doublehex's Avatar Member
    Reputation
    34
    Join Date
    Mar 2007
    Posts
    385
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its just his gameobject that teleport a player to their start area.


  5. #5
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, it doesn't work, and I used what doublehex told me to use. The type of gameobject was input as 10, which is goober. Is that the problem?

  6. #6
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alright, I'm thinking the problem is with the type of gameobject. What should it be?

  7. #7
    doublehex's Avatar Member
    Reputation
    34
    Join Date
    Mar 2007
    Posts
    385
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the type should be 10


  8. #8
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So then what could be the problem? The script is in the scripts folder, copied exactly the way it should be. I must know, hah; whatever, I'll check for the answer tomorrow.

  9. #9
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Of course it won't work.
    The original script, the player pointer is pPlayer. You're trying to refer to Plr, which doesn't exist in this scope.

    Edit: Wait, scripts folder? Nonono, you need to compile this and place the dll in script_bin.

  10. #10
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, so do I make the code become:
    Code:
    plr->SafeTeleport(0, 0, -8949.95, -132.493, 83.5312);
    Also, when I compile this, where do I put it? Into the folder with the rest of the C++ scripts?

  11. #11
    Gastricpenguin's Avatar Legendary
    Reputation
    980
    Join Date
    Feb 2007
    Posts
    2,236
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anywhere you see "Plr", change it to say "pPlayer".
    Compile the script as a release, then put it in the script_bin folder.
    Life Puzzler WoW - Website | Forums

  12. #12
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, I'm so confused....so the original script from doublehex was correct? And all I needed to do was compile it? Wow, I feel so retarded right now. Thanks everyone for the help!

  13. #13
    TheSpidey's Avatar Elite User
    Reputation
    365
    Join Date
    Jan 2008
    Posts
    2,200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, doublehex's script had a couple of errors as well.
    No { after else, referring to Plr as pPlayer

  14. #14
    guitargod218's Avatar Banned
    Reputation
    61
    Join Date
    Apr 2008
    Posts
    192
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wait, gastric says change it to pPlayer, and Spidey says not to....

  15. #15
    Power of Illuminati's Avatar Contributor
    Reputation
    179
    Join Date
    May 2008
    Posts
    1,410
    Thanks G/R
    6/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think both mean that it should be pPlayer

    And thespidey

    I think he got all } after else. He has just built it up with if, then an else with if in. And conintues with that

    So all } of the else are in the end

    }}}}}}}}

Page 1 of 2 12 LastLast

Similar Threads

  1. Can you guys connect (US)?
    By CronoSword in forum World of Warcraft General
    Replies: 3
    Last Post: 10-14-2010, 05:31 PM
  2. Can you guys rip this?
    By paladinspwn in forum World of Warcraft Exploits
    Replies: 11
    Last Post: 03-03-2009, 07:14 PM
  3. Can you guys post comments
    By Functions in forum WoW Scams Help
    Replies: 5
    Last Post: 08-15-2008, 02:11 PM
  4. Can you guys post some positive comments ?
    By Shadowbreath in forum WoW Scam Prevention
    Replies: 4
    Last Post: 07-07-2008, 01:33 PM
All times are GMT -5. The time now is 12:27 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search