Putting car in cargobob not working
#2

You can't have return in loop because it stops at ID 0

pawn Code:
if(strcmp(cmd, "/porcarroheli", true) == 0)
{
    if(!IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, COLOR_RED, "Erro: Nao estas em nenhum veiculo!");
    else if(!IsValidModel(GetVehicleModel(GetPlayerVehicleID(playerid)))) SendClientMessage(playerid,COLOR_RED, "Erro: Nao podes colocar este veiculo no helicoptero!");
    else
    {
        new helicoptero_id;
        new Float:CX,Float:CY,Float:CZ;
        for(new i=1; i < MAX_VEHICLES; i++)
        {
            if(DynamicCars[i][CarModel] == 548)
            {
                GetVehiclePos(i,CX,CY,CZ);
                new string2[5];
                valstr(string2,i);
                SendClientMessage(playerid, COLOR_GREEN, string2);
                if(PlayerToPoint(15.0,playerid,CX, CY, CZ))
                {
                    helicoptero_id = i;
                    break;
                }
            }
        }

        if(!helicoptero_id) SendClientMessage(playerid, COLOR_RED, "Erro: Nao te encontras perto de nenhum helicoptero!");
        else
        {
            new v = helicoptero_id;
            if(PlayerInfo[playerid][pChave1] == v || PlayerInfo[playerid][pChave2] == v || PlayerInfo[playerid][pChave3] == v || PlayerInfo[playerid][pChave4] == v || PlayerInfo[playerid][pChave5] == v || PlayerInfo[playerid][pChave6] == v)
            {
                if(DynamicCars[v][cTransporte] == 0)
                {
                    new car = DynamicCars[v][cTransporte] = GetPlayerVehicleID(playerid);
                    DynamicCars[car][CarX] = DynamicCars[car][CarY] = DynamicCars[car][CarZ] = 0;
                    DynamicCars[car][CarAngle] = DynamicCars[car][Interior] = DynamicCars[car][World] = 0;
                    DestroyVehicle(car);
                    CreateVehicle(DynamicCars[car][CarModel],DynamicCars[car][CarX],DynamicCars[car][CarY],DynamicCars[car][CarZ],DynamicCars[car][CarAngle],DynamicCars[car][CarColor1],DynamicCars[car][CarColor2], -1);
                    SaveDynamicCars();
                    SendClientMessage(playerid, COLOR_GREEN, "[Info] Colocaste um veiculo no helicoptero! Para o removeres entra no helicoptero e faz /tirarcarroheli.");
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "Erro: Este helicoptero ja contem um veiculo! Remove-o primeiro para colocares outro!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "Erro: Este helicoptero nao te pertence!");
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
Putting car in cargobob not working - by GunZsmd - 07.08.2016, 00:01
Re: Putting car in cargobob not working - by Jefff - 07.08.2016, 00:32

Forum Jump:


Users browsing this thread: 1 Guest(s)