[Ajuda] o passegueiro liga o carro como faz so pra o condutor ligar?
#1

PHP код:
 if((newkeys == KEY_YES) && (IsPlayerInAnyVehicle(playerid)))
    {
    
//Ligar/desligar vйiculo
    
new carroa = GetPlayerVehicleID(playerid);
    new 
mot, lu, alar, por, cap, porma, ob;
    
GetVehicleParamsEx( carroa, mot, lu, alar, por, cap, porma, ob );
    if(
mot == VEHICLE_PARAMS_OFF)
    {
    
SendClientMessage(playerid, Azul, "Veiculo Ligado");
    
SetVehicleParamsEx( carroa, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob );
    }else{
    
SendClientMessage(playerid, Vermelho, "Veiculo Desligado");
    
SetVehicleParamsEx(carroa, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
    }
    } 
Reply
#2

Use o estado DRIVER.

https://sampwiki.blast.hk/wiki/GetPlayerState

Seu cуdigo ficaria semelhante a isso:

PHP код:
if((newkeys == KEY_YES)&&(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)) {
    static
        
carroa = GetPlayerVehicleID(playerid),
        
mot, lu, alar, por, cap, porma, ob
    
;
    
GetVehicleParamsEx( carroa, mot, lu, alar, por, cap, porma, ob );
    return 
mot == VEHICLE_PARAMS_OFF ? (SendClientMessage(playerid, Azul, "Veiculo Ligado"),
        
SetVehicleParamsEx( carroa, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob )):(SendClientMessage(playerid, Vermelho, "Veiculo Desligado"),
        
SetVehicleParamsEx(carroa, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob));
} 
Na verdade й isso, digo semelhante, pelo fato de eu nгo ter compilado.


Abз!
Reply
#3

Obrigado SKY, vou testar aqui
Reply
#4

Notei alguns erros no cуdigo, jб efetuei a correзгo, vк se compila ai ..
Reply
#5

Pois kk C:\Users\Hйlder\Desktop\N.R.V\Gamemode oficial NRV\gamemodes\GMNRV.pwn(41132) : error 029: invalid expression, assumed zero
C:\Users\Hйlder\Desktop\N.R.V\Gamemode oficial NRV\gamemodes\GMNRV.pwn(41135) : error 008: must be a constant expression; assumed zero deu aq tb ksks
Reply
#6

Compilou nгo amigo..

Deu um erro.. '-'

Nessa parte aq

carroa = GetPlayerVehicleID(playerid),
Reply
#7

PHP код:
if((newkeys == KEY_YES)&&(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)) { 
    static 
        
carroa, 
        
mot, lu, alar, por, cap, porma, ob 
    
; 
    
carroa = GetPlayerVehicleID(playerid);
    
GetVehicleParamsEx( carroa, mot, lu, alar, por, cap, porma, ob ); 
    return 
mot == VEHICLE_PARAMS_OFF ? (SendClientMessage(playerid, Azul, "Veiculo Ligado"), 
        
SetVehicleParamsEx( carroa, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob )):(SendClientMessage(playerid, Vermelho, "Veiculo Desligado"), 
        
SetVehicleParamsEx(carroa, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob)); 
} 
caso nгo der, tente assim.

PHP код:
if((newkeys == KEY_YES)&&(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)) {
    static 
vComp[7],
        
vehicle
    
;
    
    
vehicle = GetPlayerVehicleID(playerid);
    
GetVehicleParamsEx( vehicle, vComp[0], vComp[1], vComp[2], vComp[3], vComp[4], vComp[5], vComp[6] );
    if( 
mot == VEHICLE_PARAMS_OFF)
        
SendClientMessage(playerid, Azul, "Veiculo Ligado"),
        
SetVehicleParamsEx( carroa, VEHICLE_PARAMS_ON, vComp[1], vComp[2], vComp[3], vComp[4], vComp[5], vComp[6]);
    else
        
SendClientMessage(playerid, Vermelho, "Veiculo Desligado"),
        
SetVehicleParamsEx(carroa, VEHICLE_PARAMS_OFF, vComp[1], vComp[2], vComp[3], vComp[4], vComp[5], vComp[6]);
} 
Olha se vai agora, rsrs, perdгo estou muito tempo sem programar..
Reply
#8

Obrigado.. agora compilou sem erros..
Da pra me chmar no privado depois se puder obrigado e nos
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)