SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 11/02/2014, 09:55 PM   #1
Don_Cage
High-roller
 
Don_Cage's Avatar
 
Join Date: Aug 2012
Posts: 1,072
Reputation: 40
Default How do I check if the boot is open or not?

PHP Code:
GetVehicleParamsEx(resultenginelightsalarmdoorsbonnetbootobjective
How do I check if the boot is open or not? Can i just do if(boot == 1) or what?
Don_Cage is offline   Reply With Quote
Old 11/02/2014, 10:03 PM   #2
Riddick94
Banned
 
Join Date: Mar 2010
Location: Poland
Posts: 1,767
Reputation: 223
Default Re: How do I check if the boot is open or not?

http://wiki.sa-mp.com/wiki/GetVehicleParamsEx
Riddick94 is offline   Reply With Quote
Old 11/02/2014, 10:06 PM   #3
Don_Cage
High-roller
 
Don_Cage's Avatar
 
Join Date: Aug 2012
Posts: 1,072
Reputation: 40
Default Re: How do I check if the boot is open or not?

It doesn't say anywhere in there how I can check what it returns
Don_Cage is offline   Reply With Quote
Old 11/02/2014, 10:08 PM   #4
Don_Cage
High-roller
 
Don_Cage's Avatar
 
Join Date: Aug 2012
Posts: 1,072
Reputation: 40
Default Re: How do I check if the boot is open or not?

Also, this makes pawno crash for some reason.
pawn Code:
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;
    }
Don_Cage is offline   Reply With Quote
Old 11/02/2014, 10:27 PM   #5
Riddick94
Banned
 
Join Date: Mar 2010
Location: Poland
Posts: 1,767
Reputation: 223
Default Re: How do I check if the boot is open or not?

Really? Do I really have to do it?



And stop doing double posts.
Riddick94 is offline   Reply With Quote
Old 11/02/2014, 10:37 PM   #6
Don_Cage
High-roller
 
Don_Cage's Avatar
 
Join Date: Aug 2012
Posts: 1,072
Reputation: 40
Default Re: How do I check if the boot is open or not?

Quote:
Originally Posted by Riddick94 View Post
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 Code:
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;
    }
Don_Cage is offline   Reply With Quote
Old 11/02/2014, 10:41 PM   #7
Riddick94
Banned
 
Join Date: Mar 2010
Location: Poland
Posts: 1,767
Reputation: 223
Default Re: How do I check if the boot is open or not?



Which means that you're storing data to the local variables to do with them....? (HINT: if statement)
Riddick94 is offline   Reply With Quote
Old 11/02/2014, 10:42 PM   #8
PowerPC603
High-roller
 
Join Date: Nov 2010
Location: Belgium
Posts: 1,734
Reputation: 238
Default Re: How do I check if the boot is open or not?

pawn Code:
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
}
__________________
Gamemode: PPC_Trucking
Extras-file (for PPC_Trucking): /delproperty, /evict, /propertyid, /porthouse, /portbus, /properties
------------------------------------------------------------------------------------
PPC-Trucking-V2 (home-hosted, only open on occasion for testing purposes): ppctruckingv2.no-ip.info:7777
Youtube channel: https://www.youtube.com/channel/UC-4...Mpglma8f0Ld-YQ
------------------------------------------------------------------------------------
Filterscripts: PPC_Speedometer - PPC_Housing - PPC_Business
PowerPC603 is offline   Reply With Quote
Old 11/02/2014, 10:42 PM   #9
Don_Cage
High-roller
 
Don_Cage's Avatar
 
Join Date: Aug 2012
Posts: 1,072
Reputation: 40
Default Re: How do I check if the boot is open or not?

Quote:
Originally Posted by Riddick94 View Post


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?
Don_Cage is offline   Reply With Quote
Old 11/02/2014, 10:46 PM   #10
Riddick94
Banned
 
Join Date: Mar 2010
Location: Poland
Posts: 1,767
Reputation: 223
Default Re: How do I check if the boot is open or not?

Quote:
Originally Posted by PowerPC603 View Post
pawn Code:
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 View Post
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).
Riddick94 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check Is player near vehicle bonnet/boot? zgintasz Scripting Help 8 27/04/2014 10:47 PM
How to check if trunk is open? ricardo178 Scripting Help 4 04/06/2012 04:27 PM
Get nearby vehicle's ID & check if player is near that vehicles boot eg? HP Help Archive 2 18/05/2011 10:28 AM
check if your port is open! sandisk125 Server Support 1 10/08/2009 09:26 PM


All times are GMT. The time now is 08:28 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.