Raised This Month: $ Target: $400
 0% 

[SOLVED] Check Player Bool


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 07-07-2013 , 18:31   [SOLVED] Check Player Bool
Reply With Quote #1

I dont know if title is good but i think is the better i found...
Well i made this:
PHP Code:
public My_Cmd()
{
    new 
players[32], numid
    get_players
(playersnum"ach")
    for(--
numnum>=0num--)
    {
        
id players[num]
        
        if(
Player_Bool[id] == false)
        {
            if(
Bool == false)
                
Bool true
        
}
        
        else
            
server_cmd("sv_restart 1")
    }

What i want is if all has the Player_Bool[index] == true, it restart. If 1 or more has Player_Bool[index] == false it sets Bool to true.

Can someone help? Because with this, if one(or more) has Player_Bool[index] == true it restart and i just want restart if all alive players have that bool.
__________________
Jhob94 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-07-2013 , 19:32   Re: Check Player Bool
Reply With Quote #2

PHP Code:
public My_Cmd()
{
    new 
players[32], numid
    get_players
(playersnum"ac")
    for(--
numnum>=0num--)
    {
        
id players[num]
        
        if(
Player_Bool[id] == false)
        {
            
Bool true
            
return
        }
    }

    
// if we are there, all player has Player_Bool on true, and Bool has not be set to true
    
set_pcvar_num(sv_restart1)

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 07-07-2013 , 19:45   Re: Check Player Bool
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
PHP Code:
public My_Cmd()
{
    new 
players[32], numid
    get_players
(playersnum"ac")
    for(--
numnum>=0num--)
    {
        
id players[num]
        
        if(
Player_Bool[id] == false)
        {
            
Bool true
            
return
        }
    }

    
// if we are there, all player has Player_Bool on true, and Bool has not be set to true
    
set_pcvar_num(sv_restart1)

OMG iam really idiot xD
Thanks
__________________
Jhob94 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-07-2013 , 20:05   Re: Check Player Bool
Reply With Quote #4

Loops are made to be broken !
__________________
- 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 06:24.


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