[Ajuda] bug famoso
#1

Venho aqui pedir-vos ajuda com o bug do /trancar. Acontece que quando tento abrir o carro da casa, ele diz aberto, mas continuo sem conseguir entrar no mesmo

pawn Код:
if(strcmp(cmd, "/trancar", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new carid;
            if (gTeam[playerid] == 2 || gTeam[playerid] == 1)
            {
                if(gLastCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Vocк nгo tem um carro de casa/alugado.");
                    return true;
                }
                else if(gLastCar[playerid] != 0 && gLastCar[playerid] != PlayerInfo[playerid][pPHousekey]+totalveiculos)
                {
                    if (HireCar[playerid] != gLastCar[playerid] && HireCar[playerid] > 0)
                    {
                        gLastDriver[HireCar[playerid]] = 300;
                        VTrancado[HireCar[playerid]] = 0;
                        UnLockCar(HireCar[playerid]);
                    }
                    HireCar[playerid] = gLastCar[playerid];
                }
            }
            if (PlayerInfo[playerid][pPHousekey] == 255)
            {
                if(HireCar[playerid] == 0)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro.");
                    return true;
                }
            }
            carid = PlayerInfo[playerid][pPHousekey]+totalveiculosh;
            if(HireCar[playerid] > 0 && !SwitchKey[playerid])
            {
                carid = HireCar[playerid];
            }
            //new driver = gLastDriver[carid];
            new lockstatus = VTrancado[carid];
            new Float:cx,Float:cy,Float:cz;
            GetVehiclePos(carid, cx, cy, cz);
            switch (lockstatus)
            {
                case 0:
                {
                    if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255)
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro");
                        return true;
                    }
                    if(HireCar[playerid] == carid && !SwitchKey[playerid])
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo Alugado~r~Fechado", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 1;
                        LockCar(carid);
                    }
                    else if(PlayerInfo[playerid][pPHouseCarkey] == carid)
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo da Casa ~r~Fechado", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 1;
                        LockCar(carid);
                        return true;
                    }
                }
                case 1:
                {
                    if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255)
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro");
                        return true;
                    }
                    if(HireCar[playerid] == carid && !SwitchKey[playerid])
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo Alugado~g~Aberto", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 0;
                        UnLockCar(carid);
                        SetPlayerVirtualWorld(playerid, 0);
                        SetPlayerInterior(playerid, 0);
                    }
                    if (PlayerInfo[playerid][pPHouseCarkey] == carid)
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo da Casa ~g~Aberto", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 0;
                        UnLockCar(carid);
                        SetPlayerVirtualWorld(playerid, 0);
                        SetPlayerInterior(playerid, 0);
                        return true;
                    }
                }
                default:
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Erro");
                }
            }
            if(carid == 256)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro!");
            }
        }
        return true;
    }
Cumprimentos
Reply
#2

pawn Код:
if(strcmp(cmd, "/trancar", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new carid;
            if (gTeam[playerid] == 2 || gTeam[playerid] == 1)
            {
                if(gLastCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Vocк nгo tem um carro de casa/alugado.");
                    return true;
                }
                else if(gLastCar[playerid] != 0 && gLastCar[playerid] != PlayerInfo[playerid][pPHousekey]+totalveiculos)
                {
                    if (HireCar[playerid] != gLastCar[playerid] && HireCar[playerid] > 0)
                    {
                        gLastDriver[HireCar[playerid]] = 300;
                        VTrancado[HireCar[playerid]] = 0;
                        UnLockCar(HireCar[playerid]);
                    }
                    HireCar[playerid] = gLastCar[playerid];
                }
            }
            if (PlayerInfo[playerid][pPHousekey] == 255)
            {
                if(HireCar[playerid] == 0)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro.");
                    return true;
                }
            }
            carid = PlayerInfo[playerid][pPHousekey]+totalveiculosh;
            if(HireCar[playerid] > 0 && !SwitchKey[playerid])
            {
                carid = HireCar[playerid];
            }
            //new driver = gLastDriver[carid];
            new lockstatus = VTrancado[carid];
            new Float:cx,Float:cy,Float:cz;
            GetVehiclePos(carid, cx, cy, cz);
            switch (lockstatus)
            {
                case 0:
                {
                    if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255)
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro");
                        return true;
                    }
                    if(HireCar[playerid] == carid && !SwitchKey[playerid])
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo Alugado~r~Fechado", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 1;
                        LockCar(carid);
                    }
                    else if(PlayerInfo[playerid][pPHouseCarkey] == carid)
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo da Casa ~r~Fechado", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 1;
                        UnLockCar(carid);
                        return true;
                    }
                }
                case 1:
                {
                    if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 255)
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro");
                        return true;
                    }
                    if(HireCar[playerid] == carid && !SwitchKey[playerid])
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo Alugado~g~Aberto", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 0;
                        UnLockCar(carid);
                        SetPlayerVirtualWorld(playerid, 0);
                        SetPlayerInterior(playerid, 0);
                    }
                    if (PlayerInfo[playerid][pPHouseCarkey] == carid)
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo da Casa ~g~Aberto", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 0;
                        UnLockCar(carid);
                        SetPlayerVirtualWorld(playerid, 0);
                        SetPlayerInterior(playerid, 0);
                        return true;
                    }
                }
                default:
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Erro");
                }
            }
            if(carid == 256)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro!");
            }
        }
        return true;
    }
