SA-MP Forums Archive
Who can help me to make "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: Who can help me to make "engine" system? (/showthread.php?tid=453149)



Who can help me to make "engine" system? - Kapone21 - 23.07.2013

i'm trying to make a godfather server from 0


Who can give me a "Engine" system ? For players can /engine to turn on or off.. i have some engine sistems but have bugs ..


Re: Who can help me to make "engine" system? - ShaneOvSina - 24.07.2013

You could try this?
https://sampforum.blast.hk/showthread.php?tid=146982


Re: Who can help me to make "engine" system? - Vanter - 24.07.2013

pawn Код:
dcmd_engine(playerid, params[])
{
    #pragma unused params
    new vehicleid, engine,lights,alarm,doors,bonnet,boot,objective;
    vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(!IsPlayerInAnyVehicle(playerid))
        return SendClientMessage(playerid, COLOR_RED, "[ERROR] You must be in a vehicle in order to use this command.");
    if(GetPlayerVehicleSeat(playerid) != 0)
        return SendClientMessage(playerid, COLOR_RED, "[ERROR] You must be in the driver seat in order to use this command.");
    if(engine == 1)
    {
        SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
        SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE] Engine shut off.");
    }
    else
    {
        SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
        SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE] Engine started.");
    }
    return 1;
}

dcmd_lights(playerid, params[])
{
    #pragma unused params
    new vehicleid, engine,lights,alarm,doors,bonnet,boot,objective;
    vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(!IsPlayerInAnyVehicle(playerid))
        return SendClientMessage(playerid, COLOR_RED, "[ERROR] You must be in a vehicle in order to use this command.");
    if(GetPlayerVehicleSeat(playerid) != 0)
        return SendClientMessage(playerid, COLOR_RED, "[ERROR] You must be in the driver seat in order to use this command.");
    if(lights == 1)
    {
        SetVehicleParamsEx(vehicleid,engine,0,alarm,doors,bonnet,boot,objective);
        SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE] lights turned off.");
    }
    else
    {
        SetVehicleParamsEx(vehicleid,engine,1,alarm,doors,bonnet,boot,objective);
        SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE] lights turned on.");
    }
    return 1;
}

dcmd_bonnet(playerid, params[])
{
    #pragma unused params
    new vehicleid, engine,lights,alarm,doors,bonnet,boot,objective;
    vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(!IsPlayerInAnyVehicle(playerid))
        return SendClientMessage(playerid, COLOR_RED, "[ERROR] You must be in a vehicle in order to use this command.");
    if(GetPlayerVehicleSeat(playerid) != 0)
        return SendClientMessage(playerid, COLOR_RED, "[ERROR] You must be in the driver seat in order to use this command.");
    if(bonnet == 1)
    {
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,0,boot,objective);
        SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE] Bonnet closed.");
    }
    else
    {
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,1,boot,objective);
        SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE] Bonnet opened.");
    }
    return 1;
}

dcmd_boot(playerid, params[])
{
    #pragma unused params
    new vehicleid, engine,lights,alarm,doors,bonnet,boot,objective;
    vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(!IsPlayerInAnyVehicle(playerid))
        return SendClientMessage(playerid, COLOR_RED, "[ERROR] You must be in a vehicle in order to use this command.");
    if(GetPlayerVehicleSeat(playerid) != 0)
        return SendClientMessage(playerid, COLOR_RED, "[ERROR] You must be in the driver seat in order to use this command.");
    if(boot == 1)
    {
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
        SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE] Boot closed.");
    }
    else
    {
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,1,objective);
        SendClientMessage(playerid, COLOR_YELLOW, "[VEHICLE] Boot opened.");
    }
    return 1;
}
//----------------------------------------------------------------------------//
dcmd_vc(playerid, params[])
{
    #pragma unused params
    SendClientMessage(playerid, COLOR_YELLOW,"=======================================");
    SendClientMessage(playerid, COLOR_YELLOW,"Vehicle Commands:");
    SendClientMessage(playerid, COLOR_YELLOW,"/engine: Starts/Stops vehicle engine.");
    SendClientMessage(playerid, COLOR_YELLOW,"/lights: Turn vehicle lights on/off.");
    SendClientMessage(playerid, COLOR_YELLOW,"/bonnet: Open/Closes vehicle bonnet.");
    SendClientMessage(playerid, COLOR_YELLOW,"/boot: Open/Closes vehicle boot.");
    SendClientMessage(playerid, COLOR_YELLOW,"=======================================");
    return 1;
}
Thats from my old TDM server, congrats