MMOCoin

Likes Likes:  0
Results 1 to 6 of 6

Thread: PVP Script

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Contributor
    StickyIcky's Avatar
    Join Date
    Jul 2008
    Location
    127.0.0.1
    Posts
    747
    Post Thanks / Like
    Rep Power
    20
    Reputation
    188

    PVP Script

    This script is kind of hard to explain.

    When a player kills another player that is not in the same faction as him (Alli vs Horde, Horde vs Alli) he gets 10 gold from the person who died. And also has a 30% chance to get a PVP Token.



    All you have to do is edit the defines that are up top.
    Code:
    //Made by ???
    //Modified by WigSplitta
    //Version 1.1
    
    #include "StdAfx.h"
    #include "Setup.h"
    
    #define GOLD_AMOUNT 100000  //Amount of gold that player gets and victim loses
                                //Example: If you want them to get/lose 100 gold, you take 10000 x 100 which would be 1000000 copper
    #define PVP_TOKEN 29434        //The Item ID of the PVP Token
    #define DROP_CHANCE1 30        //Put the Drop Percent you want
    
    void onPvpKill(Player* plr, Player* victim)
    {
        if( plr->GetTeam() != victim->GetTeam())
        {
            int32 gold_check_p = plr->GetUInt32Value( PLAYER_FIELD_COINAGE );
            int32 gold_check_v = victim->GetUInt32Value( PLAYER_FIELD_COINAGE );
            int32 new_gold_p = gold_check_p + GOLD_AMOUNT;
            int32 new_gold_v;
            if(gold_check_v < GOLD_AMOUNT)
            {
                new_gold_v = 0;
            }
            else
            {
                new_gold_v = gold_check_v - GOLD_AMOUNT;
            }
            plr->SetUInt32Value( PLAYER_FIELD_COINAGE, new_gold_p );
            victim->SetUInt32Value( PLAYER_FIELD_COINAGE, new_gold_v );
    
            int chance = RandomUInt(99)+1;
    #define DROP_CHANCE2 DROP_CHANCE1+1
            if(chance < DROP_CHANCE2) //30% drop rate
                plr->GetItemInterface()->AddItemToFreeSlot(objmgr.CreateItem(PVP_TOKEN, plr));
        }
    }
    void SetupPvPToken(ScriptMgr * mgr)
    {
        mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, (void*)onPvpKill);
    }



  2. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

  3. #2
    Scout

    Join Date
    Jul 2008
    Posts
    19
    Post Thanks / Like
    Rep Power
    18
    Reputation
    12
    Nice script .

  4. #3
    Sergeant

    Join Date
    Jul 2008
    Location
    In Earth
    Posts
    84
    Post Thanks / Like
    Rep Power
    18
    Reputation
    11
    I think GastricPenguin made this<br>

  5. #4
    Contributor
    StickyIcky's Avatar
    Join Date
    Jul 2008
    Location
    127.0.0.1
    Posts
    747
    Post Thanks / Like
    Rep Power
    20
    Reputation
    188
    Well it was from ArcEmu but theirs just added/subtracted gold...

    Mine gives them a "PVP Token" and the gold...

  6. #5
    Scout
    Synthetic's Avatar
    Join Date
    Aug 2008
    Posts
    25
    Post Thanks / Like
    Rep Power
    18
    Reputation
    13
    I've just installed it into my testing server, and it seems not to work, does this have any specific requirements?

  7. #6
    Contributor
    StickyIcky's Avatar
    Join Date
    Jul 2008
    Location
    127.0.0.1
    Posts
    747
    Post Thanks / Like
    Rep Power
    20
    Reputation
    188
    It works in my server...and i use AscentEmu rev 4035 or something like that...

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •