[Ajuda] Criar empresa bugado
#3

Code:
Dialog_CreateBusSelType(playerid, response, listitem)
{
	// Just close the dialog if the player clicked "Cancel"
	if(!response) return 1;

    // Setup some local variables
	new BusType, BusID, Float:x, Float:y, Float:z, Msg[128], bool:EmptySlotFound = false;

	// Get the player's position
	GetPlayerPos(playerid, x, y, z);

	// Get the business-type from the option the player chose
	BusType = listitem + 1;

	// Find a free business-id
	for (BusID = 1; BusID < MAX_BUSINESS; BusID++)
	{
		// Check if this business ID is free
		if (ABusinessData[BusID][BusinessType] == 0)
		{
			EmptySlotFound = true;
		    break; // Stop processing
		}
	}

	// Check if an empty slot has been found
	if (EmptySlotFound == false)
	{
		// If no empty slot was found, let the player know about it and exit the function
		SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Numero mбximo de empresas atingido");
		return 1;
	}

	// Set some default data at the index of NextFreeBusinessID (NextFreeBusinessID will point to the next free business-index)
	ABusinessData[BusID][BusinessX] = x;
	ABusinessData[BusID][BusinessY] = y;
	ABusinessData[BusID][BusinessZ] = z;
	ABusinessData[BusID][BusinessType] = BusType;
	ABusinessData[BusID][BusinessLevel] = 1;
	ABusinessData[BusID][Owned] = false;

	// Add the pickup and 3DText at the location of the business-entrance (where the player is standing when he creates the business)
	Business_CreateEntrance(BusID);

	// Save the business
	BusinessFile_Save(BusID);

	// Inform the player that he created a new house
	format(Msg, 128, "{FFFFFF}Empresa criada com sucesso. ID: {ffffff}%i{FF0000}.", BusID);
	SendClientMessage(playerid, 0xFFFFFFFF, Msg);

	return 1;
}
Reply


Messages In This Thread
Criar empresa bugado - by ROBSONSOARES - 05.04.2019, 17:44
Re: Criar empresa bugado - by Feconito - 05.04.2019, 17:47
Re: Criar empresa bugado - by ROBSONSOARES - 05.04.2019, 17:57
Re: Criar empresa bugado - by Don_Speed - 05.04.2019, 18:19

Forum Jump:


Users browsing this thread: 1 Guest(s)