Lil help with this command please
#1

I've been trying to get this command to work right but i just can't get it, Anyone mind giving me a hand?

pawn Код:
if(strcmp(cmd, "/buybiz", true) == 0)
    {
    if(IsPlayerConnected(playerid)) {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        GetPlayerName(playerid, playername, sizeof(playername));
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        if(PlayerInfo[playerid][pBiz1] != 999 && PlayerInfo[playerid][pBiz2] != 999) {
            SendClientMessage(playerid, COLOR_WHITE, "You allready own 2 business sell one first to purchase this one");
            return 1;
        }
        for (new ba = 0; ba < sizeof(SBizzInfo); ba++) {
            if(PlayerToPoint(2.0, playerid, SBizzInfo[ba][sbEntranceX], SBizzInfo[ba][sbEntranceY], SBizzInfo[ba][sbEntranceZ]) && SBizzInfo[ba][sbOwned] == 0) {
                if(PlayerInfo[playerid][pLevel] < SBizzInfo[ba][sbLevelNeeded]) {
                    format(string, sizeof(string), "You Must Be Level %d To Purchase This",SBizzInfo[ba][sbLevelNeeded]);
                    SendClientMessage(playerid, COLOR_GRAD5, string);
                    return 1;
                }
                if(PlayerInfo[playerid][pBiz1] == 999) {
                    if(GetPlayerMoney(playerid) > SBizzInfo[ba][sbBuyPrice]) {
                        PlayerInfo[playerid][pBiz1] = ba+100;
                        SBizzInfo[ba][sbOwned] = 1;
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        strmid(SBizzInfo[ba][sbOwner], sendername, 0, strlen(sendername), 255);
                        SafeGivePlayerMoney(playerid,-SBizzInfo[ba][sbBuyPrice]);
                        PlayerPlayMusic(playerid);
                        SendClientMessage(playerid, COLOR_WHITE, "Congratulations, On Your New Purchase.");
                        SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new business help section.");
                        DateProp(playerid);
                        SaveSQLSBizz(ba+1);
                        OnplayerSqlUpdate(playerid);
                        return 1;
                    }
                    if(PlayerInfo[playerid][pBiz2] == 999) {
                        if(GetPlayerMoney(playerid) > SBizzInfo[ba][sbBuyPrice]) {
                            PlayerInfo[playerid][pBiz2] = ba+100;
                            SBizzInfo[ba][sbOwned] = 1;
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            strmid(SBizzInfo[ba][sbOwner], sendername, 0, strlen(sendername), 255);
                            SafeGivePlayerMoney(playerid,-SBizzInfo[ba][sbBuyPrice]);
                            PlayerPlayMusic(playerid);
                            SendClientMessage(playerid, COLOR_WHITE, "Congratulations, On Your New Purchase.");
                            SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new business help section.");
                            DateProp(playerid);
//OnPropUpdate();
                            SaveSQLSBizz(ba+1);
                            OnplayerSqlUpdate(playerid);
                            return 1;
                        }
                        }
                    }
                }
//Bizzinfo
                else if(PlayerInfo[playerid][pBiz1] != 999 && PlayerInfo[playerid][pBiz2] != 999) {
                    SendClientMessage(playerid, COLOR_WHITE, "You allready own 2 business sell one first to purchase this one");
                    return 1;
                }
            for(new bs = 0; bs < sizeof(BizzInfo); bs++) {
                    if(PlayerToPoint(2.0, playerid, BizzInfo[bs][bEntranceX], BizzInfo[bs][bEntranceY], BizzInfo[bs][bEntranceZ]) && BizzInfo[bs][bOwned] == 0) {
                        if(PlayerInfo[playerid][pLevel] < BizzInfo[bs][bLevelNeeded]) {
                            format(string, sizeof(string), "You Must Be Level %d To Purchase This",BizzInfo[bs][bLevelNeeded]);
                            SendClientMessage(playerid, COLOR_GRAD5, string);
                            return 1;
                        }
                        if(PlayerInfo[playerid][pBiz1] == 999) {
                            if(GetPlayerMoney(playerid) > BizzInfo[bs][bBuyPrice]) {
                                PlayerInfo[playerid][pBiz1] = bs;
                                BizzInfo[bs][bOwned] = 1;
                                GetPlayerName(playerid, sendername, sizeof(sendername));
                                strmid(BizzInfo[bs][bOwner], sendername, 0, strlen(sendername), 255);
                                SafeGivePlayerMoney(playerid,-BizzInfo[bs][bBuyPrice]);
                                PlayerPlayMusic(playerid);
                                SetPlayerInterior(playerid,BizzInfo[bs][bInterior]);
                                PlayerInfo[playerid][pInt] = BizzInfo[bs][bInterior];
                                SetPlayerPos(playerid,BizzInfo[bs][bExitX],BizzInfo[bs][bExitY],BizzInfo[bs][bExitZ]);
                                GameTextForPlayer(playerid, "~w~Welcome~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);
                                PlayerInfo[playerid][pInt] = BizzInfo[bs][bInterior];
                                PlayerInfo[playerid][pLocal] = bs ;
                                SendClientMessage(playerid, COLOR_WHITE, "Congratulations, On Your New Purchase.");
                                SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new business help section.");
                                DateProp(playerid);
//OnPropUpdate();
                                SaveSQLBizz(bs+1);
                                OnplayerSqlUpdate(playerid);
                                return 1;
                            }
                            if(PlayerInfo[playerid][pBiz2] == 999) {
                                if(GetPlayerMoney(playerid) > BizzInfo[bs][bBuyPrice]) {
                                    PlayerInfo[playerid][pBiz2] = bs;
                                    BizzInfo[bs][bOwned] = 1;
                                    GetPlayerName(playerid, sendername, sizeof(sendername));
                                    strmid(BizzInfo[bs][bOwner], sendername, 0, strlen(sendername), 255);
                                    SafeGivePlayerMoney(playerid,-BizzInfo[bs][bBuyPrice]);
                                    PlayerPlayMusic(playerid);
                                    SetPlayerInterior(playerid,BizzInfo[bs][bInterior]);
                                    PlayerInfo[playerid][pInt] = BizzInfo[bs][bInterior];
                                    SetPlayerPos(playerid,BizzInfo[bs][bExitX],BizzInfo[bs][bExitY],BizzInfo[bs][bExitZ]);
                                    GameTextForPlayer(playerid, "~w~Welcome~n~You can exit at any time by moving to this door and typing /exit", 5000, 3);
                                    PlayerInfo[playerid][pInt] = BizzInfo[bs][bInterior];
                                    PlayerInfo[playerid][pLocal] = bs ;
                                    SendClientMessage(playerid, COLOR_WHITE, "Congratulations, On Your New Purchase.");
                                    SendClientMessage(playerid, COLOR_WHITE, "Type /help to review the new business help section.");
                                    DateProp(playerid);
//OnPropUpdate();
                                    SaveSQLBizz(bs+1);
                                    OnplayerSqlUpdate(playerid);
                                    return 1;
                                }
                                else {
                                    SendClientMessage(playerid, COLOR_WHITE, "You don't have the cash for that");
                                }
                            }
                        }
                    }
                }
            }
        }
//    }
    return 1;
    }
It's suppose to set your biz1 for the biz your next to. If you already own biz1 then it's suppose to set your biz2 key, I'm having problems since i got bizzinfo and sbizzinfo both are diffrent types of bizzes
Reply
#2

Nope, none at all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)