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

PHP код:
GetVehicleParamsEx(resultenginelightsalarmdoorsbonnetbootobjective
How do I check if the boot is open or not? Can i just do if(boot == 1) or what?
Reply
#2

https://sampwiki.blast.hk/wiki/GetVehicleParamsEx
Reply
#3

It doesn't say anywhere in there how I can check what it returns
Reply
#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
#5

Really? Do I really have to do it?



And stop doing double posts.
Reply
#6

Quote:
Originally Posted by Riddick94
Посмотреть сообщение
Really? Do I really have to do it?



And stop doing double posts.
I don't think you understood me..
I said that it doesnt say how to check what it returns.. Meaning, I want to check if the boot is 1 or not. What you just showed me say what it returns when it's open.

But could you be kind and help me with this code, why do it cause pawno to crash. There is no missing brackets.
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
#7



Which means that you're storing data to the local variables to do with them....? (HINT: if statement)
Reply
#8

pawn Код:
new vid, engine, lights, alarm, doors, bonnet, boot, objective;
vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);

if (boot == 1)
{
    // Boot is open
}
else
{
    // Boot is closed
}
Reply
#9

Quote:
Originally Posted by Riddick94
Посмотреть сообщение


Which means that you're storing data to the local variables to do with them....? (HINT: if statement)
In other words, yes. Thats how I do. But do you know anything about my code?
Reply
#10

Quote:
Originally Posted by PowerPC603
Посмотреть сообщение
pawn Код:
new vid, engine, lights, alarm, doors, bonnet, boot, objective;
vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);

if (boot == 1)
{
    // Boot is open
}
else
{
    // Boot is closed
}
I hate that kind of people. We are here to help, not to give ready code. Let people shuffle their brain, or we will get more topics like that.

Quote:
Originally Posted by Don_Cage
Посмотреть сообщение
In other words, yes. Thats how I do. But do you know anything about my code?
Send me your whole code at private message please, I'll help you (in case that you don't want to share it here).
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)