Raised This Month: $ Target: $400
 0% 

Get playing time (being in CT or T team)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mlk27
Veteran Member
Join Date: May 2008
Old 02-04-2009 , 23:45   Get playing time (being in CT or T team)
Reply With Quote #1

hi. how does get_user_time work?

does it only count total time of a player spends being in server or total time he's being in server and playing (in either ct or t team)? what happen if he goes to spectator team, will his get_user_time increase?



p.s: sawce just answered me on irc that its player's total time in server, regardless the player is playing or just spectating



can anyone show me to make a counter that will count total playing time when a player being in ct or t..stop the counter when he disconnect or join spectator team..and countinue counting if he goes back to ct or t team..

Last edited by Mlk27; 02-05-2009 at 07:03.
Mlk27 is offline
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 02-05-2009 , 01:10   Re: Get playing time (being in CT or T team)
Reply With Quote #2

From amxmodx.inc:
PHP Code:
/* Returns player playing time in seconds. 
* If flag is set then result is without connection time. */
native get_user_time(indexflag 0); 
Example:
PHP Code:
public client_disconnect(id)
{
    new 
gTime get_user_time(id); 
    
/* If you set the second parameter to 1, you will get user's connection time + it's played time on the server. If  you set it to 0, you will get user's only played time on the server. */

This command won't help you to detect user's played time only in teams (CT, T), it will count all user's time spent on server (from connect or putinserver) irrespective of his team.

Last edited by TheRadiance; 02-05-2009 at 01:14.
TheRadiance is offline
Send a message via ICQ to TheRadiance
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 02-05-2009 , 03:31   Re: Get playing time (being in CT or T team)
Reply With Quote #3

Here's a start
PHP Code:
new Counter33 ][ ];

public 
plugin_init()
    
register_event"TeamInfo""join_team""a" );

public 
join_team()
{
    new 
id read_data);
    new 
team];
    
read_data2team);
    
    switch( 
team] )
    {
        case 
'C'// moved to CT, start to count on Counter[ id ][ 1 ]
        
case 'T':  // moved to T, start to count on Counter[ id ][ 0 ]
        
case 'S'// moved to SPECT, start to count on Counter[ id ][ 2 ]
    
}

__________________

anakin_cstrike is offline
Mlk27
Veteran Member
Join Date: May 2008
Old 02-05-2009 , 05:57   Re: Get playing time (being in CT or T team)
Reply With Quote #4

what about this..does this work?

Code:
#include <amxmodx> new g_MaxPlayers new playtime[33] new bool:g_spectator[33] public plugin_init() {     register_event("TeamInfo", "eTeamInfo", "a")     set_task(1.0, "CountPlayTime", _, _, _, "b")     g_MaxPlayers = get_maxplayers() } public client_disconnect(id) {     playtime[id] = 0 } public eTeamInfo() {     new id = read_data(1)     new client_team[2] ; read_data(2, client_team, charsmax(client_team))         switch(client_team[0])     {         case 'C': g_spectator[id] = false         case 'T': g_spectator[id] = false         case 'S': g_spectator[id] = true     } } public CountPlayTime() {     for(new id; id <= g_MaxPlayers; id++)     {         if(is_user_connected(id) && !g_spectator[id])             playtime[id]++     } }


any better idea?
Mlk27 is offline
Old 02-05-2009, 08:09
SnoW
This message has been deleted by SnoW. Reason: Bah, maybe I'll just delete this.
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 02-05-2009 , 08:15   Re: Get playing time (being in CT or T team)
Reply With Quote #6

PHP Code:
for(new id=1
__________________

anakin_cstrike 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 01:48.


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