ShockwaveDeath modifications to award kills made by shockwave

Questions, comments, and news on the server side plug-ins and it's API
Post Reply
User avatar
Zehra
Private First Class
Private First Class
Posts: 788
Joined: Sun Oct 18, 2015 3:36 pm
Location: Arctic
Contact:

ShockwaveDeath modifications to award kills made by shockwave

Post by Zehra »

Two simple modifications to let the shockwave of shockwaveDeath award kills to the player or killer. (Depending on modification made.)

Find this section of code:

Code: Select all

    // Fire a shockwave where the player died
    float vector[3] = {0, 0, 0};
    bz_fireServerShot("SW", dieData->state.pos, vector);
Change this to this:

Code: Select all

    if((dieData->killerID == 253) && ((dieData->shotID != -1))) {
        uint32_t shotGUID = bz_getShotGUID(dieData->killerID, dieData->shotID);
        if(bz_shotHasMetaData(shotGUID, "killer")) {
          dieData->killerID = bz_getShotMetaDataI(shotGUID, "killer");
        }
    }
   // Fire a shockwave where the player died
    float vector[3] = {0, 0, 0};
    uint32_t shotGUID = bz_fireServerShot("SW", dieData->state.pos, vector, dieData->team);
    bz_setShotMetaData(shotGUID, "killer", dieData->playerID);
Or change it to this to award kills to the killer.

Code: Select all

    if((dieData->killerID == 253) && ((dieData->shotID != -1))) {
        uint32_t shotGUID = bz_getShotGUID(dieData->killerID, dieData->shotID);
        if(bz_shotHasMetaData(shotGUID, "killer")) {
          dieData->killerID = bz_getShotMetaDataI(shotGUID, "killer");
        }
    }
    // Fire a shockwave where the player died
    if ((dieData->killerID != BZ_SERVER) && (dieData->shotID != -1)) {
        float vector[3] = {0, 0, 0};
        uint32_t shotGUID = bz_fireServerShot("SW", dieData->state.pos, vector, dieData->killerTeam);
        bz_setShotMetaData(shotGUID, "killer", dieData->killerID);
    } else {
        bz_fireServerShot("SW", dieData->state.pos, vector);
    }
Feel free to ask any questions or make suggestions.

-Zehra
Those who are critical of me, I'll likely be the same of them. ~Zehra
The decisions we make are the ones we look forward too and the ones we regret. ~Zehra
There's a difference between knowing my name and knowing me, one shows respect to my name and the other is to who I am. ~Zehra

See where I've last been active at Strayers.
Visit BZList.net for a modern HTML5 server stats site.

Click here to view the 101 Leaderboard & Score Summaries Last updated 2021-01-12 (YYYY-MM-DD)
Latest 101 thread
Post Reply