mSelection Dealerships
#1

Two questions:

1. Do these functions do the same thing? what's the diffrence between them if they have?

Код:
stock IsADTCar(carid)
{
	for(new v = 0; v < sizeof(DTVehicles); v++)
	{
	    if(carid == DTVehicles[v]) return 1;
	}
	return 0;
}
Код:
stock IsADTCar(carid)
{
	for(new v = 0; v < sizeof(DTVehicles); v++) if(carid == DTVehicles[v]) return 1;
	return 0;
}
2. If someone can give me an example/give me a link for script for a dealership system based on mSelection include like skins mSelection? i didnt find anything...


+REP
Reply
#2

1. Yes they do the same thing. The first one looks nicer and easier to understand though.
2. I couldn't find any pre-made scripts but it is fairly easy to do it yourself.
You can use something like this:
Код:
OnGameModeInit:
{
     Vehicles = LoadModelSelectionMenu("Vehicles.txt"); // Where vehicles is a file containing the model IDs of the vehicles you want (1 at a line)
}
In a command for example:
{
     ShowModelSelectionMenu(playerid, Vehicles, "Vehicle Select", 0x007FFF33, COLOR_GREY, COLOR_WHITE);
}
Let's say you placed 2 models in Vehicles.txt 400 and 401

public OnPlayerModelSelection(playerid, response, listid, modelid)
{
    if(listid == Vehicles)
    {
          for(new i; i < 2; i++)
          {
               switch(modelid)
               {
                    case 400:
                    {
                        // Dialog asking if you want to buy vehicle model 400 for $price
                    }
                    case 401:
                    {
                        // Dialog asking if you want to buy vehicle model 401 for $price
                    }
                    // ETC or you can make an array with models and prices to get rid of the cases.
               }
          }
    }
PS: The script in your signature is useless because the variable called REP is local and can not be accessed from outside that function. Which in turn will make the reputation useless.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)