Jump to content
  • 0

Problem with my PK announcement.


Question

Posted

- script KillAnnounce -1,{
OnPCKillEvent:
if(getgmlevel() >= 50) end;
if( killedrid == getcharid(3) ) end;
set @killstreak, @killstreak+1;
if (@killstreak == 1){
announce ""+strcharinfo(0)+" had just killed "+rid2name(killedrid)+" at "+strcharinfo(3)+".",bc_all;
}
else {
announce ""+strcharinfo(0)+" had just killed "+rid2name(killedrid)+" at "+strcharinfo(3)+".["+@killstreak+"]",bc_all;
}
attachrid killedrid;
if (@killstreak >= 2){
announce ""+rid2name(killedrid)+" had ended "+strcharinfo(0)+"'s ["+@killstreak+"] streak at "+strcharinfo(3)+".",bc_all;
set @killstreak,0;
}
if (@killstreak < 2){
set @killstreak,0;
}
end;
}

The problem with this is that, if A hit B but didn't kill him, then C killed B, the announcement would announce that A killed B instead of C killing B.. Anyone have any idea where did I did wrong? I'm quite new to scripting :(

1 answer to this question

Recommended Posts

Posted

i suggest you to use OnPCDieEvent instead of using the attachrid to attach the dead player.

- script Sample -1,{
OnPCKillEvent:
if( getgmlevel() >= 50 || killedrid == getcharid(3) ) end;
set @KillStreak,@KillStreak + 1;
announce strcharinfo(0)+" killed "+rid2name(killedrid)+" at "+strcharinfo(3)+". "+( ( @KillStreak > 1 )?"[ Kill Streak : "+@KillStreak+" ]":"" ),bc_all;
end;
OnPCDieEvent:
if( @KillStreak ){
announce rid2name(killerrid)+" ended "+strcharinfo(0)+"'s [ Kill Streak : "+@KillStreak+" ] at "+strcharinfo(3),bc_all;
set @KillStreak,0;
}
end;
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...