Command is bugged
#1

Hello all


i have here a command, to buy a business, but it asks me to buy the license in the PD, but i buy the license, but it keeps asking me it.

The licence here is the PlayerInfo[playerid][pescritura]


Please could you fix it to dont check if i have the license or not?
Код:
if(strcmp(cmd, "/comprarbiz", true) == 0)
                {
                    if(IsPlayerConnected(playerid))
                    {
                                new Float:oldposx, Float:oldposy, Float:oldposz;
                                new playername[MAX_PLAYER_NAME];
                                GetPlayerName(playerid, playername, sizeof(playername));
                                GetPlayerPos(playerid, oldposx, oldposy, oldposz);
                                for(new h = 0; h < sizeof(Businesses); h++)
                                {
                                        if(PlayerToPoint(2.0, playerid, Businesses[h][EnterX], Businesses[h][EnterY], Businesses[h][EnterZ]) && Businesses[h][Owned] == 0)
                                        {
                                            if(Businesses[h][BizPrice] == 0)
                                            {
                                                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERRO:] Nao foi escolhido um preco para este negocio, possivelmente nao podera ser usado.");
                                                        return 1;
                                            }
                                                if(PlayerInfo[playerid][pBizKey] != 255 && strcmp(playername, Businesses[PlayerInfo[playerid][pBizKey]][Owner], true) == 0)
                                                {
                                                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERRO:] Ja tens um negocio, so poderas ter um negocio, para comprares um novo, vende o teu actual negocio primeiro!");
                                                        return 1;
                                                }
                                                if(Businesses[h][Owned] == 1)
                                                {
                                                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERRO:] Biz Já tem Dono.");
                                                        return 1;
                                                }
                                                if(GetPlayerCash(playerid) >= Businesses[h][BizPrice])
                                                {
                                                    if(PlayerInfo[playerid][pescritura] == 1)
                                                {
                                                    PlayerInfo[playerid][pescritura] = 0;
                                                                PlayerInfo[playerid][pBizKey] = h;
                                                                Businesses[h][Owned] = 1;
                                                                Businesses[h][Till] = 0;
                                                                strmid(Businesses[h][Owner], playername, 0, strlen(playername), 255);
                                                                GivePlayerCash(playerid,-Businesses[h][BizPrice]);
                                                                SetPlayerInterior(playerid,Businesses[h][ExitInterior]);
                                                                SetPlayerVirtualWorld(playerid,h);
                                                                SetPlayerPos(playerid,Businesses[h][ExitX],Businesses[h][ExitY],Businesses[h][ExitZ]);
                                                                SendClientMessage(playerid, COLOR_WHITE, "[INFO:] Compraste este negocio com sucesso!");
                                                        PlayerActionMessage(playerid,15.0,"retirou algum dinheiro, e recebeu a chave em troca.");
                                                                ChangeStreamPickupModel(Businesses[h][PickupID],1239);
                                                                SaveBusinesses();
                                                                OnPlayerDataSave(playerid);
                                                                return 1;
       }
       else
                                                        {
                                                                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "Tens que tratar da papelada na camara municipal!");
                                                                return 1;
                                                        }
                                                }
                                                else
                                                {
                                                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERRO:] Nao tens dinheiro suficiente!");
                                                        return 1;
                                                }
                                        }
                                }
                        }
                        return 1;
                }
here is the pastebin
http://pastebin.com/vDukbEQh


Thanks all
Reply
#2

You'r breckets was fucked up, and it should be good now, it wont check if you have license or no (atleast I understood you want this )

pawn Код:
if(strcmp(cmd, "/comprarbiz", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, sizeof(playername));
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        for(new h = 0; h < sizeof(Businesses); h++)
        {
            if(PlayerToPoint(2.0, playerid, Businesses[h][EnterX], Businesses[h][EnterY], Businesses[h][EnterZ]) && Businesses[h][Owned] == 0)
            {
                if(Businesses[h][BizPrice] == 0)
                {
                    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERRO:] Nao foi escolhido um preco para este negocio, possivelmente nao podera ser usado.");
                    return 1;
                }
                if(PlayerInfo[playerid][pBizKey] != 255 && strcmp(playername, Businesses[PlayerInfo[playerid][pBizKey]][Owner], true) == 0)
                {
                    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERRO:] Ja tens um negocio, so poderas ter um negocio, para comprares um novo, vende o teu actual negocio primeiro!");
                    return 1;
                }
                if(Businesses[h][Owned] == 1)
                {
                    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERRO:] Biz Ja' tem Dono.");
                    return 1;
                }
                if(GetPlayerCash(playerid) >= Businesses[h][BizPrice])
                {
                    PlayerInfo[playerid][pescritura] = 0;
                    PlayerInfo[playerid][pBizKey] = h;
                    Businesses[h][Owned] = 1;
                    Businesses[h][Till] = 0;
                    strmid(Businesses[h][Owner], playername, 0, strlen(playername), 255);
                    GivePlayerCash(playerid,-Businesses[h][BizPrice]);
                    SetPlayerInterior(playerid,Businesses[h][ExitInterior]);
                    SetPlayerVirtualWorld(playerid,h);
                    SetPlayerPos(playerid,Businesses[h][ExitX],Businesses[h][ExitY],Businesses[h][ExitZ]);
                    SendClientMessage(playerid, COLOR_WHITE, "[INFO:] Compraste este negocio com sucesso!");
                    PlayerActionMessage(playerid,15.0,"retirou algum dinheiro, e recebeu a chave em troca.");
                    ChangeStreamPickupModel(Businesses[h][PickupID],1239);
                    SaveBusinesses();
                    OnPlayerDataSave(playerid);
                    return 1;
                }
                return 1;
            }

        }
    }
    return 1;
}
Reply
#3

yea, its everithing fucked up.

It Worked, thanks a lot. +repped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)