What is wrong with this code menu

User Tag List

Results 1 to 6 of 6
  1. #1
    Nokia123's Avatar Member
    Reputation
    1
    Join Date
    Dec 2007
    Posts
    36
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is wrong with this code

    Hello, I am making a script so when you accept a duel, You get your hp,mana restored. Also your cooldowns will be reset.
    But for some reason, it isnt working. And I cant figure out why.
    This is my duelhandler.cpp

    /*
    * Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
    * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
    *
    * This program is free software; you can redistribute it and/or modify it
    * under the terms of the GNU General Public License as published by the
    * Free Software Foundation; either version 2 of the License, or (at your
    * option) any later version.
    *
    * This program is distributed in the hope that it will be useful, but WITHOUT
    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
    * more details.
    *
    * You should have received a copy of the GNU General Public License along
    * with this program. If not, see <http://www.gnu.org/licenses/>.
    */

    #include "Common.h"
    #include "WorldPacket.h"
    #include "WorldSession.h"
    #include "Log.h"
    #include "Opcodes.h"
    #include "UpdateData.h"
    #include "Player.h"

    void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
    {
    uint64 guid;
    Player* player;
    Player* plTarget;

    recvPacket >> guid;

    if (!GetPlayer()->duel) // ignore accept from duel-sender
    return;

    player = GetPlayer();
    plTarget = player->duel->opponent;

    if (player == player->duel->initiator || !plTarget || player == plTarget || player->duel->startTime != 0 || plTarget->duel->startTime != 0)
    return;

    //sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_DUEL_ACCEPTED");
    sLog->outStaticDebug("Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName());
    sLog->outStaticDebug("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName());

    time_t now = time(NULL);
    player->duel->startTimer = now;
    plTarget->duel->startTimer = now;
    player->SendDuelCountdown(3000);
    plTarget->SendDuelCountdown(3000);
    player->RemoveAllSpellCooldown(); // IT STARTS HERE
    plTarget->RemoveAllSpellCooldown();
    player->SetHealth(pl->GetMaxHealth());
    player->SetPower(POWER_MANA, pl->GetMaxPower(POWER_MANA));
    plTarget->SetHealth(plTarget->GetMaxHealth());
    plTarget->SetPower(POWER_MANA, plTarget->GetMaxPower(POWER_MANA));
    }
    void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)
    {
    sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_DUEL_CANCELLED");
    uint64 guid;
    recvPacket >> guid;

    // no duel requested
    if (!GetPlayer()->duel)
    return;

    // player surrendered in a duel using /forfeit
    if (GetPlayer()->duel->startTime != 0)
    {
    GetPlayer()->CombatStopWithPets(true);
    if (GetPlayer()->duel->opponent)
    GetPlayer()->duel->opponent->CombatStopWithPets(true);

    GetPlayer()->CastSpell(GetPlayer(), 7267, true); // beg
    GetPlayer()->DuelComplete(DUEL_WON);
    return;
    }

    GetPlayer()->DuelComplete(DUEL_INTERRUPTED);
    }
    What is wrong with the code?

    What is wrong with this code
  2. #2
    DoxramosPS's Avatar Knight
    Reputation
    26
    Join Date
    Aug 2010
    Posts
    214
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code looks fine; make sure you replace the whole server not just the mangosd.exe; also; your inbox is full. Email me at [email protected]
    Mangos and Trinity Emulation
    Windows | Linux
    Under Development : morgangreen.org WoW CMS Site

  3. #3
    Nokia123's Avatar Member
    Reputation
    1
    Join Date
    Dec 2007
    Posts
    36
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now I got room in my inbox.
    Also I use trinitycore on Linux.

  4. #4
    XxXGenesisXxX's Avatar Sergeant Major
    Reputation
    67
    Join Date
    Apr 2012
    Posts
    154
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What's it doing wrong?

  5. #5
    Nokia123's Avatar Member
    Reputation
    1
    Join Date
    Dec 2007
    Posts
    36
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It dont reset the hp or cooldowns.

  6. #6
    LilleCarl's Avatar Active Member
    Reputation
    65
    Join Date
    Feb 2008
    Posts
    132
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Debug question: Do your health and mana change? Otherwise you have not applied the code. (make install not just make)
    Violence doesn't solve shit, but everything else.

Similar Threads

  1. What's wrong with this code?
    By Iaccidentallytwink in forum WoW UI, Macros and Talent Specs
    Replies: 1
    Last Post: 09-01-2012, 01:39 AM
  2. What is wrong with this item teleportation Lua script ?
    By Wheeze201 in forum WoW EMU Questions & Requests
    Replies: 6
    Last Post: 08-13-2009, 08:50 AM
  3. What is wrong with this script?
    By XxCyanidexX in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 03-01-2009, 12:13 PM
  4. [helpzerz] What is wrong with this lua script?
    By w21froster in forum World of Warcraft Emulator Servers
    Replies: 8
    Last Post: 05-21-2008, 09:45 PM
  5. [Need help] What's wrong with this script?
    By Arthas117 in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 01-10-2008, 02:04 PM
All times are GMT -5. The time now is 12:19 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