Raised This Month: $ Target: $400
 0% 

Kill 6 players in 15 seconds


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 03-09-2013 , 08:42   Re: Kill 6 players in 15 seconds
Reply With Quote #9

Your way basically "cycles" the timer.
When it ends, it starts a new one after the player kills someone.

When the player kills 3 people 5 seconds before the timer ends and kills other 3 people right after the timer ends, he would still kill 6 people under 15 seconds but your method wouldn't recognize it.

Edit: This would probably work, but I don't like the array shifting part. Any better ideas?

Code:
#include <amxmodx> #include <amxmisc> #include < hamsandwich > #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" #define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers ) new Float: g_iPlrKillTime[ 33 ][ 6 ] new g_iMaxPlayers public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         RegisterHam( Ham_Killed, "player", "_fwHamKilled", .Post = true )         g_iMaxPlayers = get_maxplayers( ) } public _fwHamKilled( iVictim, iKiller ) {     // check if the killer is a player     if( !IsPlayer( iKiller ) )         return             // check if there's an empty cell in the array     for( new i; i < 6; i ++ )     {         if( !g_iPlrKillTime[ iKiller ][ i ] )         {             // there was an empty cell             g_iPlrKillTime[ iKiller ][ i ] = get_gametime( )                         // if this was the last cell of the array, the player has already made 6 kills, so we can skip to checking the time             if( i == 5 )                 goto __CheckTimes                         // the player hasn't killed 6 players yet, so this is our stop             return         }     }         // this code only occurs when the array was already filled. We're shifting the whole array down one cell and filling the last cell with new time     // better way to shift the array? I know this could be done using a loop, but is there a native?     g_iPlrKillTime[ iKiller ][ 0 ] = g_iPlrKillTime[ iKiller ][ 1 ]     g_iPlrKillTime[ iKiller ][ 1 ] = g_iPlrKillTime[ iKiller ][ 2 ]     g_iPlrKillTime[ iKiller ][ 2 ] = g_iPlrKillTime[ iKiller ][ 3 ]     g_iPlrKillTime[ iKiller ][ 3 ] = g_iPlrKillTime[ iKiller ][ 4 ]     g_iPlrKillTime[ iKiller ][ 4 ] = g_iPlrKillTime[ iKiller ][ 5 ]     g_iPlrKillTime[ iKiller ][ 5 ] = get_gametime( )     // time checking __CheckTimes:     // if the time between first kill and last kill is greater than zero and less than 15, the last 6 kills of the player were in the range of 15 seconds.     if( 0.0 < ( g_iPlrKillTime[ iKiller ][ 5 ] - g_iPlrKillTime[ iKiller ][ 0 ] ) <= 15.0 )     {         //code     } }

What this code does is cache the last 6 kills of a player, then check if the time between the first and 6th kill is 15 seconds or less.

Last edited by Backstabnoob; 03-09-2013 at 09:31.
Backstabnoob is offline
 



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 21:48.


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