SA-MP Forums Archive
[Ajuda] /Comprarprods - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] /Comprarprods (/showthread.php?tid=276102)



[Ajuda] /Comprarprods - Sr.Pekeno - 12.08.2011

Estou com um probleminha meu /comprarprods nгo estб atualmente comprando os produtos, nгo sei o motivo ele mostra isso Produtos: %d/%d. ao invez de mostrar isso Vocк comprou %d por R$ %d, eu tentei tirar a parte de onde mostra os produtos mais da Erro, eu acho que a funзгo estб trocado o produto acima e o comprou abaixo, se puder me ajudar agradeзo.




pawn Код:
if(strcmp(cmd, "/comprarprods", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new vId = GetPlayerVehicleID(playerid);
            new tmpcar = GetPlayerVehicleID(playerid);
            new compcost = 50;
            if(PlayerToPoint(60.0, playerid, 1750.9022,-2054.1663,14.1010))
            {
                if(vId >= Produtos[0] && vId <= Produtos[3]){
                    if(PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
                    {
                        new amount;
                        tmp = strtok(cmdtext, idx);
                        if(!strlen(tmp))
                        {
                            SendClientMessage(playerid, COLOR_GRAD1, "USO: /comprarprods [quantia]");
                            return 1;
                        }
                        amount = strval(tmp);
                        if(amount < 1 || amount > 500) { SendClientMessage(playerid, COLOR_GREY, "   Can't buy less then 1 Product ou more then 500 !"); return 1; }
                        new check= PlayerHaul[tmpcar][pLoad] + amount;
                        if(check > PlayerHaul[tmpcar][pCapasity])
                        {
                            format(string, sizeof(string), "   Vocк ultrapassou o limite de produtos %d, seus carregamentos %d",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pLoad]);
                            SendClientMessage(playerid, COLOR_GREY, string);
                            return 1;
                        }
                        new cost = amount*compcost;
                        if(GetPlayerGP(playerid) >= cost)
                        {
                            PlayerHaul[tmpcar][pLoad] += amount;
                            format(string, sizeof(string), "Produtos: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            format(string, sizeof(string), "Vocк comprou %d por R$ %d", amount,cost);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                            GivePlayerGP(playerid,-cost);
                            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
                            return 1;
                        }
                        else
                        {
                            format(string, sizeof(string), "    Vocк nгo pфde pagar os produtos por R$ %d !", amount,cost);
                            SendClientMessage(playerid, COLOR_GREY, string);
                            return 1;
                        }
                    }
                    else
                    {
                            format(string, sizeof(string), "Produtos: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            return 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "    Esse veнculo nгo faz entrega de produtos");
                    return 1;
                }
            }
        }
        return 1;
    }



Re: [Ajuda] /Comprarprods - Allan Kardec - 12.08.2011

Nos poste essas informaзхes.

pawn Код:
PlayerHaul[tmpcar][pLoad]
pawn Код:
PlayerHaul[tmpcar][pCapasity]



Re: [Ajuda] /Comprarprods - Victos_xd - 12.08.2011

Pq nao?


Re: [Ajuda] /Comprarprods - MaGnO_357 - 12.08.2011

vixi de rpg nгo entendo nads :/