[Ajuda] Distancia Player Carro
#1

O Problema й o seguinte, funcionou ao contrбrio. Ao invйs de funcionar quando o player tб perto, quando ele estб perto diz que ele estб longe e quando ele estб longe, funciona.


pawn Код:
if (strcmp(cmd, "/trancarc", true) == 0)
    {
            tmp = strtok(cmdtext, idx);
            new vid = strval(tmp);
            new Float:x,Float:y,Float:z;
            GetVehiclePos(vid, x, y, z);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /trancarc [carid]");
                return 1;
            }
            if(PlayerInfo[playerid][pCarKey] != vid && PlayerInfo[playerid][pCarKey2] != vid && PlayerInfo[playerid][pCarKey3] != vid && HireCar[playerid] != vid
            && PlayerInfo[playerid][pCarroOrg1] != vid && PlayerInfo[playerid][pCarroOrg2] != vid && PlayerInfo[playerid][pCarroOrg3] != vid && PlayerInfo[playerid][pCarroOrg4] != vid
            && PlayerInfo[playerid][pCarroOrg5] != vid && PlayerInfo[playerid][pCarroOrg6] != vid && PlayerInfo[playerid][pCarroOrg7] != vid && PlayerInfo[playerid][pCarroOrg8] != vid
            && PlayerInfo[playerid][pCarroOrg9] != vid && PlayerInfo[playerid][pCarroOrg10] != vid && PlayerInfo[playerid][pCarroOrg11] != vid && PlayerInfo[playerid][pCarroOrg12] != vid
            && PlayerInfo[playerid][pCarroOrg13] != vid && PlayerInfo[playerid][pCarroOrg14] != vid && PlayerInfo[playerid][pCarroOrg15] != vid && PlayerInfo[playerid][pCarroOrg16] != vid
            && PlayerInfo[playerid][pCarroOrg17] != vid && PlayerInfo[playerid][pCarroOrg18] != vid && PlayerInfo[playerid][pCarroOrg19] != vid && PlayerInfo[playerid][pCarroOrg20] != vid)
            {
                SendClientMessage(playerid, COR_PM, "Vocк nгo tem a chave deste veнculo.");
                return 1;
            }
            if(IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
            {
                SendClientMessage(playerid, COR_PM, "Vocк estб longe desse veнculo!");
                return 1;
            }
            new viados[MAX_PLAYER_NAME];
            SendClientMessage(playerid, 0xFFFFFFAA, "Veнculo {F60000}Trancado!");
            GetPlayerName(playerid, viados, sizeof(viados));
            format(string, sizeof(string), "* %s trancou o veiculo com a placa %03d.", viados,vid);
            ProxDetector(20.0, playerid, string, ROXO,ROXO,ROXO,ROXO,ROXO);
            VTrancado[vid] = 1;
            LockCar(vid);
            return true;
    }
Reply
#2

pawn Код:
if (strcmp(cmd, "/trancarc", true) == 0)
    {
            tmp = strtok(cmdtext, idx);
            new vid = strval(tmp);
            new Float:x,Float:y,Float:z;
            GetVehiclePos(vid, x, y, z);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USE: /trancarc [carid]");
                return 1;
            }
            if(PlayerInfo[playerid][pCarKey] != vid && PlayerInfo[playerid][pCarKey2] != vid && PlayerInfo[playerid][pCarKey3] != vid && HireCar[playerid] != vid
            && PlayerInfo[playerid][pCarroOrg1] != vid && PlayerInfo[playerid][pCarroOrg2] != vid && PlayerInfo[playerid][pCarroOrg3] != vid && PlayerInfo[playerid][pCarroOrg4] != vid
            && PlayerInfo[playerid][pCarroOrg5] != vid && PlayerInfo[playerid][pCarroOrg6] != vid && PlayerInfo[playerid][pCarroOrg7] != vid && PlayerInfo[playerid][pCarroOrg8] != vid
            && PlayerInfo[playerid][pCarroOrg9] != vid && PlayerInfo[playerid][pCarroOrg10] != vid && PlayerInfo[playerid][pCarroOrg11] != vid && PlayerInfo[playerid][pCarroOrg12] != vid
            && PlayerInfo[playerid][pCarroOrg13] != vid && PlayerInfo[playerid][pCarroOrg14] != vid && PlayerInfo[playerid][pCarroOrg15] != vid && PlayerInfo[playerid][pCarroOrg16] != vid
            && PlayerInfo[playerid][pCarroOrg17] != vid && PlayerInfo[playerid][pCarroOrg18] != vid && PlayerInfo[playerid][pCarroOrg19] != vid && PlayerInfo[playerid][pCarroOrg20] != vid)
            {
                SendClientMessage(playerid, COR_PM, "Vocк nгo tem a chave deste veнculo.");
                return 1;
            }
            if(!IsPlayerInRangeOfPoint(playerid, 5.0, x, y, z))
            {
                SendClientMessage(playerid, COR_PM, "Vocк estб longe desse veнculo!");
                return 1;
            }
            new viados[MAX_PLAYER_NAME];
            SendClientMessage(playerid, 0xFFFFFFAA, "Veнculo {F60000}Trancado!");
            GetPlayerName(playerid, viados, sizeof(viados));
            format(string, sizeof(string), "* %s trancou o veiculo com a placa %03d.", viados,vid);
            ProxDetector(20.0, playerid, string, ROXO,ROXO,ROXO,ROXO,ROXO);
            VTrancado[vid] = 1;
            LockCar(vid);
            return true;
    }
Reply
#3

Eu sabia que tinha sido algum descuido meu, sгo meus primeiros comandos rs, obrigado ai
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)