• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Edit Script

Status
Not open for further replies.

ravez

Respected Member
Hey.

I saw you had updated this script Tommy, and here's the updated part;

Code:
class System_OnPvPKill : public PlayerScript
{
public: 
    System_OnPvPKill() : PlayerScript("System_OnPvPKill") { }

struct SystemInfo
{
    uint32 KillStreak;
    uint32 LastGUIDKill;
};

static std::map<uint32, SystemInfo> KillingStreak;
    
void OnPvPKill(Player *pKiller, Player *pVictim)
{
    uint32 kGUID; 
    uint32 vGUID;
    kGUID = pKiller->GetGUID();
    vGUID = pVictim->GetGUID();    
    if(kGUID == vGUID)
        return;
    if(KillingStreak[kGUID].LastGUIDKill == vGUID)
        return;
    KillingStreak[kGUID].KillStreak++;
    KillingStreak[vGUID].KillStreak = 0;
    KillingStreak[kGUID].LastGUIDKill = vGUID;
    KillingStreak[vGUID].LastGUIDKill = 0;
        
    switch(KillingStreak[kGUID].KillStreak)
    {
        char msg[500];
        case 1:
            pKiller->AddItem(49426, 1);
            break;

        case 2:
            pKiller->AddItem(49426, 1);
            break;

        case 3:
            pKiller->AddItem(49426, 1);
            break;

        case 4:
            pKiller->AddItem(49426, 1);
            break;

        case 5:
            pKiller->AddItem(49426, 1);
            break;

        case 6:
            pKiller->AddItem(49426, 1);
            break;

        case 7:
            pKiller->AddItem(49426, 1);
            break;

        case 8:
            pKiller->AddItem(49426, 1);
            break;

        case 9:
            pKiller->AddItem(49426, 1);
            break;

        case 10:
            pKiller->AddItem(49426, 3);
            sprintf(msg, "[PvP System]: %s killed %s and is on a kill streak! ", pKiller->GetName().c_str(), pVictim->GetName().c_str());
            sWorld->SendServerMessage(SERVER_MSG_STRING, msg);
            break;

        case 11:
            pKiller->AddItem(49426, 2);
            break;

        case 12:
            pKiller->AddItem(49426, 2);
            break;

        case 13:
            pKiller->AddItem(49426, 2);
            break;

        case 14:
            pKiller->AddItem(49426, 2);
            break;

        case 15:
            pKiller->AddItem(49426, 2);
            break;

        case 16:
            pKiller->AddItem(49426, 2);
            break;

        case 17:
            pKiller->AddItem(49426, 2);
            break;

        case 18:
            pKiller->AddItem(49426, 2);
            break;

        case 19:
            pKiller->AddItem(49426, 2);
            break;

        case 20:
            pKiller->AddItem(49426, 4);
            sprintf(msg, "[PvP System]: %s killed %s and is on a RaMpAgE! ", pKiller->GetName().c_str(), pVictim->GetName().c_str());
            sWorld->SendServerMessage(SERVER_MSG_STRING, msg);
            break;

        case 21:
            pKiller->AddItem(49426, 3);
            break;

        case 22:
            pKiller->AddItem(49426, 3);
            break;

        case 23:
            pKiller->AddItem(49426, 3);
            break;

        case 24:
            pKiller->AddItem(49426, 3);
            break;

        case 25:
            pKiller->AddItem(49426, 3);
            break;

        case 26:
            pKiller->AddItem(49426, 3);
            break;

        case 27:
            pKiller->AddItem(49426, 3);
            break;

        case 28:
            pKiller->AddItem(49426, 3);
            break;

        case 29:
            pKiller->AddItem(49426, 3);
            break;

        case 30:
            pKiller->AddItem(49426, 5);
            sprintf(msg, "[PvP System]: %s killed %s and is Unstopable! ", pKiller->GetName().c_str(), pVictim->GetName().c_str());
            sWorld->SendServerMessage(SERVER_MSG_STRING, msg);
            break;

        case 31:
            pKiller->AddItem(49426, 4);
            break;

        case 32:
            pKiller->AddItem(49426, 4);
            break;

        case 33:
            pKiller->AddItem(49426, 4);
            break;

        case 34:
            pKiller->AddItem(49426, 4);
            break;

        case 35:
            pKiller->AddItem(49426, 4);
            break;

        case 36:
            pKiller->AddItem(49426, 4);
            break;

        case 37:
            pKiller->AddItem(49426, 4);
            break;

        case 38:
            pKiller->AddItem(49426, 4);
            break;

        case 39:
            pKiller->AddItem(49426, 4);
            break;

        case 40:
            pKiller->AddItem(49426, 6);
            sprintf(msg, "[PvP System]: %s killed %s and is DOMINATING! ", pKiller->GetName().c_str(), pVictim->GetName().c_str());
            sWorld->SendServerMessage(SERVER_MSG_STRING, msg);
            break;

        case 41:
            pKiller->AddItem(49426, 5);
            break;

        case 42:
            pKiller->AddItem(49426, 5);
            break;

        case 43:
            pKiller->AddItem(49426, 5);
            break;

        case 44:
            pKiller->AddItem(49426, 5);
            break;

        case 45:
            pKiller->AddItem(49426, 5);
            break;

        case 46:
            pKiller->AddItem(49426, 5);
            break;

        case 47:
            pKiller->AddItem(49426, 5);
            break;

        case 48:
            pKiller->AddItem(49426, 5);
            break;
        
        case 49:
            pKiller->AddItem(49426, 5);
            break;

        case 50:
            pKiller->AddItem(49426, 7);
            sprintf(msg, "[PvP System]: %s killed %s and is Godlike! ", pKiller->GetName().c_str(), pVictim->GetName().c_str());
            sWorld->SendServerMessage(SERVER_MSG_STRING, msg);
            KillingStreak[kGUID].KillStreak = 0;
            break;
        }
    }
};

