31.03.2013, 09:48
My code; OnGameModeInit.
How it looks in-game:
How it should look like:
pawn Код:
new biztext[128];
for(new idx = 1; idx < sizeof(BusinessInfo); idx++)//Creates a loop, that goes through all of the businesses.
{
format(MessageString, sizeof(MessageString), BPATH, idx);//formats the file path, with the biz ID
INI_ParseFile(MessageString, "loadbiz_%s", .bExtra = true, .extra = idx );//This is very hard to explain, but it basically loads the info from the file(More in ****** y_ini tutorial.)
BusinessInfo[idx][bOutsideIcon] = CreateDynamicPickup(1272, 1, BusinessInfo[idx][bEntranceX], BusinessInfo[idx][bEntranceY], BusinessInfo[idx][bEntranceZ], BusinessInfo[idx][bWorld]); //Creates a pickup at the business entrance.
switch(BusinessInfo[idx][bType])
{
case 1: biztext = "Bar";
case 2: biztext = "Restaurant";
case 3: biztext = "Phone Company";
case 4: biztext = "24/7";
}
if(BusinessInfo[idx][On_Sell] == 1)
{
format(MessageString,sizeof(MessageString),""COLORGREEN"Owner: "COL_WHITE"None\n"COLORGREEN"Price: "COL_WHITE"%d\n"COLORGREEN"Business type: "COL_WHITE"%s", BusinessInfo[idx][bPrice], biztext);
BusinessInfo[idx][DLabel] = CreateDynamic3DTextLabel(MessageString, 0xFFFFFF, BusinessInfo[idx][bEntranceX],BusinessInfo[idx][bEntranceY],BusinessInfo[idx][bEntranceZ], 100, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 10);
}
else if(BusinessInfo[idx][On_Sell] == 0)
{
format(MessageString,sizeof(MessageString),""COLORGREEN"Owner: "COL_WHITE"%s\n"COLORGREEN"Price: "COL_WHITE"%d\n"COLORGREEN"Business type: "COL_WHITE"%s",BusinessInfo[idx][bOwner], BusinessInfo[idx][bName], biztext);
BusinessInfo[idx][DLabel] = CreateDynamic3DTextLabel(MessageString, 0xFFFFFF, BusinessInfo[idx][bEntranceX],BusinessInfo[idx][bEntranceY],BusinessInfo[idx][bEntranceZ], 100, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 10);
}
}
return 1;
}
How it looks in-game:
How it should look like: