Does not save up on relog.
#3

For example, I save the business ID to the players enum. Maybe my command will help you:
pawn Код:
CMD:buybusiness(playerid, params[])
{
    for(new i = 0; i < MAX_BUSINESS; i++)
    {
        if(!IsPlayerInRangeOfPoint(playerid, 3.0, BizInfo[i][bExtX],BizInfo[i][bExtY],BizInfo[i][bExtZ])) continue;
        {
            if(strcmp(BizInfo[i][bOwner], "For Sale!"))
            {
                SendClientMessage(playerid, COLOR_RED, "(INFO)"COL_WHITE" This business has already been purchased.");
                return PlayerPlaySound(playerid, 1190, 0.0, 0.0, 0.0);
            }

            if(PlayerInfo[playerid][pBusiness] != -1)
            {
                SendClientMessage(playerid, COLOR_RED, "(INFO)"COL_WHITE" You already own a business. Sell it before purchasing another.");
                return PlayerPlaySound(playerid, 1190, 0.0, 0.0, 0.0);
            }

            if(PlayerInfo[playerid][pCash] >= BizInfo[i][bPrice])
            {
                format(BizInfo[i][bOwner], MAX_PLAYER_NAME, "%s", GetPlayerNameEx(playerid)); //Sets him owner in Biz file.
                PlayerInfo[playerid][pBusiness] = i;

                SaveBiz(i);
                DestroyDynamic3DTextLabel(BizLabel[PlayerInfo[playerid][pBusiness]]);
                DestroyDynamicPickup(BizPickup[PlayerInfo[playerid][pBusiness]]);
                LoadBusiness(i);
                PlayerInfo[playerid][pCash] -= BizInfo[PlayerInfo[playerid][pBusiness]][bPrice];
                SaveUser(playerid);
                SendClientMessage(playerid, COLOR_GREEN, "(INFO) Congratulations on your purchase! For more help, use /bizhelp!");
                return PlayerPlaySound(playerid, 1190, 0.0, 0.0, 0.0);
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "|-- You don't have enough money to purchase this business.");
            }
        }
    }
    SendClientMessage(playerid, COLOR_RED, "(INFO)"COL_WHITE" You're not in range of a business.");
    PlayerPlaySound(playerid, 1190, 0.0, 0.0, 0.0);
    return 1;
}
Reply


Messages In This Thread
Does not save up on relog. - by benjaminjones - 22.03.2014, 20:44
Re: Does not save up on relog. - by Zeppo - 22.03.2014, 20:46
Re: Does not save up on relog. - by Zeppo - 22.03.2014, 20:48
Re: Does not save up on relog. - by benjaminjones - 22.03.2014, 20:57
Re: Does not save up on relog. - by benjaminjones - 22.03.2014, 20:59
Re: Does not save up on relog. - by benjaminjones - 23.03.2014, 11:06

Forum Jump:


Users browsing this thread: 1 Guest(s)