How do I check if the boot is open or not?
#4

Also, this makes pawno crash for some reason.
pawn Код:
else if(strcmp(x_nr,"putgun",true) == 0)
    {
        new counter = 0;
        new result;
        new plyName[MAX_PLAYER_NAME];
        GetVehicleParamsEx(result, engine, lights, alarm, doors, bonnet, boot, objective);
        GetPlayerName(playerid, plyName, MAX_PLAYER_NAME);
        for(new i; i != MAX_VEHICLES; i++)
        {
            new dist = CheckPlayerDistanceToVehicle(3.5, playerid, i);
            if(dist)
            {
                result = i;
                counter++;
            }
        }
        switch(counter)
        {
            case 0: return SCM(playerid, COLOR_GREY, "   No cars with trunk near you");
            case 1:
            {
                if(vehTrunkCounter[result] != (MAX_TRUNK_SLOTS-1))
                {
                    if(IsAnOwnableCar(result))
                    {
                        if(PlayerInfo[playerid][pCarKey] == result) { }
                        else if(PlayerInfo[playerid][pCarKey2] == result) { }
                        else if(PlayerInfo[playerid][pCarKey3] == result) { }
                        else if(boot == 1) { }
                        else return SCM(playerid, COLOR_GREY, "  Trunk is locked !");
                    }
                    if(ReduceTime[playerid] == 1) return SCM(playerid, COLOR_GREY, "   You need to wait 3 seconds before using this command !");
                    if(IsPlayerInAnyVehicle(playerid)) return SCM(playerid, COLOR_GREY, "  You can't open the trunk while you're in the car");
                    if(IsAPlane(result) || IsABike(result) || IsAOBike(result) || IsABoat(result) || IsAPizzabike(result) || IsABus(result) || IsATowcar(result) || IsAHarvest(result) || IsADrugHarvest(result) || IsASweeper(result) || result >=78 && result <= 83|| GetVehicleModel(GetPlayerVehicleID(result)) == 523) return SCM(playerid, COLOR_GREY, "  This vehicle doesn't have the trunk !");
                    new buffer[128];
                    new gunname[24];
                    new gunID = GetPlayerWeapon(playerid);
                    new gunAmmo = GetPlayerAmmo(playerid);
                    if(gunID != 0 && gunAmmo != 0)
                    {
                        ReduceTime[playerid] = 1;
                        SetTimerEx("ReduceTimer", 3000, false, "i", playerid);
                        GetWeaponName(gunID, gunname, sizeof(gunname));
                        vehTrunkCounter[result]++;
                        vehTrunk[result][vehTrunkCounter[result]] = gunID;
                        vehTrunkAmmo[result][vehTrunkCounter[result]] = gunAmmo;
                        format(buffer, sizeof(buffer), "You have put your %s (Ammo: %i) in the car's trunk.", gunname, gunAmmo);
                        SCM(playerid, COLOR_WHITE, buffer);
                        RemovePlayerWeapon(playerid, gunID);
                        format(string, sizeof(string), "* %s opens car's trunk and puts a weapon there.", sendername);
                        Prox(30.0, playerid, string, COLOR_LIGHTBLUE);
                        SaveTrunk();
                        return 1;
                    }
                }
                else return SCM(playerid, COLOR_GREY, " Car's trunk is full");
            }
            default: return SCM(playerid, COLOR_GREY, "   Found more then one car in range");
        }
        return 1;
    }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 7 Guest(s)