Raised This Month: $32 Target: $400
 8% 

[KZ] Simple Timer


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Statistical        Approver:   Arkshine (91)
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 04-18-2010 , 21:07   [KZ] Simple Timer
Reply With Quote #1

- Description -
I made this plugin a few days ago for personal use. It displays the game time which starts, as always, when you push the start button. It's still different as other timers, because it displays the time above the crosshair as a simple message.

Illustrative image:
[IMG]http://img15.**************/img15/3148/kzmfatalisbhop0000.th.png[/IMG]

- Command -
say(_team) /timer - Enables/disables the timer.

- CVar -
kz_timer_autoenable - Sets if the timer should be "auto enabled" on players or not. Default: 1.

- Download -
Attached Files
File Type: sma Get Plugin or Get Source (kz_simple_timer.sma - 5195 views - 4.7 KB)
__________________
"There is no knowledge, that is not power"

Last edited by fezh; 04-19-2010 at 11:47.
fezh is offline
stevenisecko138
Senior Member
Join Date: Dec 2008
Location: CA
Old 04-18-2010 , 23:00   Re: [KZ] Simple Timer
Reply With Quote #2

oo first post nice plugin for a kz server :p
stevenisecko138 is offline
Send a message via AIM to stevenisecko138
kanatzu
Veteran Member
Join Date: Oct 2007
Location: Sweden
Old 04-18-2010 , 23:45   Re: [KZ] Simple Timer
Reply With Quote #3

This is great.

Nothing special, but i mean, it's better then others!
__________________




Quote:
Originally Posted by wrecked_ View Post
Stop saying words before I sodomize you with a cucumber.
kanatzu is offline
Send a message via MSN to kanatzu
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-19-2010 , 00:57   Re: [KZ] Simple Timer
Reply With Quote #4

There are more targets than you put in your plugin.
Also, some buttons are triggered by touch.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
lazarev
Veteran Member
Join Date: Sep 2008
Old 04-19-2010 , 01:12   Re: [KZ] Simple Timer
Reply With Quote #5

gj, but there are more timers:
PHP Code:
new const szStarts[][] =
{
    
"counter_start""clockstartbutton""firsttimerelay""gogogo""but_start""counter_start_button",
    
"multi_start""timer_startbutton""start_timer_emi"
};

new const 
szStops[][] =
{
    
"counter_off""clockstopbutton""clockstop""stop_counter""but_stop""counter_stop_button",
    
"multi_stop""m_counter_end_emi"
}; 

Last edited by lazarev; 04-19-2010 at 01:14.
lazarev is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 04-19-2010 , 01:57   Re: [KZ] Simple Timer
Reply With Quote #6

Timers with tasks arent correct. You can use like prethink and show message every 1 second (get gametime - start ).
PHP Code:
#include < amxmodx >
#include < engine >
#include < hamsandwich >

new g_iMsgSayTextFloat:g_flStartDelayFloat:g_flStartTime33 ], Trie:g_tStartsTrie:g_tStops;

public 
plugin_init( ) {
    
register_plugin"XJ DecimalTimer""1.0""xPaw" );
    
    
g_iMsgSayText get_user_msgid"SayText" );
    
    
g_tStarts TrieCreate( );
    
g_tStops  TrieCreate( );
    
    new 
szMap21 ], i;
    
get_mapnameszMap20 );
    
    if( 
equaliszMap"kz_a2_bhop_corruo_ez" )
    ||  
equaliszMap"kz_a2_bhop_corruo_h" )
    ||  
equaliszMap"kz_a2_godspeed" ) ) {
        
RegisterHamHam_Touch"func_button""FwdHamButtonTouch" ); 
    }
    else if( 
equaliszMap"kz_man_climbrace" ) ) {
        
RegisterHamHam_Think"func_breakable""FwdHamBreakableThink" );
        
RegisterHamHam_Touch"trigger_multiple""FwdHamMultipleTouch" );
    } else {
        if( 
equaliszMap"kz_cup_storage" ) )
            
g_flStartDelay 5.0;
        
        
RegisterHamHam_Use"func_button""FwdHamButtonUse" );
    }
    
    
register_logevent"LogEvent_StartRound"2,"0=World triggered""1=Round_Start" );
    
    new const 
szStarts[ ][ ] = {
        
"counter_start""clockstartbutton""firsttimerelay""but_start""counter_start_button",
        
"multi_start""timer_startbutton""start_timer_emi""gogogo"
    
};
    new const 
szStops[ ][ ]  = {
        
"counter_off""clockstopbutton""clockstop""but_stop""counter_stop_button",
        
"multi_stop""stop_counter""m_counter_end_emi"
    
};
    
    for( 
0sizeof szStartsi++ )
        
TrieSetCellg_tStartsszStarts], );
    
    for( 
0sizeof szStopsi++ )
        
TrieSetCellg_tStopsszStops], );
}

