[Request] Area Based PvP Tokens menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    LTGH's Avatar Member
    Reputation
    35
    Join Date
    Jul 2007
    Posts
    309
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Request] Area Based PvP Tokens

    Hi im wondering if there is a LUA script that makes so if i kill someone in a special Area ( In this case, Azshara Crater ( Entry ID 37 )) you get an Item.
    The character you kill must be from another faction, Same or higher level.
    So, im searching for an script that gives you one PvP Token if you kill someone in Azshara crater with same or higher level and is from an different faction.

    I would also want it to check if you have a quest. Lets say i have a quest calld ( Horde ), when i kill someone it checks if i have a quest calld ( Horde ) and if i have it i get the token and if i dont, i dont get a token. Hope you understand what im trying to say.

    I hope someone can help me out cus this is needed for what im working on.
    Thnx in future.

    [Request] Area Based PvP Tokens
  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)
    I don't think you can do it with Lua, unless Lua++ added hook support to Lua.
    C++ is the way

    Hang on, i'll hook you up with something

    Edit: Here we go
    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    //This function is taken from Spectre's PvP Script, which can be seen at the AspireScripts SVN
    // svn://svn.aspiredev.org/AspireDev
    //<3
    void AddItem(Player* Plr, const uint32 &ItemID, const uint32 &Amt, const bool &Stack)
    {
    	Item *ItemToAdd;
    	SlotResult Slot;
    	
    	if(Plr == NULL)
    		return;
    	if(Stack)
    	{
    		ItemToAdd = Plr->GetItemInterface()->FindItemLessMax(ItemID, Amt, false);
    		if(ItemToAdd != NULL)
    		{
    			ItemToAdd->ModUnsigned32Value(ITEM_FIELD_STACK_COUNT, Amt);
    			ItemToAdd->m_isDirty = true;
    			Plr->BroadcastMessage("%s%s x%u Awarded", MSG_COLOR_GOLD, ItemToAdd->GetProto()->Name1, Amt);
    			return;
    		}
    			
    	}
    	for(uint32 i = 1;i <= Amt;i++)
    	{
    		ItemToAdd = objmgr.CreateItem(ItemID, Plr);
    		
    		if(ItemToAdd == NULL)
    			return; // failed creation, no memory to allocate, or invalid item id
    
    		Slot = Plr->GetItemInterface()->FindFreeInventorySlot(ItemToAdd->GetProto());
    
    		if(Slot.Result)
    		{
    			Plr->GetItemInterface()->SafeAddItem(ItemID, Slot.ContainerSlot, Slot.Slot);
    			Plr->BroadcastMessage("%s%s x1 Awarded", MSG_COLOR_GOLD, ItemToAdd->GetProto()->Name1);
    		}
    		else
    			Plr->BroadcastMessage("No free inventory slots could be located, aborting");
    	}
    
    }
    
    void OnKill(Player* pPlayer, Player* pVictim)
    {
    	if(pPlayer->GetMapId() != 37 || pVictim->GetMapId() != 37)
    		return; //Both players need to be at map 37
    	
    	if(pPlayer->GetLowGUID() == pVictim->GetLowGUID())
    		return; //No award for suicide
    	
    	if(pVictim->getLevel() < pPlayer->getLevel())
    		return; //Only kill your own level and above
    	
    	if(pPlayer->GetTeam() == pVictim->GetTeam())
    		return; //Only kill from the other faction
    	
    	//Now we check if pPlayer has the quest in his log
    	for(int i = 0; i < 25; i++)
    	{
    		if(pPlayer->m_questlog[i]->GetQuest()->id == 12345)
    		{
    			//Found the quest, let's add the item
    			AddItem(pPlayer, 12345, 1, true);
    			//The function's parameters are, by order:
    			//Player pointer, Item ID, Amount to give, Do we stack the item
    			return;
    		}
    	}
    }
    
    void SetupPVPScript(ScriptMgr* mgr)
    {
    	mgr->register_hook(SERVER_HOOK_EVENT_ON_PLAYER_KILL, (void*)&OnKill);
    }
    Last edited by TheSpidey; 08-03-2008 at 09:20 AM.

  3. #3
    LTGH's Avatar Member
    Reputation
    35
    Join Date
    Jul 2007
    Posts
    309
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Omfg. This is so epix, i love you
    +rep

    Edit:
    I've tryed it and it doesnt work, im 100% sure im done something wrong so could you please check what i've done wrong?
    ( I removed the Quest Part Becouse the quest doesnt exist yet )
    Code:
    #include "StdAfx.h"
    #include "Setup.h"
    
    //This function is taken from Spectre's PvP Script, which can be seen at the AspireScripts SVN
    // svn://svn.aspiredev.org/AspireDev
    //<3
    void AddItem(Player* Plr, const uint32 &ItemID, const uint32 &Amt, const bool &Stack)
    {
    	Item *ItemToAdd;
    	SlotResult Slot;
    	
    	if(Plr == NULL)
    		return;
    	if(Stack)
    	{
    		ItemToAdd = Plr->GetItemInterface()->FindItemLessMax(999000, 1, false);
    		if(ItemToAdd != NULL)
    		{
    			ItemToAdd->ModUnsigned32Value(ITEM_FIELD_STACK_COUNT, Amt);
    			ItemToAdd->m_isDirty = true;
    			Plr->BroadcastMessage("%s%s x%u Awarded", MSG_COLOR_GOLD, ItemToAdd->GetProto()->Name1, Amt);
    			return;
    		}
    			
    	}
    	for(uint32 i = 1;i <= Amt;i++)
    	{
    		ItemToAdd = objmgr.CreateItem(999000, Plr);
    		
    		if(ItemToAdd == NULL)
    			return; // failed creation, no memory to allocate, or invalid item id
    
    		Slot = Plr->GetItemInterface()->FindFreeInventorySlot(ItemToAdd->GetProto());
    
    		if(Slot.Result)
    		{
    			Plr->GetItemInterface()->SafeAddItem(ItemID, Slot.ContainerSlot, Slot.Slot);
    			Plr->BroadcastMessage("%s%s x1 Awarded", MSG_COLOR_GOLD, ItemToAdd->GetProto()->Name1);
    		}
    		else
    			Plr->BroadcastMessage("No free inventory slots could be located, aborting");
    	}
    
    }
    
    void OnKill(Player* pPlayer, Player* pVictim)
    {
    	if(pPlayer->GetMapId() != 37 || pVictim->GetMapId() != 37)
    		return; //Both players need to be at map 37
    	
    	if(pPlayer->GetLowGUID() == pVictim->GetLowGUID())
    		return; //No award for suicide
    	
    	if(pVictim->getLevel() < pPlayer->getLevel())
    		return; //Only kill your own level and above
    	
    	if(pPlayer->GetTeam() == pVictim->GetTeam())
    		return; //Only kill from the other faction
    	
    	
    }
    
    void SetupPVPScript(ScriptMgr* mgr)
    {
    	mgr->register_hook(SERVER_HOOK_EVENT_ON_PLAYER_KILL, (void*)&OnKill);
    }
    BTW: i only have to save it as an .LUA file and save it in scripts, right? First time i used a script so im not sure how to do.
    Last edited by LTGH; 08-03-2008 at 03:09 PM.

  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)
    First of all, this is C++ and not Lua. You need to compile it and place the dll in the scripts_bin folder. There are plenty of guides explaining how to do so.

    Second, when you removed the quest part you also removed the line that actually gave the attacker the token, AddItem

  5. #5
    LTGH's Avatar Member
    Reputation
    35
    Join Date
    Jul 2007
    Posts
    309
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ohh.. Okey thnx for the information. I was really confused cus i never used something like this. Im only working with the SQL Database and such.
    Anyway, the quest is added now so i guess i just have to compile it.
    Another guide, another problem.
    Thnx for the help ^^

    Edit: Readed Sectorsevens guide and i didnt understand a single part of it..
    I guess its cus im tired... 0:30AM... Time to sleep and try to figure it out tomorrow...
    Last edited by LTGH; 08-03-2008 at 05:28 PM.

  6. #6
    Fan Boi's Avatar Member
    Reputation
    5
    Join Date
    Jul 2008
    Posts
    65
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You've gotta know how to compile your core before scripts.

  7. #7
    LTGH's Avatar Member
    Reputation
    35
    Join Date
    Jul 2007
    Posts
    309
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okey...?
    I have never ever used a script... so i think this will be hard...

    Edit: I got "Microsoft Visual C++ 2008 Express Edition" 30 days some months ago so i have no idea what to do now :'(
    Is it possible to compile without MV C++ 2008, in an easy way?.. cus i dont wanna spend to much time of my project in this.

    edit 2: this maybe is a stupid question, but i wonder if anyone could fix so it check if you killed a specefic race, like, you have to kill a tauren to get the token.
    Thnx in future.
    Last edited by LTGH; 08-04-2008 at 05:03 AM.

  8. #8
    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)
    if(pVictim->getRace() != RACE_TAUREN)
    return;

  9. #9
    LTGH's Avatar Member
    Reputation
    35
    Join Date
    Jul 2007
    Posts
    309
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thnx ^_^
    Now i just have to figure out if its possible to compile without Visual C++...
    Cus i do not want download a cracked version of it...
    Stupid 30 days try t_t

  10. #10
    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)
    Microsoft is offering it for free, search for the free version.

  11. #11
    LTGH's Avatar Member
    Reputation
    35
    Join Date
    Jul 2007
    Posts
    309
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ohh, really
    Thnx. ^^ +rep if i find it.

  12. #12
    arley's Avatar Active Member
    Reputation
    25
    Join Date
    Jun 2008
    Posts
    112
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  13. #13
    LTGH's Avatar Member
    Reputation
    35
    Join Date
    Jul 2007
    Posts
    309
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it was there i downloaded it and after 30 days, i have to pay. :S

  14. #14
    Fan Boi's Avatar Member
    Reputation
    5
    Join Date
    Jul 2008
    Posts
    65
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, you just register and its still free.

  15. #15
    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 you don't. You need to register, which is totally free.

Page 1 of 2 12 LastLast

Similar Threads

  1. [Request..?] Area changing
    By EcHoEs in forum WoW ME Questions and Requests
    Replies: 3
    Last Post: 02-10-2008, 05:25 AM
  2. PvP Token System!
    By Performer in forum World of Warcraft Emulator Servers
    Replies: 6
    Last Post: 02-03-2008, 03:42 PM
  3. [REQUEST] any horde pvp mount to Attumen's Mount
    By domosauce in forum WoW ME Questions and Requests
    Replies: 1
    Last Post: 12-25-2007, 03:46 PM
  4. [Request] Dreadsteed - Alliance PVP mounts.
    By Rainmaker in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 10-13-2007, 02:25 PM
  5. How to gank in Area 52.[PvP Servers]
    By Duplicity in forum World of Warcraft Exploits
    Replies: 7
    Last Post: 03-08-2007, 11:27 AM
All times are GMT -5. The time now is 06:55 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