Jump to content
  • 0

Request for a simple PVP Announcer..


Question

Posted

I've seen a lot of PvP Announcers including AnnieRuru's Dota announcer, but I'm wondering if anyone could make me a simple one?

Basically what I'm using now only announces : Player 1 has killed Player 2 in xxx_fild01.

But I'm wondering if anyone could teach me how to let it show the streak of the kills behind the announcement, such as : Player 1 has killed Player 2 in xxx_fild01. [10]

Hopefully someone could help me with this. Thanks in advance.

6 answers to this question

Recommended Posts

Posted

Here a reduce version of script that I'm using, it's only for SQL all stats can be saved.

SQL lines to add in your data :

//ALTER TABLE `char` ADD COLUMN `pvp_Kill` INTEGER UNSIGNED NOT NULL DEFAULT '0' AFTER `rename`;
//ALTER TABLE `char` ADD COLUMN `pvp_Death` INTEGER UNSIGNED NOT NULL DEFAULT '0' AFTER `rename`;

-    script    C_login    -1,{


OnInit:

//For set map used
setarray $pvpmap$[0],"pvp_map1","pvp_map2","pvp_map3";


OnPCDieEvent:

getmapxy @map$,@x,@y,0;

//For PvP maps
  for( set .@i, 0; .@i < getarraysize($pvpmap$); set .@i, .@i +1 )
   if (@map$ == $pvpmap$[.@i]) {

       set .@p,getcharid(0); //Char ID
       set .@q,strcharinfo(0); //Char ID

//For killstreak, you can add more lines - Change announce.

       set @killstreak,0;
       set @deathstreak,@deathstreak+1;
       if (@deathstreak == 5) {mapannounce ""+@map$+"",""+.@q+" : ["+@deathstreak+"] Kills without be killed !",bc_map;}
       if (@deathstreak == 10) {mapannounce ""+@map$+"",""+.@q+" : ["+@deathstreak+"] Kills without be killed !",bc_map;}
       if (@deathstreak == 15) {mapannounce ""+@map$+"",""+.@q+" : ["+@deathstreak+"] Kills without be killed !",bc_map;}
       if (@deathstreak == 20) {mapannounce ""+@map$+"",""+.@q+" : ["+@deathstreak+"] Kills without be killed !",bc_map;}

       //Par Joueur
       query_sql("SELECT `pvp_Death` FROM `char` WHERE `char_id` = '"+.@p+"'",.@countL); //Check name
       setarray .@countL[0],.@countL[0]+1;
       query_sql "UPDATE `char` SET `pvp_Death` = '"+.@countL[0]+"' WHERE `char_id` ='"+.@p+"'";
       }

   //============================= Bottom

       if(killerrid==0) {dispbottom "You just killed yourself.";end;}
       set @killer$, rid2name(killerrid);
       dispbottom "You have been killed by "+@killer$+"!";
       end;

   //=================================================================================

OnPCKillEvent:


getmapxy @map$,@x,@y,0;

  for( set .@i, 0; .@i < getarraysize($pvpmap$); set .@i, .@i +1 )
   if (@map$ == $pvpmap$[.@i]) {

       set .@x,getcharid(0); //Char ID
       set .@y,strcharinfo(0);

       set @deathstreak,0;
       set @killstreak,@killstreak+1;
       if (@killstreak == 5) {mapannounce ""+@map$+"",""+.@y+" : ["+@killstreak+"] died without kill !",bc_map;}
       if (@killstreak == 10) {mapannounce ""+@map$+"",""+.@y+" : ["+@killstreak+"] died without kill !",bc_map;}
       if (@killstreak == 15) {mapannounce ""+@map$+"",""+.@y+" : ["+@killstreak+"] died without kill !",bc_map;}
       if (@killstreak == 20) {mapannounce ""+@map$+"",""+.@y+" : ["+@killstreak+"] died without kill !",bc_map;}

       //Par Joueur
       query_sql("SELECT `pvp_Kill` FROM `char` WHERE `char_id` = '"+.@x+"'",.@countX); //Verif le nom
       setarray .@countX[0],.@countX[0]+1;
       query_sql "UPDATE `char` SET `pvp_Kill` = '"+.@countX[0]+"' WHERE `char_id` ='"+.@x+"'";
       }


   //============================= Bottom

  	 set @killed$, rid2name(killedrid);
       if(strcharinfo(0)==@killed$) {end;}
       dispbottom "You have kill "+@killed$+"!";
       end;

}

