Car engine works trunk and hood and lights are not working?
#1

My Code:
pawn Код:
CMD:vehicle(playerid, params[])
{
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"TIP: Try /vengine, /vlights, /vtrunk, /vhood!");
    return 1;
}

CMD:vengine(playerid, params[])
{
    new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid;
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED,"Your not driving any vehicle!");

    vehicleid = GetPlayerVehicleID(playerid);

    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(!engine)
    {
        SetVehicleParamsEx(vehicleid, true, lights, alarm, doors, bonnet, boot, objective);

    }
    else
    {
        SetVehicleParamsEx(vehicleid, false, lights, alarm, doors, bonnet, boot, objective);
    }
    return 1;
}

CMD:vlights(playerid, params[])
{
    new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid;
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED,"Your not driving any vehicle!");

    vehicleid = GetPlayerVehicleID(playerid);

    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(!lights)
    {
        SetVehicleParamsEx(vehicleid, engine, true, alarm, doors, bonnet, boot, objective);

    }
    else
    {
        SetVehicleParamsEx(vehicleid, engine, false, alarm, doors, bonnet, boot, objective);
    }
    return 1;
}

CMD:vtrunk(playerid, params[])
{
    new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid;
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED,"Your not driving any vehicle!");

    vehicleid = GetPlayerVehicleID(playerid);

    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(!boot)
    {
        SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, true, objective);

    }
    else
    {
        SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, false, objective);
    }
    return 1;
}

CMD:vhood(playerid, params[])
{
    new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid;
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED,"Your not driving any vehicle!");

    vehicleid = GetPlayerVehicleID(playerid);

    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(!bonnet)
    {
        SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, true, boot, objective);

    }
    else
    {
        SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, false, boot, objective);
    }
    return 1;
}
Only ENGINE WORKS ;( Idk why but
If i do /veh Name its spawns a car when i go inside why is the engine on if i go inside only if i do
/vengine the engine starts.
Reply
#2

Why not change your engine command in such a way that when someone uses it engine starts and also the lights.

Try this cmd.
pawn Код:
CMD:vengine(playerid, params[])
{
    new engine, lights, alarm, doors, bonnet, boot, objective, vehicleid;
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_RED,"Your not driving any vehicle!");

    vehicleid = GetPlayerVehicleID(playerid);

    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    if(!engine)
    {
        SetVehicleParamsEx(vehicleid, true, true, alarm, doors, bonnet, boot, objective);

    }
    else
    {
        SetVehicleParamsEx(vehicleid, false, false, alarm, doors, bonnet, boot, objective);
    }
    return 1;
}
Reply
#3

@Ballu yea but if its day light it won't have any sense.. How can i make it not part of them? and the hood and trunk wont work also
Reply
#4

DONE!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)