businessthing1[100],
businessthing2[100],
businessthing3[100],
enum bInfo {
BusinessItem1,
BusinessItem2,
BusinessItem3[28] // We'll say this is a string.
}
new Business[100][bInfo];
new Business[max_businesses][100][binfo]
I have a system, that players can buy like a business, and each business has 100 slots, like in the enum:
pawn Код:
|
enum E_BUSINESS {
BUSINESS_NAME1[MAX_PLAYERS][24], // is string
BUSINESS_NAME2[MAX_PLAYERS][24], // ...
BUSINESS_NAME3[MAX_PLAYERS][24], // eof string
BUSINESS_COST1[MAX_PLAYERS] // is integer
BUSINESS_COST2[MAX_PLAYERS] // ...
BUSINESS_COST3[MAX_PLAYERS] // eof integer
}
new business[100][E_BUSINESS]; // declaration
business[0][BUSINESS_NAME2][playerid] = "My Bussuname"; // set varlue
business[0][BUSINESS_COST2][playerid] = 10000;
// Test
for (new i; i < 100; i++) {
printf("index %d bussuname '%s' cost $%d", i, business[i][BUSINESS_NAME2][playerid], business[i][BUSINESS_COST2][playerid]);
}
#define MAX_BUSINESS (1000)
enum E_BUSINESS {
BUSINESS_NAME1[24], // is string
BUSINESS_NAME2[24],
BUSINESS_NAME3[24],
BUSINESS_COST1, // is integer
BUSINESS_COST2,
BUSINESS_COST3
}
new business[MAX_BUSINESS][E_BUSINESS]; // declaration
main()
{
format(business[0][BUSINESS_NAME1], 24, "%s", "My Bussuname"); // set business name
business[0][BUSINESS_COST1] = 10000; // set business cost
for (new i; i < MAX_BUSINESS; i++) {
printf("index %d bussuname '%s' cost $%d", i, business[i][BUSINESS_NAME1], business[i][BUSINESS_COST1]); // Show all business
}
}
enum E_BUSINESS {
BUSINESS_NAME1[24], // is string
BUSINESS_NAME2[24],
BUSINESS_NAME3[24],
BUSINESS_COST1, // is integer
BUSINESS_COST2,
BUSINESS_COST3,
BUSINESS_OWNERS[MAX_PLAYERS] // is integer
}
main()
{
format(business[0][BUSINESS_NAME1], 24, "%s", "My Bussuname"); // set business name
business[0][BUSINESS_COST1] = 10000; // set business cost
business[0][BUSINESS_OWNERS][0] = 1; // set business stat for player ID 0
for (new i; i < MAX_BUSINESS; i++) {
printf("index %d bussuname '%s' cost $%d", i, business[i][BUSINESS_NAME1], business[i][BUSINESS_COST1]); // Show all business
}
}