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

[Trinity C++] Need help to make a Killstreak System

Status
Not open for further replies.

Synth

Exalted Member
Hello Emudevs,as title say i want somone to help me for i make my own killstreak system i try to use Parranoia script but have compile errors so i use Rochet2 one fixed but it crash the server when you kill 5 players or more.

Rochet2 script:
KillStreak - C++ - Pastebin

I want the script:
●Announce to players when the player pass 10,20,30,40,50 kills each case will have a message.(I can fix message text)
●I want when the player pass 10,20,30,40 kills recive a reward item nevermind what is.(I can fix item counts and modify items)
●When the player get 50 kills get 25 arena points + the reward item one,and ofc a global message to server said:Tommy kill Synth and is on rampage.(I can fix message text)


Can anyone explain me how i can do that and what is the code?
I try to watch a viedo by nomsoft on youtube about Killstreak i like it but there is no message when the player pass 10,20 kills or something.

Thank you very much!
Best regards,
Synth !
 
Last edited:

Synth

Exalted Member
Awesome thanks for do this,but i have a simple problem:
First this one works perfectly:
http://emudevs.com/showthread.php/977-Edit-Script?p=5655&viewfull=1#post5655
But now the problem here first i add a money cost for killer and a check if the victim have gold amount,but nothing work 0 errors on compile but in-game won't work so when i kill a player i don't recive anything or get gold,i just add it for the first case for i test it you can check it out and tell me what's the problem please?
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)
{
    uint32 kGUID; 
    uint32 vGUID;
    kGUID = killer->GetGUID();
    vGUID = victim->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:
        if (victim->GetMoney() > 10000)
        {
        killer->ModifyMoney(killer->GetMoney() + 10000);
        victim->ModifyMoney(-10000);
        }
    	else
		{
         killer->GetSession()->SendNotification("This player doesn't have enough gold to give!");
            }
            break;

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

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

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

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

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

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

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

        case 9:
            killer->AddItem(49426, 1);
            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 11:
            killer->AddItem(49426, 2);
            break;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void AddSC_System_OnPvPkill()
{
    new System_OnPvPKill;
}

Thank you :smile:
 

Tommy

Founder
You need to kill another player after killing your previous player to receive more things. Make sure you aren't killing the same player over and over again, because there's a check for that.
 

Synth

Exalted Member
You need to kill another player after killing your previous player to receive more things. Make sure you aren't killing the same player over and over again, because there's a check for that.
Yep i do that for first one it works fine,but 2nd one don't give any rewards or something i try same way.
 

Tommy

Founder
Are you sure the victim has gold greater than 10g? Since you don't have ">=", it will have to be greater than 10g for it to go through with the process. You can change it to:

Code:
if (victim->GetMoney() >[COLOR=#00ff00]=[/COLOR] 10000)
 

Synth

Exalted Member
Are you sure the victim has gold greater than 10g? Since you don't have ">=", it will have to be greater than 10g for it to go through with the process. You can change it to:

Code:
if (victim->GetMoney() >[COLOR=#00ff00]=[/COLOR] 10000)
Alright i change it then i re-compile nothing happen,i don't think that is the problem the script not working at all 0 error on compile but in-game won't work.
I do everything right:
*I added to cmake.
*I added to scriptloader.
*I added to scripts.
 

Tommy

Founder
Alright i change it then i re-compile nothing happen,i don't think that is the problem the script not working at all 0 error on compile but in-game won't work.
I do everything right:
*I added to cmake.
*I added to scriptloader.
*I added to scripts.

Oh, I wish you wouldn't have picked up that example. XD

This is why it won't work, the "v" in "OnPvPKill" needs to be a capital "V". Stupid case sensitive crap. :/

Code:
void OnP[COLOR=#00ff00]V[/COLOR]PKill(Player *killer, Player *victim)
 

Synth

Exalted Member
Oh, I wish you wouldn't have picked up that example. XD

This is why it won't work, the "v" in "OnPvPKill" needs to be a capital "V". Stupid case sensitive crap. :/

Code:
void OnP[COLOR=#00ff00]V[/COLOR]PKill(Player *killer, Player *victim)
I saw that is the problem :p
Thank you man :smile:
You can marked solved.
 
Status
Not open for further replies.
Top