SA-MP Forums Archive
3dtextlabel fucked up - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 3dtextlabel fucked up (/showthread.php?tid=427049)



3dtextlabel fucked up - Chrillzen - 31.03.2013

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:




Re: 3dtextlabel fucked up - RajatPawar - 31.03.2013

What's the problem? I see none.


Re: 3dtextlabel fucked up - Gamer_007 - 31.03.2013

So whats the problem?


Re: 3dtextlabel fucked up - Chrillzen - 31.03.2013

The colors are messed up, the price is not right and there's no owner? If there's no owner it should say none, but there's no string. It works when I buy/sell/changename just does not work when it loads ongamemodeinit.


Re: 3dtextlabel fucked up - Threshold - 31.03.2013

Can you show your 'loadbiz' function, you might not be loading these statistics properly. Alternatively, you can try using hex or color embedding like so: {FF0000} = Red etc. rather than "COLORRED". These are destined not to fail. Although, this still shouldn't be happening and I doubt it's because you're using defines rather than color embedding. So just give us a little sneak peek at your loadbiz function, and your saving system if possible.


Re: 3dtextlabel fucked up - Chrillzen - 31.03.2013

pawn Код:
forward SaveBusiness(id);
public SaveBusiness(id)
{
    new file4[40];
    format(file4, sizeof(file4), BPATH, id);
    new INI:File = INI_Open(file4);
    INI_SetTag(File,"data");
    INI_WriteInt(File,"bOwned", BusinessInfo[id][bOwned]);
    INI_WriteInt(File,"bPrice", BusinessInfo[id][bPrice]);
    INI_WriteString(File,"bOwner", BusinessInfo[id][bOwner]);
    INI_WriteInt(File,"bType", BusinessInfo[id][bType]);
    INI_WriteInt(File,"bLocked", BusinessInfo[id][bLocked]);
    INI_WriteInt(File,"bMoney", BusinessInfo[id][bMoney]);
    INI_WriteFloat(File,"bEntranceX", BusinessInfo[id][bEntranceX]);
    INI_WriteFloat(File,"bEntranceY", BusinessInfo[id][bEntranceY]);
    INI_WriteFloat(File,"bEntranceZ", BusinessInfo[id][bEntranceZ]);
    INI_WriteFloat(File,"bEntranceA", BusinessInfo[id][bEntranceA]);
    INI_WriteFloat(File,"bExitX", BusinessInfo[id][bExitX]);
    INI_WriteFloat(File,"bExitY", BusinessInfo[id][bExitY]);
    INI_WriteFloat(File,"bExitZ", BusinessInfo[id][bExitZ]);
    INI_WriteFloat(File,"bExitA", BusinessInfo[id][bExitA]);
    INI_WriteInt(File,"bInt", BusinessInfo[id][bInt]);
    INI_WriteInt(File,"bWorld", BusinessInfo[id][bWorld]);
    INI_WriteInt(File,"bInsideInt", BusinessInfo[id][bInsideInt]);
    INI_WriteInt(File,"bInsideWorld", BusinessInfo[id][bInsideWorld]);
    INI_WriteInt(File,"DLabel", BusinessInfo[id][DLabel]);
    INI_WriteInt(File,"On_Sell", BusinessInfo[id][On_Sell]);
    INI_WriteString(File,"bName", BusinessInfo[id][bName]);
    INI_Close(File);
    return 1;
}

forward loadbiz_data(idx, name[], value[]);
public loadbiz_data(idx, name[], value[])
{
    INI_Int("bOwned", BusinessInfo[idx][bOwned]);
    INI_Int("bPrice", BusinessInfo[idx][bPrice]);
    INI_String("bOwner", BusinessInfo[idx][bOwner], 24);
    INI_Int("bType", BusinessInfo[idx][bType]);
    INI_Int("bLocked", BusinessInfo[idx][bLocked]);
    INI_Int("bMoney", BusinessInfo[idx][bMoney]);
    INI_Float("bEntranceX", BusinessInfo[idx][bEntranceX]);
    INI_Float("bEntranceY", BusinessInfo[idx][bEntranceY]);
    INI_Float("bEntranceZ", BusinessInfo[idx][bEntranceZ]);
    INI_Float("bEntranceA", BusinessInfo[idx][bEntranceA]);
    INI_Float("bExitX", BusinessInfo[idx][bExitX]);
    INI_Float("bExitY", BusinessInfo[idx][bExitY]);
    INI_Float("bExitZ", BusinessInfo[idx][bExitZ]);
    INI_Float("bExitA", BusinessInfo[idx][bExitA]);
    INI_Int("bInt", BusinessInfo[idx][bInt]);
    INI_Int("bWorld", BusinessInfo[idx][bWorld]);
    INI_Int("bInsideInt", BusinessInfo[idx][bInsideInt]);
    INI_Int("bInsideWorld", BusinessInfo[idx][bInsideWorld]);
    INI_Int("DLabel", BusinessInfo[idx][DLabel]);
    INI_Int("On_Sell", BusinessInfo[idx][On_Sell]);
    INI_String("bName", BusinessInfo[idx][bName], 128);
    return 1;
}



Re: 3dtextlabel fucked up - Chrillzen - 31.03.2013

Anyone?