removing a value from a variable
#4

Like this?

pawn Код:
new
    iPlayerCounts = -1
;

public OnPlayerConnect( playerid )
{
    if ( iPlayerCounts < 0 )
        iPlayerCounts = 0;
    else
        iPlayerCounts ++; // Increase the iPlayerCounts, you could do " iPlayerCounts += 1; "

    return 1;
}

public OnPlayerDisconnect( playerid, reason )
{
    if ( iPlayerCounts > -1 )
        iPlayerCounts --; // Take away the variable, you could use " iPlayerCounts -= 1; "

    return 1;
}

stock dividePlayersByTwo( )
    return iPlayerCounts / 2; // Divides iPlayerCounts by Two.

stock startHappyHour( )
{
    if ( ( dividePlayersByTwo( ) ) < 5 ) // if ( ( iPlayerCounts /2 ) < 5 )
        return GameTextForAll( "Not enough players", 3000, 3 );

    return 1;
}
If I understand, you are asking this.
Reply


Messages In This Thread
removing a value from a variable - by SpankMe2 - 05.08.2011, 12:35
Re: removing a value from a variable - by MadeMan - 05.08.2011, 12:54
Re: removing a value from a variable - by SpankMe2 - 05.08.2011, 12:56
Re: removing a value from a variable - by Basicz - 05.08.2011, 13:00

Forum Jump:


Users browsing this thread: 1 Guest(s)