SA-MP Forums Archive
How could i make group vehicles turn off and on - 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: How could i make group vehicles turn off and on (/showthread.php?tid=349301)



How could i make group vehicles turn off and on - Geniuss - 08.06.2012

Hello

How would i be able to make group vehicles turn on and off by typing /engine i am really stuck can i have some help please

Here is the code


pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
            new PlayerVehicle = GetVehicleFileID(GetPlayerVehicleID(playerid));
        new veh = GetPlayerVehicleID(playerid);

            if(Vehicles[PlayerVehicle][CarGroup] >= 0 && Vehicles[PlayerVehicle][CarGroup] == Player[playerid][Group])
        {
        new vehicleid, 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);
            }
         }
}
Please how can i make it so group vehicles and be turned on and off

Thank You

Help Is Appreciated


Re: How could i make group vehicles turn off and on - ViniBorn - 08.06.2012

Ex:
pawn Код:
if(!strcmp(cmdtext,"/engine"))
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new PlayerVehicle = GetVehicleFileID(GetPlayerVehicleID(playerid));
        new veh = GetPlayerVehicleID(playerid);

        if(Vehicles[PlayerVehicle][CarGroup] >= 0 && Vehicles[PlayerVehicle][CarGroup] == Player[playerid][Group])
        {
            new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective;
            vehicleid = GetPlayerVehicleID( playerid );
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            if(engine)
                SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
            else
                SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
        }
    }
    return true;
}