Garage slots
#6

Код:
CMD:garage(playerid, params[])
{
	new 
		i, 
		string[256]
	;
	for(i; i < MAX_PLAYER_CARS; i++) // loop
	{
		if(ID[playerid][i] == -1) // if player doesn't have car in this slot, skip it
			continue;

		format(string, 256, "%s%s(%i)\n", string, aVehicleNames[GetVehicleModel(ID[playerid][i])-400], ID[playerid][i]);
	}
	for(i; i < MAX_PLAYER_CARS; i++) // loop to make the rest of slots - empty -
	{
		strcat(string, "- empty -\n");
	}
	ShowPlayerDialog(playerid, DIALOG_MENU, DIALOG_STYLE_LIST, "Garage", string1, "Select", "Close");
	return 1;
}
However, in your DIALOG_MENU dialog response should be changed too...
Example:
Код:
OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
		// ...
		case DIALOG_MENU:
		{
			if(response)
			{
				new slot;
				for(new i; i < MAX_PLAYER_CARS; i++)
				{
					if(ID[playerid][i] == -1) // if player doesn't have car in this slot, skip it
						continue;

					if(listitem == slot)
					{
						// code if player selected vehicle slot 'slot'
						return 1;
					}
					slot++;
				}
				// code if player selected - empty - slot
			}
		}
		// ...
	}
}
Reply


Messages In This Thread
Garage slots - by James585 - 16.01.2017, 16:56
Re: Garage slots - by azzerking - 16.01.2017, 19:45
Re: Garage slots - by James585 - 16.01.2017, 20:01
Re: Garage slots - by azzerking - 16.01.2017, 20:06
Re: Garage slots - by James585 - 17.01.2017, 14:08
Re: Garage slots - by X337 - 17.01.2017, 15:34
Re: Garage slots - by James585 - 17.01.2017, 16:05
Re: Garage slots - by X337 - 17.01.2017, 16:22
Re: Garage slots - by James585 - 17.01.2017, 16:41

Forum Jump:


Users browsing this thread: 3 Guest(s)