Portal SAMP
[Ajuda] Carro - Versão de Impressão

+- Portal SAMP (https://portalsamp.com)
+-- Fórum: SA-MP (https://portalsamp.com/forumdisplay.php?fid=5)
+--- Fórum: Área de suporte (https://portalsamp.com/forumdisplay.php?fid=6)
+--- Tópico: [Ajuda] Carro (/showthread.php?tid=1231)



Carro - Terrorwyd - 29/05/2021

Como faz pro farol do carro ficar piscando das vtr junto com a sirene?


RE: Carro - OTAKEIRO - 29/05/2021

Código:
new bool:gfx_farol[MAX_VEHICLES];

public OnPlayerUpdate(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new veiculo = GetPlayerVehicleID(playerid);
        if(gfx_farol[veiculo]) ToggleVehicleLights(veiculo);
    }
    return 1;
}

stock ToggleVehicleLights(vid)
{
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(lights == VEHICLE_PARAMS_UNSET || lights == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
    else SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
}

CMD:piscarfarol(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new veiculo = GetPlayerVehicleID(playerid);
        if(gfx_farol[veiculo]) gfx_farol[veiculo] = false;
        else gfx_farol[veiculo] = true;
    }
    return 1;
}
Creio que isso deve ajudar!


RE: Carro - Terrorwyd - 30/05/2021

(29/05/2021 14:50)OTAKEIRO Escreveu:
Código:
new bool:gfx_farol[MAX_VEHICLES];

public OnPlayerUpdate(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new veiculo = GetPlayerVehicleID(playerid);
        if(gfx_farol[veiculo]) ToggleVehicleLights(veiculo);
    }
    return 1;
}

stock ToggleVehicleLights(vid)
{
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(lights == VEHICLE_PARAMS_UNSET || lights == VEHICLE_PARAMS_OFF) SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_ON,alarm,doors,bonnet,boot,objective);
    else SetVehicleParamsEx(vid,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
}

CMD:piscarfarol(playerid)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new veiculo = GetPlayerVehicleID(playerid);
        if(gfx_farol[veiculo]) gfx_farol[veiculo] = false;
        else gfx_farol[veiculo] = true;
    }
    return 1;
}
Creio que isso deve ajudar!
Não deu nenhum erro mas não funciono os farois nao pisca [Imagem: 20210530-124530.jpg]