Raised This Month: $ Target: $400
 0% 

Modindependent way to count team and enemies?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Isobold
Veteran Member
Join Date: Mar 2004
Old 01-27-2007 , 07:24   Modindependent way to count team and enemies?
Reply With Quote #1

Is there a mod independent / generic way to count players per team? I need to know at player respawn, how much players I have in each team and than to decide for each player what to do with him, depending on his team and the player number in each team ...

I could easily do this with cs or dod, but how to do this with any mod?

Is get_players still my friend in this case or do I have to add some code lines for each mod?

get_user_team is quite good to have a generic way to get a players team, but how to know which teams exist to count the number of players in each team? I would really not like to use some "pre parse" on each respawn of a player to get to know, which teams exist and than to count how many players are in there ...

Last edited by Isobold; 01-27-2007 at 07:58.
Isobold is offline
schnitzelmaker
Senior Member
Join Date: Apr 2006
Location: HERE
Old 01-27-2007 , 10:01   Re: Modindependent way to count team and enemies?
Reply With Quote #2

yes, very easy.
Code:
for(new i=0;i<=32;i++)   new team = pev(i,pev_team)

Here a litle complete example:You only need the team id number.
I am NOT 100% sure(1= CT,Axis/2= Terror,Allies/0= Spectator)
Code:
public count_players() {  new teamA,teamB  for(new i=0;i<=32;i++)  {   new team = pev(i,pev_team)   if(team == 1)    teamA++   else if(team == 2)    teamB++   client_print(0,print_chat,"TeamA have %d Player,TeamB have %d Player",teamA,teamB)  } }

For the teamnames there exist an event:http://wiki.amxmodx.org/index.php/Ha...t for all Mods
__________________

Last edited by schnitzelmaker; 01-27-2007 at 11:56.
schnitzelmaker is offline
Isobold
Veteran Member
Join Date: Mar 2004
Old 02-11-2007 , 12:23   Re: Modindependent way to count team and enemies?
Reply With Quote #3

Works quite well, karma++ for this.
Isobold 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 22:27.


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