SA-MP Forums Archive
Problems in command /engine - 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: Problems in command /engine (/showthread.php?tid=652078)



Problems in command /engine - JaskaranSingh - 02.04.2018

I made a command to start and stop engine which was working fine until the day before. Suddenly, it became weird. It works only on the first car that I spawn. After that, it shows 'Unknown Command'.

PHP код:
CMD:engine(playeridparams[])
{
    new 
string[256];
    new 
enginelightsalarmdoorsbonnetbootobjective;
    new 
vehicleid GetPlayerVehicleID(playerid);
    if(
IsBicycle(vehicleid))
        return 
SendClientMessage(playerid0xE74C3CFF"You are not driving a vehicle with engine!");
    if(
GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
        return 
SendClientMessage(playerid0xE74C3CFF"You are not driving a vehicle!");
    
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
    if(
engine == 1)
    {
        
engine 0;
        
format(stringsizeof(string), "%s stops the engine of a %s."GetName(playerid), GetVehicleName(vehicleid));
        
SendClientMessage(playerid0xFF66FFAAstring);
        
RangeDetector(playerid30.0string0xFF66FFAA);
    }
    else
    {
        if(
Fuel[vehicleid] > 0)
        {
            
engine 1;
            
format(stringsizeof(string), "%s starts the engine of a %s."GetName(playerid), GetVehicleName(vehicleid));
            
SendClientMessage(playerid0xFF66FFAAstring);
            
RangeDetector(playerid30.0string0xFF66FFAA);
        }
        else
        {
            
SendClientMessage(playerid0xFF66FFAA"Your vehicle is out of fuel!");
        }
    }
    
SetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
    return 
1;




Re: Problems in command /engine - Sabur - 02.04.2018

PHP код:

CMD
:engine(playeridparams[])
{
    new 
        
string[265],
        
engine,
        
lights,
        
alarm,
        
doors,
        
bonnet,
        
boot,
        
objective,
        
vehicleid GetPlayerVehicleID(playerid);

    if(
IsBicycle(vehicleid))
        return 
SendClientMessage(playerid0xE74C3CFF"You are not driving a vehicle with engine!");

    if(
GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
        return 
SendClientMessage(playerid0xE74C3CFF"You are not driving a vehicle!");

    
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);

    if(
engine == 1)
    {
        
engine 0;
        
format(stringsizeof(string), "%s stops the engine of a %s."GetName(playerid), GetVehicleName(vehicleid)); 
        
SendClientMessage(playerid0xFF66FFAAstring); 
        
RangeDetector(playerid30.0string0xFF66FFAA); 
        
SetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective); 
    }
    else
    {
        if(
Fuel[vehicleid] < 0)
            return 
SendClientMessage(playerid0xFF66FFAA"Your vehicle is out of fuel!");

        
engine 1;
        
format(stringsizeof(string), "%s starts the engine of a %s."GetName(playerid), GetVehicleName(vehicleid)); 
        
SendClientMessage(playerid0xFF66FFAAstring); 
        
RangeDetector(playerid30.0string0xFF66FFAA);
        
SetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);        
    }
    return 
1;




Re: Problems in command /engine - JaskaranSingh - 02.04.2018

Still the same problem.

Quote:
Originally Posted by Sabur
Посмотреть сообщение
PHP код:

CMD
:engine(playeridparams[])
{
    new 
        
string[265],
        
engine,
        
lights,
        
alarm,
        
doors,
        
bonnet,
        
boot,
        
objective,
        
vehicleid GetPlayerVehicleID(playerid);
    if(
IsBicycle(vehicleid))
        return 
SendClientMessage(playerid0xE74C3CFF"You are not driving a vehicle with engine!");
    if(
GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
        return 
SendClientMessage(playerid0xE74C3CFF"You are not driving a vehicle!");
    
GetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
    if(
engine == 1)
    {
        
engine 0;
        
format(stringsizeof(string), "%s stops the engine of a %s."GetName(playerid), GetVehicleName(vehicleid)); 
        
SendClientMessage(playerid0xFF66FFAAstring); 
        
RangeDetector(playerid30.0string0xFF66FFAA); 
        
SetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective); 
    }
    else
    {
        if(
Fuel[vehicleid] < 0)
            return 
SendClientMessage(playerid0xFF66FFAA"Your vehicle is out of fuel!");
        
engine 1;
        
format(stringsizeof(string), "%s starts the engine of a %s."GetName(playerid), GetVehicleName(vehicleid)); 
        
SendClientMessage(playerid0xFF66FFAAstring); 
        
RangeDetector(playerid30.0string0xFF66FFAA);
        
SetVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);        
    }
    return 
1;




Re: Problems in command /engine - JaskaranSingh - 02.04.2018

I solved it. My problem was that I had a vehicle limit.

Thanks anyway.