SA-MP Forums Archive
StartVehicle stock bugs - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: StartVehicle stock bugs (/showthread.php?tid=653188)



StartVehicle stock bugs - Zeus666 - 28.04.2018

Hi. I have an tire & engine system, and I wanted to add /engine command too.


PHP код:
stock StartVehicle(playerid)
{
    new 
GetPlayerVehicleID(playerid);
    
GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
    if(
FOUR_TIRE(playerid) || FOUR_TIRE2(playerid))
    {
        if(
vInfo[i][vehicleFuel] >= 1)
        {
      if(
vInfo[i][vehicleTires] == 4)
            {
                if(
vInfo[i][vehicleEngine] == 1)
                {
     
SetVehicleParamsEx(GetPlayerVehicleID(playerid),1,lights,alarm,doors,bonnet,boot,objective);
                }
            }
        }
        if(
vInfo[i][vehicleTires] <= 3)
        {
   
SetVehicleParamsEx(GetPlayerVehicleID(playerid),0,lights,alarm,doors,bonnet,boot,objective);
        }
    }
    if(
TWO_TIRE_VEHICLE)
    {
        if(
vInfo[i][vehicleFuel] >= 1)
        {
            if(
vInfo[i][vehicleTires] == 2)
            {
                if(
vInfo[i][vehicleEngine] == 1)
                {
                    
SetVehicleParamsEx(GetPlayerVehicleID(playerid),1,lights,alarm,doors,bonnet,boot,objective);
                }
            }
        }
        if(
vInfo[i][vehicleTires] <= 1)
        {
            
SetVehicleParamsEx(GetPlayerVehicleID(playerid),0,lights,alarm,doors,bonnet,boot,objective);
        }
    }
    if(
SIX_TIRE_VEHICLE)
    {
        if(
vInfo[i][vehicleFuel] >= 1)
        {
            if(
vInfo[i][vehicleTires] == 6)
            {
                if(
vInfo[i][vehicleEngine] == 1)
                {
                    
SetVehicleParamsEx(GetPlayerVehicleID(playerid),1,lights,alarm,doors,bonnet,boot,objective);
                }
            }
        }
        if(
vInfo[i][vehicleTires] <= 5)
        {
            
SetVehicleParamsEx(GetPlayerVehicleID(playerid),0,lights,alarm,doors,bonnet,boot,objective);
        }
    }
    if(
ENGINE_ONLY_VEHICLE)
    {
        if(
vInfo[i][vehicleFuel] >= 1)
        {
            if(
vInfo[i][vehicleEngine] == 1)
            {
                
SetVehicleParamsEx(GetPlayerVehicleID(playerid),1,lights,alarm,doors,bonnet,boot,objective);
            }
         }
    }
    if(
NO_TIRE_VEHICLE)
    {
        
SetVehicleParamsEx(GetPlayerVehicleID(playerid),1,lights,alarm,doors,bonnet,boot,objective);
    }
    return 
1;

When vehicle has 4 tires and 1 engine (+fuel) it starts automatically, but I want to make it to start when I type /engine


And, when I type /engine while engine on, it won't shut off. It shows that engine is shut down, but vehicle still works. (firstly it shuts down but fastly it gets back on)


PHP код:
CMD:engine(playeridparams[])
{
    if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, -1"You need to be the driver of the vehicle");
    
GetVehicleParamsEx(GetPlayerVehicleID(playerid), enginelightsalarmdoorsbonnetbootobjective);
    if(
engine == 1)
    {
        
SetVehicleParamsEx(GetPlayerVehicleID(playerid), 0lightsalarmdoorsbonnetbootobjective);
        
SendClientMessage(playerid, -1"You have turned the engine off");
    }
    else
    {
        
SetVehicleParamsEx(GetPlayerVehicleID(playerid), 1lightsalarmdoorsbonnetbootobjective);
        
SendClientMessage(playerid, -1"You have turned the engine on");
    }
    return 
1;




Re: StartVehicle stock bugs - Dutheil - 28.04.2018

https://sampwiki.blast.hk/wiki/ManualVehicleEngineAndLights


Re: StartVehicle stock bugs - Zeus666 - 28.04.2018

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
I have put this


Re: StartVehicle stock bugs - Dutheil - 28.04.2018

Quote:
Originally Posted by Zeus666
Посмотреть сообщение
I have put this
Where ?


Re: StartVehicle stock bugs - Zeus666 - 28.04.2018

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
Where ?
ongamemodeinit {

startvehicle();


Re: StartVehicle stock bugs - Dutheil - 28.04.2018

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

startvehicle();
I was talking about ManualVehicleEngineAndLights()


Re: StartVehicle stock bugs - Zeus666 - 28.04.2018

Still doesn't work. When player enters on a car, it automatically turns it on.

When player types /engine, it shuts the engine for 1 sec and it starts again back. (because that I set if car has 4 tires, 1 engine, it will start)