AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] Check Player Bool (https://forums.alliedmods.net/showthread.php?t=220161)

Jhob94 07-07-2013 18:31

[SOLVED] Check Player Bool
 
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.

ConnorMcLeod 07-07-2013 19:32

Re: Check Player Bool
 
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)



Jhob94 07-07-2013 19:45

Re: Check Player Bool
 
Quote:

Originally Posted by ConnorMcLeod (Post 1985814)
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 :)

ConnorMcLeod 07-07-2013 20:05

Re: Check Player Bool
 
Loops are made to be broken !


All times are GMT -4. The time now is 06:24.

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