The text does not change.
#1

Problem solved
Reply
#2

Код:
  new
	        Info
     	;
     	switch( Info )
	    {
	        case 0: { if( playerDB[playerid][PlayerTime] > 0 ){ SendClientMessage( playerid, BLUE, "Yra Vaikutis - 11Metų" ); }
	        case 1: { if( playerDB[playerid][PlayerTime] >= 30 ){ SendClientMessage( playerid, BLUE, "Yra Pauglys - 16Metų" ); }
	        case 2: { if( playerDB[playerid][PlayerTime] >= 68 ){ SendClientMessage( playerid, BLUE, "Yra Vyras - 28Metų" ); }
	        case 3: { if( playerDB[playerid][PlayerTime] >= 150 ){ SendClientMessage( playerid, BLUE, "Esu Jau senukas - 65Metų" ); }
	    }
I think it should work.
Reply
#3

Since you first case is always true (30 is greater than 0), it will always use the first case and skip the others.

Try this:
pawn Код:
new
            Info
        ;
        switch( Info )
        {
            case 0: { if(( playerDB[playerid][PlayerTime] > 0 ) && ( playerDB[playerid][PlayerTime] < 30 )){ SendClientMessage( playerid, BLUE, "Yra Vaikutis - 11Metų" ); }
            case 1: { if(( playerDB[playerid][PlayerTime] >= 30 ) && ( playerDB[playerid][PlayerTime] < 68)){ SendClientMessage( playerid, BLUE, "Yra Pauglys - 16Metų" ); }
            case 2: { if(( playerDB[playerid][PlayerTime] >= 68 ) && ( playerDB[playerid][PlayerTime] < 150)){ SendClientMessage( playerid, BLUE, "Yra Vyras - 28Metų" ); }
            case 3: { if( playerDB[playerid][PlayerTime] >= 150 ){ SendClientMessage( playerid, BLUE, "Esu Jau senukas - 65Metų" ); }
        }
Reply
#4

Now as I have 30, Now the text does not show any
Код:
 
 new
            Info
        ;
        switch( Info )
        {
            case 0:
			{
				if( playerDB[playerid][PlayerTime] > 0 && playerDB[playerid][PlayerTime] < 30 )
				{
				    SendClientMessage( playerid, BLUE, "Yra Vaikutis - 11Metų" );
				}
			}
            case 1:
			{
				if( playerDB[playerid][PlayerTime] >= 30 && playerDB[playerid][PlayerTime] < 68)
				{
			        SendClientMessage( playerid, BLUE, "Yra Pauglys - 16Metų" );
				}
			}
            case 2:
			{
				if( playerDB[playerid][PlayerTime] >= 68 && playerDB[playerid][PlayerTime] < 150)
				{
				    SendClientMessage( playerid, BLUE, "Yra Vyras - 28Metų" );
				}
			}
            case 3:
			{
				if( playerDB[playerid][PlayerTime] >= 150 )
				{
			        SendClientMessage( playerid, BLUE, "Esu Jau senukas - 65Metų" );
				}
			}
        }
Reply
#5

Try it without the switch-case:
pawn Код:
if( (playerDB[playerid][PlayerTime] > 0) && (playerDB[playerid][PlayerTime] < 30) )
{
    SendClientMessage( playerid, BLUE, "Yra Vaikutis - 11Metu;" );
}
if( (playerDB[playerid][PlayerTime] >= 30) && (playerDB[playerid][PlayerTime] < 68))
{
    SendClientMessage( playerid, BLUE, "Yra Pauglys - 16Metu;" );
}
if( (playerDB[playerid][PlayerTime] >= 68) && (playerDB[playerid][PlayerTime] < 150))
{
    SendClientMessage( playerid, BLUE, "Yra Vyras - 28Metu;" );
}
if( playerDB[playerid][PlayerTime] >= 150 )
{
    SendClientMessage( playerid, BLUE, "Esu Jau senukas - 65Metu;" );
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)