[AJUDA] Carros Criados Bug
#1

Tipo quando uso o cmd para criar os carros eles vem ae quando vo usar o cmd para destruir eles fica falando q so posso destruir carros criados sera q alguem pode me ajudar ae agradeзo.
Reply
#2

Poste o comando de destruir e de criar. E a variбvel que vocк tб usando. Meu bot (L)
Reply
#3

Comando de Criar:

pawn Код:
}
    if(strcmp(cmd, "/kray", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if (PlayerInfo[playerid][pAdmin] < 1340)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Voce nгo esta autorizado a usar este comando!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
                return 1;
            }
            new car;
            car = strval(tmp);
            if(car < 400 || car > 612) { SendClientMessage(playerid, COLOR_GREY, "   Vehicle Number can't be below 400 or above 611 !"); return 1; }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
                return 1;
            }
            new color1;
            color1 = strval(tmp);
            if(color1 < 0 || color1 > 126) { SendClientMessage(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 126 !"); return 1; }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [carid] [color1] [color2]");
                return 1;
            }
            new color2;
            color2 = strval(tmp);
            if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, "   Color Number can't be below 0 or above 126 !"); return 1; }
            new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid, X,Y,Z);
            new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 60000);
            CreatedCars[CreatedCar] = carid;
            CreatedCar ++;
            format(string, sizeof(string), "   Vehicle %d spawned.", carid);
            SendClientMessage(playerid, COLOR_GREY, string);
        }
        return 1;
    }
COmando De Destruir:
pawn Код:
}
    if(!strcmp("/destruirid", cmdtext, true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 1)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   Vocк nгo estб autorizado a usar este comando !");
                return 1;
            }
            if(admadministrando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != 1340)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб trabalhando! (/administrar)");
                return 1;
            }
            new counter = 0;
            new result;
            new plyName[MAX_PLAYER_NAME];
            GetPlayerName(playerid, plyName, MAX_PLAYER_NAME);
            for(new i; i != MAX_VEHICLES; i++)
            {
                new dist = ChecarveiculoBSF(5, playerid, i);
                if(dist)
                {
                    result = i;
                    counter++;
                }
            }
            switch(counter)
            {
                case 0:
                {
                    SendClientMessage(playerid, COLOR_GREY, "   Nгo hб nenhum carro nesse raio!");
                }
                case 1:
                {
                    if(result < CAR_AMOUNT)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "Vocк sу pode destruir veнculos criados");
                        return 1;
                    }
                    new name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid, name, sizeof(name));
                    DestroyVehicle(result);
                    format(string, sizeof(string), "Vocк destruiu o veнculo ID:[%d]", result);
                    SendClientMessage(playerid, COLOR_GREY, string);
                    if(admadministrando[playerid] == 1 && admhide[playerid] == 1)
                    {
                        format(string, sizeof(string), "AdmAviso: Carro ID:[%d] foi destruido Por: Admin_Bot", result);
                        ABroadCast(COLOR_YELLOW,string,1);
                    }
                    else
                    {
                        format(string, sizeof(string), "AdmAviso: Carro ID:[%d] foi destruido Por: %s", result, name);
                        ABroadCast(COLOR_YELLOW,string,1);
                    }
                }
                default:
                {
                    SendClientMessage(playerid, COLOR_GREY, "   Foram encontrados mais de um carro nesse raio");
                }
            }
        }
        return 1;
Reply
#4

Cara se fosse ZCMD e SSCANF eu poderia ajudar, mais nгo intendo nada de strtok e strcmp.
Reply
#5

ok sem problemas vo esperar para ver se alguem responde aki no topico
Reply
#6

Se os veнculos criados aos quais vocк se refere forem os que nгo sгo criados no OnGameModeInit,
basta vocк pegar o ID do ъltimo veнculo criado no OnGameModeInit, e entгo, se o ID do carro que vocк quer deletar for maior que o ID desse ъltimo veнculo, aparece a mensagem de erro.
Reply
#7

tipo no gm tem as contagens de carros tipos carros das orgs , carros das orgs , carros vips mais carros das orgs +1 , e o total de carros , ae vem as defines CAR_AMOUNT e CAR_RESPAWN os cmds estao ligados ao CAR_AMOUNT ae q ta minha duvida deve ser nele q ta bug
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)