vendredi 22 juillet 2016

[Ajuda] Ligar veículo

Let's block ads! (Why?)



[Ajuda] Ligar veículo

Big Clucker

 
Glederson_dom's Avatar
 

Join Date: May 2015

Location: Uso Correto: /localizar [id]

Posts: 133

Reputation: 6

DefaultRespuesta: Ligar veículo

Quote:

Originally Posted by GabrielBiel View Post
Boa tarde
Tenho um FS de ligar veículo, porém se o player entrar no carro e acelerar, ele anda numa boa. Quero bloquear para quando o player entrar e acelerar o carro não andar. Somente se ele apertar CTRL, aí sim liga o veículo e ele consegue sair com o carro. Alguém pode ajudar?

PHP Code:

public OnGameModeInit()
{
    
ManualVehicleEngineAndLights();
    return 
1;
}

public 

OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(
IsPlayerInAnyVehicle(playerid) && newkeys == 1)
    {
        if(
motor[playerid] == 0)
        {
            new 
car = GetPlayerVehicleID(playerid), wi, ll, ia, n, dlc, dmais, he;
            
GetVehicleParamsEx(car, wi, ll, ia, n, dlc, dmais, he);
            
SetVehicleParamsEx(car, VEHICLE_PARAMS_ON, ll, ia, n, dlc, dmais, he);
            
motor[playerid] = 1;
            
SendClientMessage(playerid, -1, "Motor Ligado com Sucesso.");
            return 
1;
        }
        else if(
motor[playerid] == 1)
        {
            new 
car = GetPlayerVehicleID(playerid), wi, ll, ia, n, dlc, dmais, he;
            
GetVehicleParamsEx(car, wi, ll, ia, n, dlc, dmais, he);
            
SetVehicleParamsEx(car, VEHICLE_PARAMS_OFF, ll, ia, n, dlc, dmais, he);
            
motor[playerid] = 0;
            
SendClientMessage(playerid,-1, "Motor Desligado com Sucesso.");
            return 
1;
        }
        return 
1;
    } 
Se isso for FILTERSCRIPT mude o OnGameModeInit Para OnFilterScriptInit

PHP Code:

public OnFilterScriptInit() 
{ 
    
ManualVehicleEngineAndLights(); 
    return 
1; 
} 

__________________

Aucun commentaire:

Enregistrer un commentaire