ve agora
Reply
#3

Caro iDreak,

Continua sem funcionar, o carro ta sempre trancado.
Reply
#4

Confira o nъmero de veiculos do teu gm e altere a define da quantidade de veiculos.
Reply
#5

Caro Leo_Lost

Tкm alguma maneira de contar veiculos rapidamente ?
Reply
#6

Acredito que seja GF.
https://sampforum.blast.hk/showthread.php?tid=472917
Reply
#7

Quote:
Originally Posted by XxFaTaLxX
Посмотреть сообщение
Creio que o gm dele e definido de outra maneira mano das numeraзao tipo.

pawn Код:
#define totalveiculos 642 // Carros Normais
#define totalveiculosh 643 // Carros Normais + 1
#define totalveiculosc 883 // Carros Normais + CARROS DAS CASAS
#define CAR_AMOUNT 1013 // TODOS OS CARROS + 1
Reply
#8

Se for GF, procura "totalveiculos" e altera os nъmeros pros IDs corretos, se nгo, muitos carros podem bugar se isso nгo estiver certo, por exemplo, carros de ORG podem ficarem trancados pra sempre sу pelo gm pensar que eles sгo de casas.

Sobre o comando, tб aqui o meu, funcional.
pawn Код:
if(strcmp(cmd, "/trancar", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new carid;
            if (gTeam[playerid] == 2 || gTeam[playerid] == 1)
            {
                if(gLastCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 500)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Vocк nгo tem um carro de casa/alugado.");
                    return true;
                }
                else if(gLastCar[playerid] != 0 && gLastCar[playerid] != PlayerInfo[playerid][pPHousekey]+totalveiculos)
                {
                    if (HireCar[playerid] != gLastCar[playerid] && HireCar[playerid] > 0)
                    {
                        gLastDriver[HireCar[playerid]] = 300;
                        VTrancado[HireCar[playerid]] = 0;
                        gCarLock[HireCar[playerid]] = 0;
                        UnLockCar(HireCar[playerid]);
                    }
                    HireCar[playerid] = gLastCar[playerid];
                }
            }
            if (PlayerInfo[playerid][pPHousekey] == 500)
            {
                if(HireCar[playerid] == 0)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro.");
                    return true;
                }
            }
            carid = PlayerInfo[playerid][pPHousekey]+totalveiculosh;
            if(HireCar[playerid] > 0 && !SwitchKey[playerid])
            {
                carid = HireCar[playerid];
            }
            new lockstatus = VTrancado[carid];
            new Float:cx,Float:cy,Float:cz;
            GetVehiclePos(carid, cx, cy, cz);
            switch (lockstatus)
            {
                case 0:
                {
                    if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 500)
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro");
                        return true;
                    }
                    if(HireCar[playerid] == carid && !SwitchKey[playerid])
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo Alugado~r~Fechado", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 1;
                        gCarLock[HireCar[playerid]] = 1;
                        LockCar(carid);
                    }
                    else if(PlayerInfo[playerid][pPHouseCarkey] == carid)
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo da Casa ~r~Fechado", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 1;
                        LockCar(carid);
                        return true;
                    }
                }
                case 1:
                {
                    if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 500)
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro");
                        return true;
                    }
                    if(HireCar[playerid] == carid && !SwitchKey[playerid])
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo Alugado~g~Aberto", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 0;
                        UnLockCar(carid);
                        SetPlayerVirtualWorld(playerid, 0);
                        SetPlayerInterior(playerid, 0);
                    }
                    if (PlayerInfo[playerid][pPHouseCarkey] == carid)
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo da Casa ~g~Aberto", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 0;
                        UnLockCar(carid);
                        SetPlayerVirtualWorld(playerid, 0);
                        SetPlayerInterior(playerid, 0);
                        return true;
                    }
                }
                default:
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Erro");
                }
            }
            if(carid == 256)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro!");
            }
        }
        return true;

    }
Reply
#9

Quote:
Originally Posted by Leo_Lost
Посмотреть сообщение
Creio que o gm dele e definido de outra maneira mano das numeraзao tipo.