Posted

Erm..I've got some question regarding that.. I've made the sql addition, and i've edited some of the script for that.. but seems like every time i kill 1 player, it announces that i killed that player 3 times..and the kill count increases 3 in the sql..

This is basically my script.. can you have a look at it? Thank you..

- script C_login -1,{

OnInit:
//For set map used
setarray $pvpmap$[0],"izlude","pvp_map2","pvp_map3";

OnPCKillEvent:

getmapxy @map$,@x,@y,0;
 for( set .@i, 0; .@i < getarraysize($pvpmap$); set .@i, .@i +1 )
if (@map$ == $pvpmap$[.@]) {
 set .@x,getcharid(0); //Char ID
 set .@y,strcharinfo(0);
 set @deathstreak,0;
 set @killstreak,@killstreak+1;
 if (@killstreak >= 1) {announce ""+.@y+" had just killed "+rid2name(killedrid)+" at "+strcharinfo(3)+".["+@killstreak+"]",bc_map;}
//Par Joueur
 query_sql("SELECT `pvp_Kill` FROM `char` WHERE `char_id` = '"+.@x+"'",.@countX); //Verif le nom
 setarray .@countX[0],.@countX[0]+1;
 query_sql "UPDATE `char` SET `pvp_Kill` = '"+.@countX[0]+"' WHERE `char_id` ='"+.@x+"'";
 }
}

Posted

You need to add the OnPCDieEvent: for reset the killstreak value. You can also add a trigger to reset the value if the player leave the map. With a @ variable kind, the value is only rested when you log out.

But with this part of script, I don't see why it adds 3 kills per kill if there is no other . Reduce the

setarray $pvpmap$[0],"izlude","pvp_map2","pvp_map3";

to

setarray $pvpmap$[0],"izlude";
Posted

did you duplicated the script ? or loaded it several times ? both condition i mention will also result in wrong kill count increment...

coz i also experienced this problem last time..xD

the kill counter increase alot due to the duplicated wrong npc / method..

Posted

@Emistry , I only have 1 script for this pvp announcer.. what do you mean by loaded it several times? Sorry, I'm quite new on these stuffs.. :)

@Aerie , Erm..it doesn't fix it..it still announces 3 times when I only kill the opponent once..

This is the edited script..

- script C_login -1,{

OnInit:
setarray $pvpmap$[0],"izlude";

OnPCKillEvent:
getmapxy .@map$, .@x, .@y, 0;
 for( set .@i, 0; .@i < getarraysize($pvpmap$); set .@i, .@i +1 )
if (@map$ == $pvpmap$[.@]) {

 set @killstreak, @killstreak + 1;
 if (@killstreak <= 3) {announce ""+strcharinfo(0)+" had just killed "+rid2name(killedrid)+" at "+strcharinfo(3)+".",bc_map;}
 if (@killstreak >= 3) {announce ""+strcharinfo(0)+" had just killed "+rid2name(killedrid)+" at "+strcharinfo(3)+".["+@killstreak+"]",bc_all;}

}
OnPCDieEvent: 
getmapxy @map$,@x,@y,0;
 for( set .@i, 0; .@i < getarraysize($pvpmap$); set .@i, .@i +1 )
if (@map$ == $pvpmap$[.@i]) {
 if (@killstreak >= 3) {announce ""+rid2name(killedrid)+" had just ended "+strcharinfo(0)+"'s ["+@killstreak+"] streak at "+strcharinfo(3)+".",bc_all;}
 set @killstreak,0;
}
}

Any idea what seems to be the problem? /no1

Thank you for you helps ^_^ I found out a way to make it work..as simple as i wanted ^_^ Thanks guys..

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...