How do I create an engine system and a total system?
#1

I want to make a /engine system for my script, as well as a total system.
How?
Reply
#2

Goto www.******.co.uk

search samp engine system

There you go use the ****** to search befor posting or the search button on forum
Reply
#3

and u should say extra informations like what kind of command inculde u using (strcmd-zcmd-ycmd-etcc.)

and search on ****** sure u will find something usefull like a good format etc..
Reply
#4

There are a lot of vehicle engine systems, all you need to do is to search. Here's a simple one I made using ZCMD for the engine command.
pawn Код:
#define     VEHICLE_PARAMS_OFF      0
#define     VEHICLE_PARAMS_ON       1

new VehicleEngine[MAX_VEHICLES];

public OnPlayerUpdate(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new engine, lights, alarm, doors, bonnet, boot, objective;
        new vehicle = GetPlayerVehicleID(playerid);
        new Float:vehicleHP;
        GetVehicleHealth(vehicle, vehicleHP);
       
        if(vehicleHP <= 350) // set this to whatever you like
        {
            SetVehicleHealth(vehicle, 400);
            TogglePlayerControllable(playerid, false); // optional
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicle, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
            GameTextForPlayer(playerid, "~r~TOTALLED!", 1000, 5);
            VehicleEngine[vehicle] = VEHICLE_PARAMS_OFF;
        }
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    VehicleEngine[vehicleid] = VEHICLE_PARAMS_OFF;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
    return 1;
}

CMD:engine(playerid, params[])
{
    #pragma unused params
    new engine, lights, alarm, doors, bonnet, boot, objective;
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new vehicle = GetPlayerVehicleID(playerid);
        if(VehicleEngine[vehicle] == VEHICLE_PARAMS_OFF)
        {
            VehicleEngine[vehicle] = VEHICLE_PARAMS_ON;
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, -1, "Engine: ON");
        }
        else
        {
            VehicleEngine[vehicle] = VEHICLE_PARAMS_OFF;
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, -1, "Engine: OFF);
        }
    }
    else SendClientMessage(playerid, -1, "
You're not in the driver's seat.");
    return 1;
}
Haven't tested it though.
Reply
#5

Quote:
Originally Posted by Eyce
Посмотреть сообщение
There are a lot of vehicle engine systems, all you need to do is to search. Here's a simple one I made using ZCMD for the engine command.
pawn Код:
#define     VEHICLE_PARAMS_OFF      0
#define     VEHICLE_PARAMS_ON       1

new VehicleEngine[MAX_VEHICLES];

public OnPlayerUpdate(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new engine, lights, alarm, doors, bonnet, boot, objective;
        new vehicle = GetPlayerVehicleID(playerid);
        new Float:vehicleHP;
        GetVehicleHealth(vehicle, vehicleHP);
       
        if(vehicleHP <= 350) // set this to whatever you like
        {
            SetVehicleHealth(vehicle, 400);
            TogglePlayerControllable(playerid, false); // optional
            GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicle, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
            GameTextForPlayer(playerid, "~r~TOTALLED!", 1000, 5);
            VehicleEngine[vehicle] = VEHICLE_PARAMS_OFF;
        }
    }
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    VehicleEngine[vehicleid] = VEHICLE_PARAMS_OFF;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
    return 1;
}

CMD:engine(playerid, params[])
{
    #pragma unused params
    new engine, lights, alarm, doors, bonnet, boot, objective;
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new vehicle = GetPlayerVehicleID(playerid);
        if(VehicleEngine[vehicle] == VEHICLE_PARAMS_OFF)
        {
            VehicleEngine[vehicle] = VEHICLE_PARAMS_ON;
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, -1, "Engine: ON");
        }
        else
        {
            VehicleEngine[vehicle] = VEHICLE_PARAMS_OFF;
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective);
            SendClientMessage(playerid, -1, "Engine: OFF);
        }
    }
    else SendClientMessage(playerid, -1, "
You're not in the driver's seat.");
    return 1;
}
Haven't tested it though.
Doesn't really work, but thanks
Reply
#6

Use
pawn Код:
SetVehicleParams
to toggle the engine/doors/lights/alarm status and those.
Check out https://sampwiki.blast.hk/wiki/SetVehicleParamsEx for more information.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)