SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/11/2018, 09:01 PM   #1
Longover
Big Clucker
 
Join Date: Oct 2017
Location: Romania
Posts: 188
Reputation: 0
Default Random mission

Hi!

why i get everytime the mission 1?

Code:
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;
}
__________________
ROMANIA POWER!!!
Longover is offline   Reply With Quote
Old 10/11/2018, 09:13 PM   #2
Longover
Big Clucker
 
Join Date: Oct 2017
Location: Romania
Posts: 188
Reputation: 0
Default Re: Random mission

Quote:
Originally Posted by Longover View Post
Hi!

why i get everytime the mission 1?

Code:
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?
__________________
ROMANIA POWER!!!
Longover is offline   Reply With Quote
Old 10/11/2018, 10:42 PM   #3
lollypap54
Big Clucker
 
Join Date: Jan 2015
Location: Lithuania
Posts: 55
Reputation: 8
Default Re: Random mission

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
lollypap54 is offline   Reply With Quote
Old 10/11/2018, 10:54 PM   #4
DarkBr
Huge Clucker
 
Join Date: Feb 2017
Location: ∫ f(x) dx
Posts: 373
Reputation: 11
Default Re: Random mission

PHP Code:
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;

DarkBr is offline   Reply With Quote
Old 12/11/2018, 02:18 PM   #5
Longover
Big Clucker
 
Join Date: Oct 2017
Location: Romania
Posts: 188
Reputation: 0
Default Re: Random mission

Quote:
Originally Posted by DarkBr View Post
PHP Code:
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?
__________________
ROMANIA POWER!!!
Longover is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Random Hit/Mission System NealPeteros Filterscripts 9 11/04/2017 04:30 PM
How to save random mission? wumpyc Scripting Help 19 03/08/2013 05:33 AM
Random mission error Tuntun Scripting Help 5 30/07/2013 03:52 PM
Random mission/ 2 question and one problem knackworst Scripting Help 4 03/09/2011 01:46 PM
Choosing random mission Haydz Help Archive 5 19/09/2010 03:58 PM


All times are GMT. The time now is 11:48 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.