public 
plugin_end( ) {
    
TrieDestroyg_tStarts );
    
TrieDestroyg_tStops );
}

public 
client_disconnectid )
    
g_flStartTimeid ] = 0.0;

public 
LogEvent_StartRound( )
    
arrayset_:g_flStartTime_:0.033 );

public 
FwdHamMultipleTouch( const iEntity, const id )
    if( 
is_user_aliveid ) )
        
Timer_Stopid );

public 
FwdHamBreakableThink( const iEntity ) {
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum"a" );
    
    if( 
iNum )
        for( new 
iiNumi++ )
            
Timer_StartiPlayers] );
}

public 
FwdHamButtonUse( const iEntity, const id ) {
    if( !
is_user_aliveid ) )
        return;
    
    new 
szTarget32 ];
    
entity_get_stringiEntityEV_SZ_targetszTarget31 );
    
    if( 
TrieKeyExistsg_tStartsszTarget ) )
        
Timer_Startid );
    else if( 
TrieKeyExistsg_tStopsszTarget ) )
        
Timer_Stopid );
}

public 
FwdHamButtonTouch( const iEntity, const id ) {
    if( !
is_user_aliveid ) )
        return;
    
    static const 
START[ ] = "gogogo";
    static const 
STOP[ ]  = "stop_counter";
    
    new 
szTarget32 ];
    
entity_get_stringiEntityEV_SZ_targetszTarget31 );
    
    if( 
equalszTargetSTART ) )
        
Timer_Startid );
    else if( 
equalszTargetSTOP ) )
        
Timer_Stopid );
}

public 
Timer_Start( const id ) {
    if( 
g_flStartTimeid ] )
        return;
    
    
g_flStartTimeid ] = get_gametime( );
    
    
SendSayTextid"^4[XJ]^1 You have started the timer!" );
}

Timer_Stop( const id ) {
    if( !
g_flStartTimeid ] )
        return;
    
    new 
szTime15 ], szMessage128 ];
    
ClimbtimeToString( ( get_gametime( ) - g_flStartTimeid ] - g_flStartDelay ), szTime14 );
    
    
g_flStartTimeid ] = 0.0;
    
    
formatexszMessage127"^4[XJ]^1 You finished the map in:^3 %s^1! Congratulations."szTime );
    
    
SendSayTextidszMessage );
    
    new 
iPlayers32 ], iNum;
    
get_playersiPlayersiNum"b" );
    
    if( 
iNum ) {
        new 
szNick32 ], iPlayer;
        
get_user_nameidszNick31 );
        
        
formatexszMessage127"^4[XJ]^3 %s^1 has finished the map in:^3 %s^1!"szNickszTime );
        
        for( new 
iiNumi++ ) {
            
iPlayer iPlayers];
            
        
//    if( ( 1 << entity_get_int( iPlayer, EV_INT_iuser1 ) ) & ( ( 1 << 1 ) | ( 1 << 2 ) | ( 1 << 4 ) ) &&
            
if( id == entity_get_intiPlayerEV_INT_iuser2 ) )
                
SendSayTextiPlayerszMessage );
        }
    }
}

ClimbtimeToString( const Float:flClimbTimeszOutPut[ ], const iLen ) {
    new 
iMinutes floatroundflClimbTime 60.0floatround_floor );
    new 
iSeconds floatroundflClimbTime iMinutes 60floatround_floor );
    new 
iMiliSeconds floatround( ( flClimbTime - ( iMinutes 60 iSeconds ) ) * 100floatround_floor );
    
    
formatexszOutPutiLen"%02i:%02i.%02i"iMinutesiSecondsiMiliSeconds );
}

SendSayText( const id, const szMessage[ ] ) {
    
message_beginMSG_ONE_UNRELIABLEg_iMsgSayText_id );
    
write_byteid );
    
write_stringszMessage );
    
message_end( );

__________________
xPaw is offline
xakintosh
I run no-steam servers!
Join Date: Feb 2010
Location: Edge of nowhere
Old 04-19-2010 , 02:28   Re: [KZ] Simple Timer
Reply With Quote #7

Nice plugin good job.
__________________
As soon as possible.
xakintosh is offline
Send a message via Yahoo to xakintosh Send a message via Skype™ to xakintosh
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 04-19-2010 , 11:48   Re: [KZ] Simple Timer
Reply With Quote #8

Updated.
__________________
"There is no knowledge, that is not power"
fezh is offline
eD.
Senior Member
Join Date: Oct 2009
Old 04-19-2010 , 13:30   Re: [KZ] Simple Timer
Reply With Quote #9

Nothing special.
eD. is offline
fezh
Veteran Member
Join Date: Dec 2008
Location: BANNED
Old 04-19-2010 , 14:02   Re: [KZ] Simple Timer
Reply With Quote #10

Quote:
Originally Posted by eD. View Post
Nothing special.
Who cares.
__________________
"There is no knowledge, that is not power"
fezh 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 23:10.


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