SA-MP Forums Archive
Easy Engine system - 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: Easy Engine system (/showthread.php?tid=478798)



Easy Engine system - Jesper00 - 01.12.2013

Hey guys. I need help to script an engine system with zcmd.

And how can i make it so all cars have engine off from the start?


Re: Easy Engine system - dannyk0ed - 01.12.2013

pawn Код:
ManualVehicleEngineAndLights();
Under OnGameModeInit


Re: Easy Engine system - Jesper00 - 01.12.2013

What about the /engine with zcmd?


Re: Easy Engine system - Mitchy - 01.12.2013

Quote:
Originally Posted by Jesper00
Посмотреть сообщение
What about the /engine with zcmd?
pawn Код:
new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);   

    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);



Re: Easy Engine system - Jesper00 - 01.12.2013

...

How can i make a zcmd command with engine command?


Re: Easy Engine system - Mitchy - 01.12.2013

Untested(entire command):
pawn Код:
CMD:engine(playerid, params[])
{
    new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);    
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(Engine[vehicleid] == 0) // change this to your engine variable.
        {
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOUR_HERE, "The engine of this vehicle has been turned on.");
        }
        else if(Engine[vehicleid] == 1) // change this to your engine variable.
        {
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, COLOUR_HERE, "The engine of this vehicle has been turned off.");
        }
    }
        else return SendClientMessage(playerid, COLOUR_HERE, "You must be in a vehicle to use this command.");
    return 1;
}



Re: Easy Engine system - newbie scripter - 01.12.2013

pawn Код:
CMD:engineon(playerid, params)
{
    if(IsPlayerInAnyVehicle(playerid))
   {
    new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);  
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if( engine = 0)
    {
    SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
    }
    else return SendClientMessage(playerid, -1, "Your Vehicle's Engine Is Already On.");
    }
    else return SendClientMessage(playerid, -1, "You Need to Be In A Vehicle To Use This Command");
}



Re: Easy Engine system - Mitchy - 01.12.2013

Quote:
Originally Posted by newbie scripter
Посмотреть сообщение
pawn Код:
CMD:engineon(playerid, params)
{
    if(IsPlayerInAnyVehicle(playerid))
   {
    new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);  
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if( engine = 0)
    {
    SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
    }
    else return SendClientMessage(playerid, -1, "Your Vehicle's Engine Is Already On.");
    }
    else return SendClientMessage(playerid, -1, "You Need to Be In A Vehicle To Use This Command");
}
You should really have a global variable to detect whether the engine is on or off. It's more efficient if he wants to do an RP script


Re: Easy Engine system - Jesper00 - 01.12.2013

... I get some error.

Can you make it with the
Quote:

new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid = GetPlayerVehicleID(playerid);

GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);

And then the command in zcmd?