SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 10/11/2018, 10:01 PM   #1
Longover
Big Clucker
 
Join Date: Oct 2017
Location: Romania
Posts: 138
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;
}
__________________
Keep calm and join on my server.
ROMANIA!!!

Longover is offline   Reply With Quote
Old 10/11/2018, 10:13 PM   #2
Longover
Big Clucker
 
Join Date: Oct 2017
Location: Romania
Posts: 138
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?
__________________
Keep calm and join on my server.
ROMANIA!!!

Longover is offline   Reply With Quote
Old 10/11/2018, 11:42 PM   #3
lollypap54
Little Clucker
 
Join Date: Jan 2015
Location: Lithuania
Posts: 48
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 online now   Reply With Quote
Old 10/11/2018, 11:54 PM   #4
DarkBr
Huge Clucker
 
Join Date: Feb 2017
Location: Brazil (SP)
Posts: 339
Reputation: 10
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, 03:18 PM   #5
Longover
Big Clucker
 
Join Date: Oct 2017
Location: Romania
Posts: 138
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?
__________________
Keep calm and join on my server.
ROMANIA!!!

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 05:30 PM
How to save random mission? wumpyc Scripting Help 19 03/08/2013 06:33 AM
Random mission error Tuntun Scripting Help 5 30/07/2013 04:52 PM
Random mission/ 2 question and one problem knackworst Scripting Help 4 03/09/2011 02:46 PM
Choosing random mission Haydz Help Archive 5 19/09/2010 04:58 PM


All times are GMT. The time now is 05:40 PM.


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