Help with 3DTEXTLABEL
#1

My code; OnGameModeInit.

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:

Reply
#2

This should work for you.

pawn Код:
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);
    }
    }
Reply
#3

Embedding the colors does not do anything, same stuff.
Reply
#4

Have you tried doing it?
Reply
#5

Yes... I tried your code.
Reply
#6

Check the second format

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][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);
    }
    }
    return 1;
}
I think that should fix it, if not check the variables at the end of the format.
Reply
#7

Nice indentation.
Reply
#8

Quote:
Originally Posted by MP2
Посмотреть сообщение
Nice indentation.
This is the section where you're supposed to help, not be an asshole.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)