27.08.2016, 17:22
Saudaзхes,
Observo mas nгo vejo nada de errado com o sistema de empresas, nгo estб lucrando de maneira nenhuma. O objetivo do PayDay й de 1 em 1 hora, mas nгo estб funcionando, gostaria da ajuda de vocкs, por favor. Obrigado desde jб.
Essas sгo as trкs funзхes que geram o dinheiro por hora.
Observo mas nгo vejo nada de errado com o sistema de empresas, nгo estб lucrando de maneira nenhuma. O objetivo do PayDay й de 1 em 1 hora, mas nгo estб funcionando, gostaria da ajuda de vocкs, por favor. Obrigado desde jб.
Код:
forward Business_TransactionTimer();
public Business_TransactionTimer()
{
// Increase the variable by one
BusinessTransactionTime++;
// And save it to the file
BusinessTime_Save();
}
Код:
// This function sets ownership to the given player
Business_SetOwner(playerid, BusID)
{
// Setup local variables
new BusSlotFree, Name[24], Msg[128], BusType;
// Get the first free business-slot from this player
BusSlotFree = Player_GetFreeBusinessSlot(playerid);
// Check if the player has a free business-slot
if (BusSlotFree != -1)
{
// Get the player's name
GetPlayerName(playerid, Name, sizeof(Name));
// Store the business-id for the player
APlayerData[playerid][Business][BusSlotFree] = BusID;
// Get the business-type
BusType = ABusinessData[BusID][BusinessType];
// Let the player pay for the business
RewardPlayer(playerid, -ABusinessInteriors[BusType][BusPrice], 0);
// Set the business as owned
ABusinessData[BusID][Owned] = true;
// Store the owner-name for the business
format(ABusinessData[BusID][Owner], 24, Name);
// Set the level to 1
ABusinessData[BusID][BusinessLevel] = 1;
// Set the default business-name
format(ABusinessData[BusID][BusinessName], 100, ABusinessInteriors[BusType][InteriorName]);
// Store the current transaction-time (this is used so the player can only retrieve cash from the business from the moment he bought it)
ABusinessData[BusID][LastTransaction] = BusinessTransactionTime;
// Also, update 3DText of this business
Business_UpdateEntrance(BusID);
// Save the player-file (and also his houses/businesses)
PlayerFile_Save(playerid);
// Let the player know he bought the business
format(Msg, 128, TXT_PlayerBoughtBusiness, ABusinessInteriors[BusType][BusPrice]);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
else
SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerOwnsMaxBusinesses);
return 1;
}
Код:
// This function pays the current earnings of the given business to the player
Business_PayEarnings(playerid, BusID)
{
new Msg[2000];
new BusType = ABusinessData[BusID][BusinessType];
new Earnings = (BusinessTransactionTime + ABusinessData[BusID][LastTransaction]) * ABusinessInteriors[BusType][BusEarnings] * ABusinessData[BusID][BusinessLevel];
ABusinessData[BusID][LastTransaction] = BusinessTransactionTime;
RewardPlayer(playerid, Earnings, 0);
format(Msg, 2000, "{a9c4e4}Vocк ganhou na sua empresa {00ff00}R${ffffff}%i{a9c4e4} desde a sua ъltima retirada.", Earnings);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}


