Raised This Month: $ Target: $400
 0% 

what best method detect triple kill per time?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
login_xcvop
Member
Join Date: Nov 2013
Old 01-25-2014 , 05:49   what best method detect triple kill per time?
Reply With Quote #1

what best method detect triple kill per time?

i can't search forum this !

Last edited by login_xcvop; 01-25-2014 at 06:17.
login_xcvop is offline
CyberStars
Senior Member
Join Date: May 2013
Old 01-25-2014 , 07:27   Re: what best method detect triple kill per time?
Reply With Quote #2

You can register event for "DeathMsg" and calculate how many enemies the player kills during some period of time.
CyberStars is offline
login_xcvop
Member
Join Date: Nov 2013
Old 01-25-2014 , 11:15   Re: what best method detect triple kill per time?
Reply With Quote #3

Quote:
Originally Posted by CyberStars View Post
You can register event for "DeathMsg" and calculate how many enemies the player kills during some period of time.

show
login_xcvop is offline
CyberStars
Senior Member
Join Date: May 2013
Old 01-29-2014 , 02:46   Re: what best method detect triple kill per time?
Reply With Quote #4

Quote:
Originally Posted by login_xcvop View Post
show
Code:
new times[33] = {0, ...};
new killCount[33] = {0, ...};

public plugin_init()
{
          register_event("DeathMsg", "PlayerKilled", "a");
	  register_logevent("RoundStart",2,"1=Round_Start");
}

public RoundStart()
{
          for(new i=0; i<sizeof(times); i++) {
                   times[i] = get_systime();
                   killCount[i] = 0;
          }
}

public PlayerKilled()
{ 
	new killerIndx = read_data(1);
        if(0 < killerIndx) {
                 if(0 < killCount[killerIndx]) {
                          new currTime = get_systime();
                          // Check if the kills interval is within 90 sec.
                          if(90 >= currTime - times[killerIndx]) {
                                    killCount[killerIndx]++;
                          } else {
                                    killCount[killerIndx] = 1;
                                    times[killerIndx] = currTime;
                          }
                 } else {
                          killCount[killerIndx] = 1;
                          times[killerIndx] = get_systime();
                 }

                 if(3 <= killCount[killerIndx]) {
                          // Triple Kill within 90 sec.
                 }
	}
}
CyberStars is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 01-25-2014 , 09:01   Re: what best method detect triple kill per time?
Reply With Quote #5

Quote:
Originally Posted by login_xcvop View Post
what best method detect triple kill per time?

i can't search forum this !
See the MiscStats for this, or StatsX, this has double kill feature and you can perfectly add to check the Triple Kill
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
login_xcvop
Member
Join Date: Nov 2013
Old 01-29-2014 , 03:16   Re: what best method detect triple kill per time?
Reply With Quote #6

if i wanna add double kill ? and reset killCount per 3seconds, set task ?
PHP Code:
        if(<= killCount[killerIndx]) 
        {
                          
// double
        
}

        if(
<= killCount[killerIndx]) 
        {
                          
// triple
        


Last edited by login_xcvop; 01-29-2014 at 03:17.
login_xcvop is offline
CyberStars
Senior Member
Join Date: May 2013
Old 01-29-2014 , 03:39   Re: what best method detect triple kill per time?
Reply With Quote #7

Quote:
Originally Posted by login_xcvop View Post
if i wanna add double kill ? and reset killCount per 3seconds, set task ?
PHP Code:
        if(<= killCount[killerIndx]) 
        {
                          
// double
        
}

        if(
<= killCount[killerIndx]) 
        {
                          
// triple
        

If you want to calculate number of kills within 3 seconds, you should also change
Code:
if(3 >= currTime - times[killerIndx]) {
       killCount[killerIndx]++;
} else {
       killCount[killerIndx] = 1;
       times[killerIndx] = currTime;
}
For other part of code, yes, you're right.

Last edited by CyberStars; 01-29-2014 at 03:41.
CyberStars is offline
login_xcvop
Member
Join Date: Nov 2013
Old 01-29-2014 , 03:50   Re: what best method detect triple kill per time?
Reply With Quote #8

where put set_task ?

PHP Code:
set_task(1.0"RoundStart"killer)


public 
RoundStart()
{
    for(new 
i=0i<sizeof(times); i++) 
    {
        
times[i] = get_systime();
        
killCount[i] = 0;
    }

login_xcvop is offline
CyberStars
Senior Member
Join Date: May 2013
Old 01-29-2014 , 03:55   Re: what best method detect triple kill per time?
Reply With Quote #9

Why do you need "set_task"?

For round start event just use
Code:
register_logevent("RoundStart",2,"1=Round_Start");
like here
PHP Code:
public plugin_init()
{
          
register_event("DeathMsg""PlayerKilled""a");
      
register_logevent("RoundStart",2,"1=Round_Start");

CyberStars is offline
login_xcvop
Member
Join Date: Nov 2013
Old 01-29-2014 , 04:10   Re: what best method detect triple kill per time?
Reply With Quote #10

i don't need reset "for round start"
need restart if double and triple done
login_xcvop is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode