Not Updating Owner
#1

The Dynamic Text Label for Owner - Which is a string it suppose to change "The State" over to "Player Name" - Its not Updating it at all
NO ERRORS ON COMPILE!

pawn Код:
CMD:buybiz(playerid, params[])
{
    for(new biz = 0; biz < MAX_BIZ; biz++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[biz][ex], BizInfo[biz][ey], BizInfo[biz][ez]))
        {
            if(PlayerInfo[playerid][BizID] == -1)
            {
                if(BizInfo[biz][Owned] == 0)
                {
                    if(GetPlayerCash(playerid) >= BizInfo[biz][Price])
                    {
                        new string[128],string2[128], file[40];
                        new playername[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, playername, sizeof(playername));
                        BizInfo[biz][Owned] = 1;
                        format(file, sizeof(file), BPATH, biz);
                        new INI:File = INI_Open(file);
                        INI_WriteInt(File,"Owned", 1);
                        INI_WriteString(File,"Owner",GetPlayerNameEx(playerid));
                        INI_Close(File);
                        PlayerInfo[playerid][BizID] = biz;
                        GivePlayerCash(playerid, -BizInfo[biz][Price]);
                        format(string, sizeof(string),"You Have Bought Business ID (%d)", biz);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        DestroyDynamic3DTextLabel(Text3D:BizLabel[biz]);
                        format(string2,sizeof(string2),"Owner: "COL_WHITE"%s\n"COL_LBLUE"Biz Name: "COL_WHITE"%s\n"COL_BLUE"Type: "COL_WHITE"%d\n"COL_LIME"ID: "COL_WHITE"%d", BizInfo[biz][Owner], BizInfo[biz][Name], GetBizType(biz), biz);
                        BizLabel[biz] = CreateDynamic3DTextLabel(string2, COLOR_RED, BizInfo[biz][ex], BizInfo[biz][ey], BizInfo[biz][ez], 30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, -1, -1, 30.0);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You don't have enough cash for this business");
                    }
                }  
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "That business is already owned!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You already own a Business.");
            }
        }  
    }
    return 1;
}
Reply
#2

Try using UpdateDynamic3DTextLabel.

By the way, there's no need for your huge font, small ones do just fine.
Reply
#3

Just what RealCop said

pawn Код:
CMD:buybiz(playerid, params[])
{
    for(new biz = 0; biz < MAX_BIZ; biz++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[biz][ex], BizInfo[biz][ey], BizInfo[biz][ez]))
        {
            if(PlayerInfo[playerid][BizID] == -1)
            {
                if(BizInfo[biz][Owned] == 0)
                {
                    if(GetPlayerCash(playerid) >= BizInfo[biz][Price])
                    {
                        new string[128],string2[128], file[40];
                        new playername[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, playername, sizeof(playername));
                        BizInfo[biz][Owned] = 1;
                        format(file, sizeof(file), BPATH, biz);
                        new INI:File = INI_Open(file);
                        INI_WriteInt(File,"Owned", 1);
                        INI_WriteString(File,"Owner",GetPlayerNameEx(playerid));
                        INI_Close(File);
                        PlayerInfo[playerid][BizID] = biz;
                        GivePlayerCash(playerid, -BizInfo[biz][Price]);
                        format(string, sizeof(string),"You Have Bought Business ID (%d)", biz);
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        format(string2,sizeof(string2),"Owner: "COL_WHITE"%s\n"COL_LBLUE"Biz Name: "COL_WHITE"%s\n"COL_BLUE"Type: "COL_WHITE"%d\n"COL_LIME"ID: "COL_WHITE"%d", BizInfo[biz][Owner], BizInfo[biz][Name], GetBizType(biz), biz);
                        UpdateDynamic3DTextLabelText(Text3D:BizLabel[biz], COLOR_WHITE, string2); // Just what realcop said i just remove the Destroy3dtextlabel and create3dtextlabel you dont need to do that. just update the 3dtextlabel
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You don't have enough cash for this business");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "That business is already owned!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You already own a Business.");
            }
        }
    }
    return 1;
}
Reply
#4



Its Not Updating It shows the Old Text Label too.. HELP ME
Reply
#5

Then you are probably making more than one label in the same spot!
Reply
#6

No its Not.. Check that code
Reply
#7

Not in that code, no. However, what about when you're actually creating the business (at the start of the mode, that is)...?
Reply
#8

Ok i Fixed that issue now their is another
pawn Код:
BizInfo[biz][Owned] = INI_Int(File, "Owned");
When i use that code It Crashes my Pawno..
Reply
#9

You're missing a brace ( { or } ) somewhere.
Reply
#10

No Only when i use that code the Pawno Crashes, When i remove it - Pawno wont crash wtf?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)