03.07.2015, 18:54
Код:
CODE HERE
CODE HERE
ShowPlayerDialog(playerid, check here, DIALOG_STYLE_LIST, "businesses:", BusinessList, "Selecionar", "Cancelar");
// Lets the player add new businesses
COMMAND:createbusiness(playerid, params[])
{
// Setup local variables
new BusinessList[2000];
// If a player hasn't logged in properly, he cannot use this command
if (INT_IsPlayerLoggedIn(playerid) == 0) return 0;
// If the player has an insufficient admin-level (he needs level 5 or RCON admin), exit the command
// returning "SERVER: Unknown command" to the player
if (INT_CheckPlayerAdminLevel(playerid, 5) == 0) return 0;
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player isn't inside a vehicle
if (GetPlayerVehicleSeat(playerid) == -1)
{
// Construct the list of businesses
for (new BusType = 1; BusType < sizeof(ABusinessInteriors); BusType++)
{
format(BusinessList, sizeof(BusinessList), "%s%s\n", BusinessList, ABusinessInteriors[BusType][InteriorName]);
}
// Let the player choose a business-type via a dialog
ShowPlayerDialog(playerid, DialogCreateBusSelType, DIALOG_STYLE_LIST, "Escolha o Tipo de Empresa:", BusinessList, "Selecionar", "Cancelar");
}
else
SendClientMessage(playerid, 0xFF0000FF, "You must be on foot to create a business");
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
new ABusinessInteriors[][TBusinessType] =
{
{"Dummy", 0, 0.0, 0.0, 0.0, 0, 0, 0}, // Dummy business (Type 0)
{"24/7 (pequeno)", 6, -26.75, -55.75, 1003.6, 500000, 200, 52}, // Type 1 (earnings per day: $1200)
{"24/7 (Medio)", 18, -31.0, -89.5, 1003.6, 750000, 250, 52}, // Type 2 (earnings per day: $1800)
{"Bar", 11, 502.25, -69.75, 998.8, 350000, 150, 49}, // Type 3 (earnings per day: $840)
{"Barbearia (pequena)", 2, 411.5, -21.25, 1001.8, 300000, 160, 7}, // Type 4 (earnings per day: $720)
{"Barbearia (Medio)", 3, 418.75, -82.5, 1001.8, 350000, 180, 7}, // Type 5 (earnings per day: $840)
{"Loja de apostas", 3, 833.25, 7.0, 1004.2, 1500000, 400, 52}, // Type 6 (earnings per day: $3600)
{"Burger Shot", 10, 363.5, -74.5, 1001.5, 750000, 300, 10}, // Type 7 (earnings per day: $1800)
{"Casino (4 Dragons)", 10, 2017.25, 1017.75, 996.9, 2500000, 1000, 44}, // Type 8 (earnings per day: $6000)
{"Casino (Caligula's)", 1, 2234.0, 1710.75, 1011.3, 2500000, 1000, 25}, // Type 9 (earnings per day: $6000)
{"Casino (Small)", 12, 1133.0, -9.5, 1000.7, 2000000, 900, 43}, // Type 10 (earnings per day: $4800)
{"Loja de Roupas (Binco)", 15, 207.75, -109.0, 1005.2, 850000, 300, 45}, // Type 11 (earnings per day: $2040)
{"Loja de Roupas (Pro)", 3, 207.0, -138.75, 1003.5, 850000, 300, 45}, // Type 12 (earnings per day: $2040)
{"Loja de Roupas (Urban)", 1, 203.75, -48.5, 1001.8, 850000, 300, 45}, // Type 13 (earnings per day: $2040)
{"Loja de Roupas (Victim)", 5, 226.25, -7.5, 1002.3, 850000, 300, 45}, // Type 14 (earnings per day: $2040)
{"Loja de Roupas (ZIP)", 18, 161.5, -92.25, 1001.8, 850000, 300, 45}, // Type 15 (earnings per day: $2040)
{"Cluckin' Bell", 9, 365.75, -10.75, 1001.9, 750000, 180, 14}, // Type 16 (earnings per day: $1800)
{"Disco (pequeno)", 17, 492.75, -22.0, 1000.7, 1000000, 250, 48}, // Type 17 (earnings per day: $2400)
{"Disco (grande)", 3, -2642.0, 1406.5, 906.5, 1200000, 350, 48}, // Type 18 (earnings per day: $2880)
{"Academia (LS)", 5, 772.0, -3.0, 1000.8, 500000, 350, 54}, // Type 19 (earnings per day: $1200)
{"Academia (SF)", 6, 774.25, -49.0, 1000.6, 500000, 350, 54}, // Type 20 (earnings per day: $1200)
{"Academia (LV)", 7, 774.25, -74.0, 1000.7, 500000, 350, 54}, // Type 21 (earnings per day: $1200)
{"Motel", 15, 2216.25, -1150.5, 1025.8, 1000000, 700, 37}, // Type 22 (earnings per day: $2400)
{"RC shop", 6, -2238.75, 131.0, 1035.5, 600000, 189, 46}, // Type 23 (earnings per day: $1440)
{"Sex-shop", 3, -100.25, -22.75, 1000.8, 800000, 240, 38}, // Type 24 (earnings per day: $1920)
{"Matadouro", 1, 933.75, 2151.0, 1011.1, 500000, 250, 50}, // Type 25 (earnings per day: $1200)
{"Stadio (Bloodbowl)", 15, -1394.25, 987.5, 1024.0, 1750000, 350, 33}, // Type 26 (earnings per day: $4200)
{"Stadio (Kickstart)", 14, -1410.75, 1591.25, 1052.6, 1750000, 350, 33}, // Type 27 (earnings per day: $4200)
{"Stadio (8-Track)", 7, -1396.0, -208.25, 1051.2, 1750000, 350, 33}, // Type 28 (earnings per day: $4200)
{"Stadio (Dirt Bike)", 4, -1425.0, -664.5, 1059.9, 1750000, 350, 33}, // Type 29 (earnings per day: $4200)
{"Clube de Strip (pequeno)",3, 1212.75, -30.0, 1001.0, 750000, 120, 48}, // Tipo 30 (ganhos por dia: R$2880)
{"Clube de Strip (grande)",2, 1204.75, -12.5, 1001.0, 900000, 150, 48}, // Tipo 31 (ganhos por dia: R$3600)
{"Tattoo LS",16, -203.0, -24.25, 1002.3, 500000, 100, 39}, // Tipo 32 (ganhos por dia: R$2400)
{"Pizzaria",5, 372.25, -131.50, 1001.5, 650000, 200, 29}, // Tipo 33 (ganhos por dia: R$4800)
{"Posto",18, 1302.519897, -1.787510, 1001.028259, 800000, 500, 55}, // Tipo 34 (ganhos por dia: R$12000)
{"Hotel",18, 1710.433715, -1669.379272, 20.225049, 750000, 450, 32}, // Tipo 35 (ganhos por dia: R$10800)
{"Banco",0,2319.714843, -14.838361, 26.749565, 1000000, 800, 52},
{"Oficina",0,-1790.378295,1436.949829,7.187500, 600000, 350, 27},
{"Transportadora",1,1412.639892,-1.787510,1000.924377, 800000, 600, 51}
};
// This dialog processes the chosen business-type and creates the business
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, "{00FF00}You've succesfully created business {FFFF00}%i{00FF00}", BusID);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
return 1;
}