Raised This Month: $ Target: $400
 0% 

iCount not working properly.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
proffs
Senior Member
Join Date: Jul 2013
Old 08-13-2013 , 12:21   iCount not working properly.
Reply With Quote #1

Alright, so i am using this code.
But sometimes it thinks that 1 of the 1 is a CT so it stops the game.
How can i make it that it stops the game when there is 1 T left AND/OR 0 CTs left.


PHP Code:
public Ham_PlayerKillediVictimiAttackershouldgib )
{
if( 
g_iCurrentGame == FUN_13 || !is_user_connectediVictim ) || !is_user_aliveiAttacker ) )
        return 
HAM_IGNORED;
        
    if( 
g_iCurrentGame == FUN_12 || !is_user_connectediVictim ) || !is_user_aliveiAttacker ) )
        return 
HAM_IGNORED;
        
    if( 
g_iCurrentGame == FUN_1 || !is_user_connectediVictim ) || !is_user_aliveiAttacker ) )
        return 
HAM_IGNORED;

    if( 
g_iCurrentGame != GAME_NO )
    {
        new 
iPlayers32 ], iCount;
        
        
get_playersiPlayersiCount"aech""TERRORIST" )
        
        if( 
iCount == StopGame();
    }

proffs is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-13-2013 , 18:29   Re: iCount not working properly.
Reply With Quote #2

It seems like it would work but you can try this instead if you want to be sure.
Code:
        new iPlayers[ 32 ], iCount;                   get_players( iPlayers, iCount, "aech", "TERRORIST" )                   if( iCount == 1 ) StopGame();
-->
Code:
new iCount = 0; for ( new i = 0 ; i < global_get(glb_MaxClients) ; i++ ) {     if ( is_user_alive(i) && ! is_user_bot(i) && ! is_user_hltv(i) && cs_get_user_team(i) == TEAM_TERRORIST )         iCount++; } if( iCount == 1 ) StopGame();
__________________

Last edited by Black Rose; 08-13-2013 at 19:19.
Black Rose is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 08-13-2013 , 19:08   Re: iCount not working properly.
Reply With Quote #3

Get players should work, just make sure it's being called.

@Black Rose

You don't need to check if he's connected and alive. If he's alive he must be connected.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.

Last edited by wickedd; 08-13-2013 at 19:09.
wickedd is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-13-2013 , 23:37   Re: iCount not working properly.
Reply With Quote #4

Quote:
Originally Posted by wickedd View Post
If he's alive he must be connected.
Sometimes I feel like the contrapositive of that is true, lol. (Alive referring to RL)
__________________
fysiks is offline
proffs
Senior Member
Join Date: Jul 2013
Old 08-14-2013 , 03:18   Re: iCount not working properly.
Reply With Quote #5

Quote:
Originally Posted by wickedd View Post
Get players should work, just make sure it's being called.

@Black Rose

You don't need to check if he's connected and alive. If he's alive he must be connected.
Here is it being called. It's being called exactly the same on few other games on this plugin.
PHP Code:
public SniperGame()
{
    
g_iCurrentGame GAME_SNIPER
    
    
new iPlayers[32]
    new 
iNum
    
new id
    
    set_cvar_num
("mp_friendlyfire",1)
    
    
get_playersiPlayersiNum"a" )
    for( new 
0iNumi++ )
    {
        
id iPlayers[i
Should be something wrong i think.

And here is a working one that is on few other.
I just want to see what the problem is.


PHP Code:
public Spartaday()
{
    
g_iCurrentGame GAME_SPARTA
    
    
new iPlayers[32]
    new 
iNum
    
new id
    
    get_players
iPlayersiNum"a" )
    
    for( new 
0iNumi++ )
    {
        
id iPlayers[i

Last edited by proffs; 08-14-2013 at 03:44.
proffs is offline
Old 08-15-2013, 13:46
MrKiller2010
This message has been deleted by MrKiller2010. Reason: dasd
proffs
Senior Member
Join Date: Jul 2013
Old 08-15-2013 , 13:47   Re: iCount not working properly.
Reply With Quote #7

Hmm, still not working.
Tried to switch get_players( iPlayers, iNum, "a" )
to: get_players( iPlayers, iNum, "aech" )
proffs is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 08-15-2013 , 14:06   Re: iCount not working properly.
Reply With Quote #8

Post your code.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Old 08-17-2013, 11:36
proffs
This message has been deleted by YamiKaitou. Reason: pointless posts now that the threads have been merged
proffs
Senior Member
Join Date: Jul 2013
Old 08-17-2013 , 11:19   Count Players.
Reply With Quote #10

I am using this right now:
PHP Code:
public Ham_PlayerKillediVictimiAttackershouldgib )
{
        new 
iPlayers32 ], iCount;
        
        
get_playersiPlayersiCount"aech""TERRORIST" )
        
        if( 
iCount == StopGame();

I am calling it like this:

PHP Code:
public SniperGame()
{
    
g_iCurrentGame GAME_Sniper
    
    
new iPlayers[32]
    new 
iNum
    
new id
    
    set_cvar_num
("mp_friendlyfire",1)
    
    
get_playersiPlayersiNum"a" )
    
    for( new 
0iNumi++ )
    {
        
id iPlayers[i]
        
        
set_hudmessage 692300, -1.00.3500.15.00.10.1, -
        
show_hudmessage 0"[RPGSD]: Sniper Game Started!")
        
        
strip_user_weaponsid )
        
        if (
cs_get_user_team(id) == CS_TEAM_CT)
        {
            
give_item(id"weapon_knife")
            
give_item(id"weapon_m4a1"
            
give_item(id"weapon_deagle")
            
cs_set_user_bpammoidCSW_M4A190 )
            
cs_set_user_bpammoidCSW_DEAGLE35 )
            
set_user_godmode(id1)
            
fm_reset_user_model(id
But the problem is that when there is 2 lefts, StopGame command runs it automatic.
Because it thinks 1 of the T is CT. He gets CT skin and so on.
Am i doing it wrong?

I got this code from my friend.
But I don't know how to use it can someone help me?

PHP Code:
stock getPlayers(CsTeams:iTeam)
{
new 
players
for(new 133i++)
if(
is_user_connected(i) && !is_user_bot(i) && is_user_alive(i))
if(
cs_get_user_team(i) == iTeamplayers++

return 
players

PHP Code:
if(getPlayers(CS_TEAM_T) == 1

Last edited by proffs; 08-17-2013 at 11:26.
proffs 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 15:55.


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