Trucking missions (+rep for working fix)
#1

I have been doing trucking missions that works that way when you are in axample san fierro, it shows you missions for that area, randomally, 3 missions to select from from the dialog.

Here is a piece of this code and as you can see, i have definied the ammount of missions from "ALoadsLS" to be randomized. I dont want to do this and make the script to definie itself.
pawn Код:
else if(PlayerIsInLS == true)
    {
        // Loop through all products
        for (new i; i < sizeof(ALoadsLS); i++)
        {
            if (NumProducts < 3) // Not all PCV's, just how meny is added to the list (showd to player in dialog)
            {
                // Check if the current product has the same PCV_Needed
                if (ALoadsLS[i][PCV_Required] == PCV_Needed)
                {
                    new nn = NumProducts + 10;
                    // Add the ProductID to the ProductList
                    ProductList[NumProducts] = GetRealRandom(nn); //Add the LoadID to the slot (0-50)
                    // Increase the counter NumProducts
                    NumProducts++;
                }
            }
        }
    }
See at line : new nn = NumProducts + 10;

Here i have definied that there is 10 missions made in ALoadsLS, but i want to loop this so i dont need to definie it.

Ask if you didnt understand and +rep for working code.

Also if someone is willing to make loads for the trucking server, pm me. Easy code, but needs locistic and time. Will be revarded with level 4 admin (out of 5).
Reply
#2

Код:
else if(PlayerIsInLS == true)
	{
		// Loop through all products
		for (new i; i < sizeof(ALoadsLS); i++)
		{
			if (NumProducts < 3) // Not all PCV's, just how meny is added to the list (showd to player in dialog)
			{
				// Check if the current product has the same PCV_Needed
				if (ALoadsLS[i][PCV_Required] == PCV_Needed)
				{
                                        for(new nn=NumProducts; nn<(NumProducts+10); nn++)
                                       {
					      // Add the ProductID to the ProductList
					      ProductList[NumProducts] = GetRealRandom(nn); //Add the LoadID to the slot (0-50)
					}
				}
			}
		}
	}
Reply
#3

delete
Reply
#4

pawn Код:
for (new i; i < sizeof(ALoadsLS); i++)
to
pawn Код:
for (new i = 0; i < sizeof(ALoadsLS); i++)
Reply
#5

Quote:
Originally Posted by Skimmer
Посмотреть сообщение
pawn Код:
for (new i; i < sizeof(ALoadsLS); i++)
to
pawn Код:
for (new i = 0; i < sizeof(ALoadsLS); i++)
Why ? isn't it the same ?, new blabla; will be 0;
Reply
#6

delete
Reply
#7

delete
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)