Raised This Month: $ Target: $400
 0% 

Round Counter


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ichiban
Member
Join Date: Dec 2008
Old 11-29-2010 , 06:33   Round Counter
Reply With Quote #1

I am trying to record the amount of rounds played. It is currently increasing by two instead of one. What could the problem be?

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "Test"

new iRound[33];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_event("TeamScore""teamScore""a");    
    
register_clcmd("say /round","showRound");
}

public 
teamScore()
{
    
//Increase Rounds Played for All Players
    
for(new 1<= get_maxplayers(); i++)
    {
        if(
is_user_connected(i))
        {
            if (!(
cs_get_user_team(i) == CS_TEAM_SPECTATOR))
            {
                
iRound[i]++;
            }
        }
    }
}

public 
showRound(id)
{
    
client_print(idprint_chat"You have played %i rounds"iRound[id]);

ichiban is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-29-2010 , 07:09   Re: Round Counter
Reply With Quote #2

Try hooking the rounds like this:
PHP Code:
register_logevent("Event_RoundStart"2"1=Round_Start"); 
And do this to check team:
PHP Code:
if(cs_get_user_team(i) != CS_TEAM_SPECTATOR
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 11-29-2010 , 08:58   Re: Round Counter
Reply With Quote #3

This is da method i would use to count no of rounds which have passed
Code:
#include < amxmodx > new g_iRounds public plugin_init( ) {     register_plugin( "Blah", "blah", "blah" )     register_logevent( "event_round_start", 2, "1=Round_Start" )     register_clcmd( "say /round", "hook" ) } public hook( id )     client_print( id, print_chat, "No of rounds which have been played: %d", g_iRounds ) public event_round_start( )     g_iRounds++
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 11-29-2010 , 10:19   Re: Round Counter
Reply With Quote #4

Quote:
Originally Posted by abdul-rehman View Post
This is da method i would use to count no of rounds which have passed
He's counting the amount of rounds an individual player has played.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
dFF
sıɹɹoɥɔ ʞɔnu
Join Date: Oct 2009
Old 11-29-2010 , 09:01   Re: Round Counter
Reply With Quote #5

Also reset g_iRounds when game commencing or server restart if You want.
dFF is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 11-29-2010 , 10:44   Re: Round Counter
Reply With Quote #6

Quote:
Originally Posted by drekes View Post
He's counting the amount of rounds an individual player has played.
Quote:
Originally Posted by ichiban View Post
I am trying to record the amount of rounds played.
I think he needs to be more descriptive nextime
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
ichiban
Member
Join Date: Dec 2008
Old 11-29-2010 , 21:19   Re: Round Counter
Reply With Quote #7

Thank you both.

I used both of your improvements.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Test"
#define VERSION "1.0"
#define AUTHOR "Test"

new g_iPlayerRounds[33];
new 
g_iTotalRounds;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_logevent("Event_RoundStart"2"1=Round_Start");
    
register_clcmd("say /round","showRound");
}

public 
Event_RoundStart()
{
    
//Increase Rounds Played for All Players
    
for(new 1<= get_maxplayers(); i++)
    {
        if(
is_user_connected(i))
        {
            if (
cs_get_user_team(i) != CS_TEAM_SPECTATOR)
            {
                
g_iPlayerRounds[i]++;
            }
        }
    }
    
    
//Increase Total Rounds
    
g_iTotalRounds++;      
}

public 
showRound(id)
{
    
client_print(idprint_chat"You have played %i/%i rounds"g_iPlayerRounds[id], g_iTotalRounds);

ichiban is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 11-29-2010 , 21:35   Re: Round Counter
Reply With Quote #8

Make sure you reset the index when the client disconnect and/or connects to/from the server.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Reply


Thread Tools
Display Modes

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 11:18.


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