pawn Код:
#define totalveiculos 642 // Carros Normais
#define totalveiculosh 643 // Carros Normais + 1
#define totalveiculosc 883 // Carros Normais + CARROS DAS CASAS
#define CAR_AMOUNT 1013 // TODOS OS CARROS + 1
O meu gamemode possui esse codigo, tal e qual, do totalveiculosh, totalveiculosc, totalveiculos e car_amount

Quote:
Originally Posted by bombomloko
Посмотреть сообщение
Se for GF, procura "totalveiculos" e altera os nъmeros pros IDs corretos, se nгo, muitos carros podem bugar se isso nгo estiver certo, por exemplo, carros de ORG podem ficarem trancados pra sempre sу pelo gm pensar que eles sгo de casas.

Sobre o comando, tб aqui o meu, funcional.
pawn Код:
if(strcmp(cmd, "/trancar", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new carid;
            if (gTeam[playerid] == 2 || gTeam[playerid] == 1)
            {
                if(gLastCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 500)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Vocк nгo tem um carro de casa/alugado.");
                    return true;
                }
                else if(gLastCar[playerid] != 0 && gLastCar[playerid] != PlayerInfo[playerid][pPHousekey]+totalveiculos)
                {
                    if (HireCar[playerid] != gLastCar[playerid] && HireCar[playerid] > 0)
                    {
                        gLastDriver[HireCar[playerid]] = 300;
                        VTrancado[HireCar[playerid]] = 0;
                        gCarLock[HireCar[playerid]] = 0;
                        UnLockCar(HireCar[playerid]);
                    }
                    HireCar[playerid] = gLastCar[playerid];
                }
            }
            if (PlayerInfo[playerid][pPHousekey] == 500)
            {
                if(HireCar[playerid] == 0)
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro.");
                    return true;
                }
            }
            carid = PlayerInfo[playerid][pPHousekey]+totalveiculosh;
            if(HireCar[playerid] > 0 && !SwitchKey[playerid])
            {
                carid = HireCar[playerid];
            }
            new lockstatus = VTrancado[carid];
            new Float:cx,Float:cy,Float:cz;
            GetVehiclePos(carid, cx, cy, cz);
            switch (lockstatus)
            {
                case 0:
                {
                    if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 500)
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro");
                        return true;
                    }
                    if(HireCar[playerid] == carid && !SwitchKey[playerid])
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo Alugado~r~Fechado", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 1;
                        gCarLock[HireCar[playerid]] = 1;
                        LockCar(carid);
                    }
                    else if(PlayerInfo[playerid][pPHouseCarkey] == carid)
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo da Casa ~r~Fechado", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 1;
                        LockCar(carid);
                        return true;
                    }
                }
                case 1:
                {
                    if(HireCar[playerid] == 0 && PlayerInfo[playerid][pPHousekey] == 500)
                    {
                        SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro");
                        return true;
                    }
                    if(HireCar[playerid] == carid && !SwitchKey[playerid])
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo Alugado~g~Aberto", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 0;
                        UnLockCar(carid);
                        SetPlayerVirtualWorld(playerid, 0);
                        SetPlayerInterior(playerid, 0);
                    }
                    if (PlayerInfo[playerid][pPHouseCarkey] == carid)
                    {
                        GameTextForPlayer(playerid, "~w~Veiculo da Casa ~g~Aberto", 5000, 6);
                        PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                        VTrancado[carid] = 0;
                        UnLockCar(carid);
                        SetPlayerVirtualWorld(playerid, 0);
                        SetPlayerInterior(playerid, 0);
                        return true;
                    }
                }
                default:
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "Erro");
                }
            }
            if(carid == 256)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "Voce nгo tem um carro!");
            }
        }
        return true;

    }
Como assim " altera os nъmeros pros IDs corretos" ?
Reply
#10

Quote:
Originally Posted by Ricardo_Rockstar
Посмотреть сообщение
O meu gamemode possui esse codigo, tal e qual, do totalveiculosh, totalveiculosc, totalveiculos e car_amount


Como assim " altera os nъmeros pros IDs corretos" ?
vou te dar um exemplo:
pawn Код:
#define totalveiculos 449 // Aqui termina os Veнculos normais e das ORGS do server.
#define totalveiculosh 450 // aqui comeзa os veiculos das casas
#define totalveiculosc 758 // aqui termina os carros das casas e comeзa os veiculos VIPS
totalveiculos 449 й o ЪLTIMO id de carro normal ou carro de organizaзгo
totalveiculosh 450 й o id do PRIMEIRO carro de casa
totalveiculosc 758 й o id do PRIMEIRO carro da CONCESSIONБRIA do gf

vai no seu server e digita /ircasa 0, ve qual й o ID do carro dessa casa e esse id tu coloca no "totalveiculosh"

depois disso acho que tu vai entender e conseguir fazer

@edit:
o ID das casas comeзa apartir do id 0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)