Raised This Month: $ Target: $400
 0% 

[help]how to detect if user is las on hes team?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
2reason2kill
Senior Member
Join Date: Feb 2011
Old 06-14-2011 , 13:29   [help]how to detect if user is las on hes team?
Reply With Quote #1

How can i Detect if the user is last in his team?
2reason2kill is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 06-14-2011 , 13:32   Re: [help]how to detect if user is las on hes team?
Reply With Quote #2

Example for terrorist :

Code:
new playersT[ 32 ] , num , i , tCount get_players( playersT , num , "aech" , "TERRORIST" ) for( i = 0; i < num; i++ ) {      tCount++ } if( tCount == 1 ) {      // do something }

That should works.
__________________
You can do anything you set your mind to, man.


Last edited by Devil259; 12-06-2011 at 06:26.
Devil259 is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 06-14-2011 , 14:04   Re: [help]how to detect if user is las on hes team?
Reply With Quote #3

Quote:
Originally Posted by Devil259 View Post
Example for terrorist :

Code:
new playersT[ 32 ] , num , i , tCount get_players( playersT , num , "ach" , "TERRORIST" ) for( i = 0; i < num; i++ ) { tCount++ } if( tCount == 1 ) { // do something }


That should works.


CAn i do it like


PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
}

public 
Wow()
{
    new 
playersT32 ] , num tCount
    
new name get_user_name
    get_players
playersT num "ach" "TERRORIST" )
    for( 
0numi++ )
    {
    
tCount++
    }

    if( 
tCount == )
    {
    
client_print(0print_chat,"%s Is the last Vampire!",name)
    }
}

public 
Woo()
{
    new 
playersCT32 ] , num ,ctCount
    
new namee get_user_name
    get_players
(playersCT num "ach" "COUNTER-TERRORST")
    for(
0numi++ )
    {
        
ctCount++
    }
    
    if(
ctCount == )
    }
    
client_print(0print_chat,"%s Is The last humen Eat HIM!",namee)
    } 

Last edited by 2reason2kill; 06-14-2011 at 14:10. Reason: spelled do wroong-.-
2reason2kill is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 06-14-2011 , 14:56   Re: [help]how to detect if user is las on hes team?
Reply With Quote #4

1. It isn't COUNTER-TERRORIST but CT (i think).

2. To get the player's name, you can do :

Code:
new szName[ 32 ] get_user_name( id , szName , charsmax( szName ) )
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-14-2011 , 15:08   Re: [help]how to detect if user is las on hes team?
Reply With Quote #5

Code:
stock bool:IsLastInTeam( iPlayer ) {     new szTeam[ 16 ];     get_user_team( iPlayer, szTeam, charsmax( szTeam ) );         new iPlayers[ 32 ], iNum;     get_players( iPlayers, iNum, "ae", szTeam );         return ( iNum == 1 && iPlayers[ 0 ] == iPlayer ); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 06-14-2011 , 15:11   Re: [help]how to detect if user is las on hes team?
Reply With Quote #6

Quote:
Originally Posted by Exolent[jNr] View Post
Code:
stock bool:IsLastInTeam( iPlayer ) { new szTeam[ 16 ]; get_user_team( iPlayer, szTeam, charsmax( szTeam ) ); new iPlayers[ 32 ], iNum; get_players( iPlayers, iNum, "ae", szTeam ); return ( iNum == 1 && iPlayers[ 0 ] == iPlayer ); }
I didnt understand ur way Exolent
2reason2kill 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:26.


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