execute a comand on a team
how to execute a comand on the whole team ?
for example slaying CT |
Re: execute a comand on a team
Quote:
Then use a for loop for all players PHP Code:
|
Re: execute a comand on a team
Won't say this is better, just easier to understand.
Code:
new max_players = get_maxplayers(); |
Re: execute a comand on a team
@SnoW, you forgot to check the team.
Code:
|
Re: execute a comand on a team
Quote:
However, you are looping through more times than needed (1->maxplayers) and checking get_user_team and is_user_alive with each iteration. My method is more proper and efficient, why not get newer coders started using the correct methods? Check only specific team and player must be alive: PHP Code:
|
Re: execute a comand on a team
@Snow & HleV
I think you both will get runtime errors for checking the team of an empty slot. (I always get runtime errors for checking the team of empty slots) |
Re: execute a comand on a team
@hlev, this is not an array and may confuse people. I'm sure you are aware and it is just a typo.
PHP Code:
Quote:
|
Re: execute a comand on a team
Quote:
Quote:
Quote:
|
Re: execute a comand on a team
@Snow: I'm assuming, in an if statement, that all conditions are evaluated before returning a result. With that assumption an empty slot would give 0 for alive and runtime error for team. I've tried asking if this is how it actually does work but I was not given a clear answer.
Also, you would require checking if they are connected if the command does not require being alive in which case you would need to use is_user_connected(). Basically, I was thinking of the general case of "an action on a team" and not just the example he happened to think of. That's my 3 cents :). |
Re: execute a comand on a team
Quote:
For second, Already said that ye maybe the connect check would be better here cause it's an example, but I just coded it how I could code it in a plugin. Using both checks would be ridicilous and using connect check and slaying after that didn't sound good either. |
| All times are GMT -4. The time now is 17:10. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.