Random mission
#1

Hi!

why i get everytime the mission 1?

Код:
public missionTimer()
{
	if(mission != 1 || mission != 2 || mission != 3 || mission != 4 || mission != 5 || mission != 6)
	{
		new mss;
		mss = 1 + random(1);
		if(mss == 1)
		{
			mission = 1;
			foreach(new i : Player)
			{
				if (isLEO(i))
				{
					SendClientMessage(i, COLOR_PURPLE, "Misiunea 'Disparutul' a fost raportata ! (/startmission)");
				}
			}
		}
		if(mss == 2)
		{
			mission = 2;
			foreach(new i : Player)
			{
				if (isLEO(i))
				{
					SendClientMessage(i, COLOR_PURPLE, "Misiunea 'Alah akbar!' a fost raportata ! (/startmission)");
				}
			}
		}
	}
	return 1;
}
Reply
#2

Quote:
Originally Posted by Longover
Посмотреть сообщение
Hi!

why i get everytime the mission 1?

Код:
public missionTimer()
{
	if(mission != 1 || mission != 2 || mission != 3 || mission != 4 || mission != 5 || mission != 6)
	{
		new mss;
		mss = 1 + random(1);
		if(mss == 1)
		{
			mission = 1;
			foreach(new i : Player)
			{
				if (isLEO(i))
				{
					SendClientMessage(i, COLOR_PURPLE, "Misiunea 'Disparutul' a fost raportata ! (/startmission)");
				}
			}
		}
		if(mss == 2)
		{
			mission = 2;
			foreach(new i : Player)
			{
				if (isLEO(i))
				{
					SendClientMessage(i, COLOR_PURPLE, "Misiunea 'Alah akbar!' a fost raportata ! (/startmission)");
				}
			}
		}
	}
	return 1;
}
Someone?
Reply
#3

Change random(1) to random(2)

This function’s argument means how much values this function could output, you chose 1, it always gave u 1 value
Reply
#4

PHP код:
public missionTimer()
{
    if(!(
<= mission <= 6))
    {
        new 
mss;
        
mss random(2-1)+1;
        switch(
mss) {
            case 
1:
            {
                foreach(new 
Player)
                {
                    if (
isLEO(i))
                    {
                        
SendClientMessage(iCOLOR_PURPLE"Misiunea 'Disparutul' a fost raportata ! (/startmission)");
                    }
                }
            }
            case 
2:
            {
                foreach(new 
Player)
                {
                    if (
isLEO(i))
                    {
                        
SendClientMessage(iCOLOR_PURPLE"Misiunea 'Alah akbar!' a fost raportata ! (/startmission)");
                    }
                }
            }
        }
    }
    return 
1;

Reply
#5

Quote:
Originally Posted by DarkBr
Посмотреть сообщение
PHP код:
public missionTimer()
{
    if(!(
<= mission <= 6))
    {
        new 
mss;
        
mss random(2-1)+1;
        switch(
mss) {
            case 
1:
            {
                foreach(new 
Player)
                {
                    if (
isLEO(i))
                    {
                        
SendClientMessage(iCOLOR_PURPLE"Misiunea 'Disparutul' a fost raportata ! (/startmission)");
                    }
                }
            }
            case 
2:
            {
                foreach(new 
Player)
                {
                    if (
isLEO(i))
                    {
                        
SendClientMessage(iCOLOR_PURPLE"Misiunea 'Alah akbar!' a fost raportata ! (/startmission)");
                    }
                }
            }
        }
    }
    return 
1;

Why i didn't get the message for 2 mission?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)