[Help] Why won't this lua load? menu

User Tag List

Results 1 to 6 of 6
  1. #1
    MisterEMU's Avatar Banned
    Reputation
    38
    Join Date
    Feb 2008
    Posts
    307
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Help] Why won't this lua load?

    Anti PvP guard

    error says: unexpected symbol near '/'


    Code:
    /******************************************************/
    /*                    Anti PVP guard                  */
    /*                    By optical                      */
    /*                    Redistribution prohibited       */
    /******************************************************/
    #include "StdAfx.h"
    void OnEnterCombat(Player *pPlayer, Unit *pTarget); //Function Header
    extern "C" SCRIPT_DECL uint32 _exp_get_version()
    {
        return MAKE_SCRIPT_VERSION(SCRIPTLIB_VERSION_MAJOR, SCRIPTLIB_VERSION_MINOR);
    }
    
    extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
    {
         ::sScriptMgr.register_hook(SERVER_HOOK_EVENT_ON_ENTER_COMBAT, OnEnterCombat);
    }
    #ifdef WIN32
    
    BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved )
    {
        return TRUE;
    }
    
    #endif
    
    #define NOPVPGUARD 1 //ID for the anti PVP creature
    #define MAX_DISTANCE 70.0 //Distance they must be within for the guard to agro
    #define KILL_SPELL 5 //The spell used when they get agro - death touch
    #define UNIT_INSTANT true //Instant cast spell? true or false
    unsigned Zones[4] = { 33,440,618,3523,130 }; //STV,Tanaris,winterspring,netherstorm, Pyrewood Village
    void OnEnterCombat(Player *pPlayer, Unit *pTarget)
    {
        bool InZone = false;
        for (int C = 0; C < 4; C++) 
            {
            if (pPlayer->GetZoneId() == Zones[C]) {InZone = true;}
            }
        if (InZone == false) {return;}
        Creature *pCreature = pPlayer->GetMapMgr()->GetSqlIdCreature(NOPVPGUARD);
        if (!pCreature) {return;} //No creature found, handle gracefully and return
        float dist = pCreature->CalcDistance(pPlayer->GetPositionX(),pPlayer->GetPositionY(),pPlayer->GetPositionZ());
        if (dist <= MAX_DISTANCE)
            {
            Unit *pUnit = (Unit *)pPlayer; //Cast the pointer to a Unit object
            pCreature->GetAIInterface()->AttackReaction(pUnit,0,0); //Attack! (not sure about the second and third params here, set to 0 to be safe
            if (KILL_SPELL != NULL)
                pCreature->CastSpell(pUnit,KILL_SPELL,UNIT_INSTANT);
            }
    }

    [Help] Why won't this lua load?
  2. #2
    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)
    This is not Lua, this is C++..
    Also
    unsigned Zones[4] = { 33,440,618,3523,130 };
    You define the array as length 4 but try to add 5 items.

  3. #3
    MisterEMU's Avatar Banned
    Reputation
    38
    Join Date
    Feb 2008
    Posts
    307
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok ty +Rep also do you know how to add items to a chest?

  4. #4
    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)
    Try the Gameobject_loot table.
    Don't forget to make the chest an actual chest in gameobject_names
    Last edited by TheSpidey; 05-23-2008 at 09:41 PM.

  5. #5
    MisterEMU's Avatar Banned
    Reputation
    38
    Join Date
    Feb 2008
    Posts
    307
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried =( need to spread

  6. #6
    AfterMidnight's Avatar Banned
    Reputation
    162
    Join Date
    Jan 2008
    Posts
    689
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by MisterEMU View Post
    I tried =( need to spread
    Offtopic/ Rep'd him 4 u.
    Ontopic/ Goodluck ^^

Similar Threads

  1. <help> look at this lua
    By runiker in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 06-23-2008, 11:01 AM
  2. (help) why does this keep appearing?
    By runemaster in forum World of Warcraft Emulator Servers
    Replies: 16
    Last Post: 05-20-2008, 08:12 PM
  3. Why dosent this lua work ? cant find it
    By Summer in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 05-07-2008, 02:35 PM
  4. Help with this LUA script
    By jordash in forum World of Warcraft Emulator Servers
    Replies: 7
    Last Post: 03-08-2008, 04:19 PM
  5. [HELP!] What are the Value's in this LUA?
    By Creepfold in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 02-27-2008, 11:28 AM
All times are GMT -5. The time now is 10:20 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