1 = player, more than 2 = players.
Hi. (its me again)
Im trying to make something very simple but yet hard for me (I guess) Whenever I use this code to respawn a player it says player but whenever I respawn 2 or more I want it to say playerS but it seems like that Iam mistaken somewhere.. Can somebody tell me what am I doing wrong here? PHP Code:
|
Re: 1 = player, more than 2 = players.
The first option is used if the expression is true, the second if false. You've switched them around.
Also, you can probably just get rid of the space between the quotes. PHP Code:
|
Re: 1 = player, more than 2 = players.
if(iNum > 0)
No need to check if players number are greater than 0 the condition of the loop do it 4 you... |
Re: 1 = player, more than 2 = players.
Quote:
|
Re: 1 = player, more than 2 = players.
Quote:
Yes it dose ,checking if(inum > 0) is useless when it has the same condition of the loop if the loop condition isnt true it wont start the loop |
Re: 1 = player, more than 2 = players.
Thanks, @ddhoward!
I guess I was in a hurry :D @Natsheh I check If iNum is 0 because: PHP Code:
|
Re: 1 = player, more than 2 = players.
you could....
PHP Code:
|
Re: 1 = player, more than 2 = players.
I could but im a newbieeeeee
P.S. get_players( iPlayers, iNum, "bh"); what does b and h mean btw? |
Re: 1 = player, more than 2 = players.
Quote:
H = Skip HLTV |
Re: 1 = player, more than 2 = players.
Quote:
In your code there are some problems: 1. It will alloc 'i' on stack and reset it even if iNum is 0, so there is no reason to move this condition in another place. Your code will check this condition two times too (in loop and in print). If you don't like repeating print_chat and Prefix you can create a separate PrintToChat(player, format, ...) function/macro that would include print_chat arg and Prefix. 2. Better explicitly reset 'i' than implicitly. 3. We should exclude not only HLTV, but all spectators and UNA. We should include only dead CT and dead TR. There is no flag for this, so we can't do it via get_players directly. So: PHP Code:
|
| All times are GMT -4. The time now is 21:02. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.