Not Updating Owner
#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


Messages In This Thread
Not Updating Owner - by San1 - 22.07.2013, 22:05
Re: Not Updating Owner - by Scenario - 22.07.2013, 22:40
Re: Not Updating Owner - by ToiletDuck - 23.07.2013, 01:24
Re: Not Updating Owner - by San1 - 23.07.2013, 03:41
Re: Not Updating Owner - by Scenario - 23.07.2013, 03:50
Re: Not Updating Owner - by San1 - 23.07.2013, 04:23
Re: Not Updating Owner - by Scenario - 23.07.2013, 04:39
Re: Not Updating Owner - by San1 - 23.07.2013, 04:41
Re: Not Updating Owner - by Scenario - 23.07.2013, 04:47
Re: Not Updating Owner - by San1 - 23.07.2013, 04:48

Forum Jump:


Users browsing this thread: 1 Guest(s)