Raised This Month: $51 Target: $400
 12% 

If, Else Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 12-01-2013 , 06:47   If, Else Problem
Reply With Quote #1

PHP Code:
public evDeathMsg( )
{
    new 
iPlayers32 ];
    new 
iPlayersNum;

    
get_playersiPlayersiPlayersNum"ch" );
    
    if(
iPlayersNum 4)
        return 
PLUGIN_HANDLED;
    else
    {
               
// do something
    
}

    return 
0;

I am trying to make a plugin where if the number of players is under 4, to do nothing. But if the number of players is 4 or more, to do something. What is wrong?
__________________
We all live under the same sky but we have different horizons.
bLacK-bLooD is offline
SpeeDeeR
Veteran Member
Join Date: Mar 2010
Location: Bulgaria
Old 12-01-2013 , 07:14   Re: If, Else Problem
Reply With Quote #2

Quote:
Originally Posted by bLacK-bLooD View Post
if the number of players is 4 or more, to do something
PHP Code:
if(iPlayersNum >= 4)
//do stuff } 
You can use get_playersnum() if you want just the number of players.
SpeeDeeR is offline
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 12-01-2013 , 07:30   Re: If, Else Problem
Reply With Quote #3

Oh, thank you.

PHP Code:
if(get_playersnum() >= 4)
{
    
// do stuff


LE : It's working as it should, thank you.
__________________
We all live under the same sky but we have different horizons.

Last edited by bLacK-bLooD; 12-01-2013 at 07:37.
bLacK-bLooD is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-01-2013 , 07:39   Re: If, Else Problem
Reply With Quote #4

If you don't care about hltv, bots, human, dead, alive, spectators players status, yes, it gonna work.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
bLacK-bLooD
AlliedModders Donor
Join Date: Jun 2008
Old 12-01-2013 , 08:00   Re: If, Else Problem
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
If you don't care about hltv, bots, human, dead, alive, spectators players status, yes, it gonna work.
So if i care about hltv and bots, i should use get_players with the flags c and h. And if i care about the spectators, i should use is_user_alive, right?
__________________
We all live under the same sky but we have different horizons.
bLacK-bLooD is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-01-2013 , 12:06   Re: If, Else Problem
Reply With Quote #6

For alive status, there is flag a
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 16:49.


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