Raised This Month: $ Target: $400
 0% 

How can I find out the # of players on a team?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Wilson [29th ID]
Veteran Member
Join Date: Nov 2005
Location: London
Old 09-18-2007 , 20:45   Re: How can I find out the # of players on a team?
Reply With Quote #6

It does execute the code within the loop. But your code does not do anything because it does not fall within the paramters of your if statements.

get_user_team(x) will not work on the player that just executed the command to join the team.

Think of the sequence of it:
1-Player joins server, with "no team assigned yet."
2-Player executes the "jointeam" command.
3-AMXX interrupts the command and executes code.
4-Player is then assigned to the team he joined.

Theoretically, you could block the person from joining the team, which is why AMXX interrupts and comes before, not after in this case.

So anyway,

Instead of doing a get_user_team() on the player joining the team, you should instead read the argument of the command being executed.

Code:
public cmd_jointeam(id) {    new args[8];    read_args( args, 7 );    new new_team = str_to_num( args ); }

In the above code block, the integer variable new_team will be equal to the team the client tried to join. Like I said, get_user_team() won't return anything for that client yet as the team has yet to be set.
__________________

Day of Defeat AMXX Community

FakeMeta Research . Voice Proximity . Advanced Deploy . Technician
Wilson [29th ID] is offline
Send a message via ICQ to Wilson [29th ID] Send a message via AIM to Wilson [29th ID] Send a message via MSN to Wilson [29th ID] Send a message via Yahoo to Wilson [29th ID]
 



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 16:08.


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