SA-MP Forums Archive
Car lights&hood - 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: Car lights&hood (/showthread.php?tid=304341)



Car lights&hood - tarez - 18.12.2011

Alright, quick question. How would I make a car lights turn on&off and hood up&down Never really tried and I can't find anything about it anywhere.


Re: Car lights&hood - Aira - 18.12.2011

You can study about it from test_cmds.pwn Found in your Filterscript Folder


Re: Car lights&hood - tarez - 18.12.2011

Thanks, all I needed


Re: Car lights&hood - Steven82 - 18.12.2011

Hope your using ZCMD!

I created these commands about 2 months ago for an old RP project i was working on called "Veganta Roleplay". So you may use the code with no credits needed. Enjoy.

pawn Код:
CMD:engine(playerid, 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_LIGHTRED, "Error: You are not in a vehicle.");
    if(GetPlayerVehicleSeat(playerid) != 0)
        return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You are not in the drivers seat.");
    if(engine == 1)
    {
        SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
    }
    else
    {
        SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
    }
    return 1;
}

CMD:lights(playerid, 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_LIGHTRED, "Error: You are not in a vehicle.");
    if(GetPlayerVehicleSeat(playerid) != 0)
        return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You are not in the drivers seat.");
    if(lights == 1)
    {
        SetVehicleParamsEx(vehicleid,engine,0,alarm,doors,bonnet,boot,objective);
    }
    else
    {
        SetVehicleParamsEx(vehicleid,engine,1,alarm,doors,bonnet,boot,objective);
    }
    return 1;
}

CMD:hood(playerid, 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_LIGHTRED, "Error: You are not in a vehicle.");
    if(GetPlayerVehicleSeat(playerid) != 0)
        return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You are not in the drivers seat.");
    if(bonnet == 1)
    {
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,0,boot,objective);
    }
    else
    {
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,1,boot,objective);
    }
    return 1;
}

CMD:trunk(playerid, 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_LIGHTRED, "Error: You are not in a vehicle.");
    if(GetPlayerVehicleSeat(playerid) != 0)
        return SendClientMessage(playerid, COLOR_LIGHTRED, "Error: You are not in the drivers seat.");
    if(boot == 1)
    {
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,0,objective);
    }
    else
    {
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,1,objective);
    }
    return 1;
}