void AddSC_System_OnPvPkill()
{
    new System_OnPvPKill;
}

But It's not really working. I compiled fine with no errors, however now when ingame I logged on to two character and killed eachother like 17 times. But there were no announces of killing sprees. So I thought it might conflicted with the token system Trinitycore has built in and I disabled that, but it still didn't work. It didn't even reward Emblem of Frost id 49426 as stated in the script.

Now if It's not too much to ask for, I'm looking for help on what's wrong.

Would it be possible for someone of you to help me, please?

And thank you in advance.
 
Last edited:

Tommy

Founder
Okay, I keep forgetting this Killstreak system has a anti kill the same player over and over again. To stop that either erase:

Code:
        if (KillStreakMap[killer->GetGUID()].lastPlayerKilled == victim->GetGUID())
            return;

Or kill another player to kill the same players you've been killing again.

Anyway, I updated the script. I haven't tested it, perhaps you can give feedback on it.

Code:
struct SystemInfo
{
    uint32 KillStreak;
    uint32 LastGUIDKill;
};

UNORDERED_MAP<uint64, SystemInfo> KillingStreak;

class System_OnPvPKill : public PlayerScript
{
public: 
    System_OnPvPKill() : PlayerScript("System_OnPvPKill") { }
    
    void OnPVPKill(Player* killer, Player* victim)
    {  
        if(killer->GetGUID() == victim->GetGUID())
            return;

        if(KillingStreak[killer->GetGUID()].LastGUIDKill == victim->GetGUID())
           return;

        KillingStreak[killer->GetGUID()].KillStreak++;
        KillingStreak[killer->GetGUID()].LastGUIDKill = victim->GetGUID();

        KillingStreak[victim->GetGUID()].KillStreak = 0;
        KillingStreak[victim->GetGUID()].LastGUIDKill = 0;
        
        switch(KillingStreak[killer->GetGUID()].KillStreak)
        {
            char msg[500];

            case 5:
                killer->AddItem(49426, 3);
                sprintf(msg, "[PvP System]: %s killed %s and is on a kill streak! ", killer->GetName().c_str(), victim->GetName().c_str());
                sWorld->SendServerMessage(SERVER_MSG_STRING, msg);
                break;
            case 10:
                killer->AddItem(49426, 3);
                sprintf(msg, "[PvP System]: %s killed %s and is on a kill streak! ", killer->GetName().c_str(), victim->GetName().c_str());
                sWorld->SendServerMessage(SERVER_MSG_STRING, msg);
                break;
            case 20:
                killer->AddItem(49426, 3);
                sprintf(msg, "[PvP System]: %s killed %s and is on a kill streak! ", killer->GetName().c_str(), victim->GetName().c_str());
                sWorld->SendServerMessage(SERVER_MSG_STRING, msg);
                break;
        }
    }
};

void AddSC_System_OnPvPkill()
{
    new System_OnPvPKill;
}
 
Last edited:

ravez

Respected Member
I don't know why, but I have the same problem here. It compiles fine, no errors. But nothing happens when I kill ingame. I've tried killing both the opposite and same faction but still the same result. It doesn't announce anything, and also doesn't reward me anything.

Anyone else mind testing this and see if it works for you?
 

Parranoia

Insane Member
I don't know why, but I have the same problem here. It compiles fine, no errors. But nothing happens when I kill ingame. I've tried killing both the opposite and same faction but still the same result. It doesn't announce anything, and also doesn't reward me anything.

Anyone else mind testing this and see if it works for you?

Are you killing the same person over and over again?
 

ravez

Respected Member
I am. But still the first kill should reward me as stated in the script?
killer->AddItem(49426, 3);
But it doesn't.

Does it check for IP or something and don't reward that? Because I'm having two WoW clients running at the same time.
 

ravez

Respected Member
What line in the script should I change to OnPVPKill? Because there's a few of them. At first I thought you meant that I should do it on all but that resulted in error.
 

ravez

Respected Member
Still doesn't work. However my line doesn't look exactly like the one you wrote, now mine looks like;

void OnPVPKill(Player* killer, Player* victim)

Yours:

void OnPvPKill(Player *pKiller, Player *pVictim)

I'd just like to know if It's just not working for me. Maybe I'm blaming the script when it in fact works for others. ;P
 
Last edited:

Tommy

Founder
It is suppose to be a capital V in PVP, not "v"..

I hate sensitive shit, didn't catch that at all. :/
 

Tommy

Founder
Works for me.. like we've been saying, make sure you aren't killing the same player over and over again. You need to kill another player to be able to kill any previous player that is in your 'LastGUIDKill' variable.

zh9y.png
 

ravez

Respected Member
Alright, it works, cool!

Thank you for updating this for me, I appreciate your help so much Tommy. You too, Parranoia. Or why not thank the whole community :)
 
Status
Not open for further replies.
Top